Package: aiaas-falcon
AIaaS FalconInstallation|Quickstart|DescriptionAIaaS_Falcon is Generative AI - LLM library interacts with different model api endpoints., allowing operations such as listing models, creating embeddings, and generating text based on certain configurations. AIaaS_Falcon helps to invoking the RAG pipeline in seconds.Supported Endpoint Types:Azure OpenAISingtelGPTDev_QuantizedDev_Full:shield: InstallationEnsure you have therequestsandgoogle-api-corelibraries installed:pipinstallaiaas-falconif you want to install from sourcegitclonehttps://github.com/Praveengovianalytics/AIaaS_falcon&&cdAIaaS_falcon
pipinstall-e.MethodsFalconClass__init__ (config)Intialise the Falcon object with endpoint configs.Parameter:api_key : API Keyapi_name: Name for endpointapi_endpoint: Type of endpoint ( can be azure, dev_quan, dev_full, prod)host_name_port: Host and Port Inforationuse_pil: Activate Personal Identifier Information Limit Protection (Boolean)protocol: HTTP/ HTTPSapi_type: Subroute if neededuse_pii: Whether current endpoint need Personal Identifier Information Limit Protectionlog_key: Auth Key to use the Applicationcurrent_active()Check current endpoint activeadd_endpoint(api_name,protocol,host_name_port,api_endpoint,api_key,use_pil=False)Add a new endpoint.Parameter:api_key : API Keyapi_name: Name for endpointapi_endpoint: Type of endpoint ( can be azure, dev_quan, dev_full, prod)host_name_port: Host and Port Inforationuse_pii: Activate Personal Identifier Information Limit Protection (Boolean)protocol: HTTP/ HTTPSuse_pil: Whether current endpoint need Personal Identifier Information Limit Protectionlist_endpoint()List out all endpoints in the endpoint management managerset_endpoint(name)Set target endpoint to activeParameter:name : Target endpoint's nameremove_endpoint(name)Delete endpoint by nameParameter:name : Target endpoint's namecurrent_pii()Check current Personal Identifier Information Protection activation statusswitch_pii()Switch current Personal Identifier Information Protection activation statuslist_models()List out models availableinitalise_pii()Download and intialise PII Protection.Note: This does not activate PII but initialise dependencieshealth()Check health of current endpointcreate_embedding(file_path)Create embeddings by sending files to the API.Parameter:file_path: Path to filegenerate_text_full(query="", context="", use_file=0, model="", chat_history=[], max_new_tokens: int = 200, temperature: float = 0, top_k: int = -1, frequency_penalty: int = 0, repetition_penalty: int = 1, presence_penalty: float = 0, fetch_k=100000, select_k=4, api_version='2023-05-15', guardrail={'jailbreak': False, 'moderation': False}, custom_guardrail=None)Generate text using LLM endpoint. Note: Some parameter of the endpoint is endpoint-specific.Parameter:query: a string of your promptuse_file: Whether to take file to context in generation. Only applies to dev_full and dev_quan. Need tocreate_embeddingbefore use.model: a string on the model to use. You can uselist_modelsto check for model available.chat_history: an array of chat history between user and bot. Only applies to dev_full and dev_quan. (Beta)max_new_token: maximum new token to generate. Must be integer.temperature: Float that controls the randomness of the sampling. Lower
values make the model more deterministic, while higher values make
the model more random. Zero means greedy sampling.top_k: Integer that controls the number of top tokens to consider.frequency_penalty: Float that penalizes new tokens based on their
frequency in the generated text so far.repetition_penalty: Float that penalizes new tokens based on whether
they appear in the prompt and the generated text so far.presence_penalty: Float that penalizes new tokens based on whether they
appear in the generated text so farfetch_k: Use for document retrival. Include how many element in searching. Only applies whenuse_fileis 1select k: Use to select number of document for document retrieval. Only applies whenuse_fileis 1api_version: Only applies for azure endpointguardrail: Whether to use the default jailbreak guardrail and moderation guardrailcustom_guardrail: Path to custom guardrail .yaml file. The format can be found in sample.yamlevaluate_parameter(config)Carry out grid search for parameterParameter:config: A dict. The dict must contain model and query. Parameter to grid search must be a list.model: a string of modelquery: a string of query**other parameter (eg: "temperature":list(np.arange(0,2,0.5))decrypt_hash(encrypted_data)Decret the configuration from experiment id.
Parameter:encrypted_data: a string of id:fire: Quickstartfromaiaas_falconimportFalconmodel=Falcon(api_name="azure_1",protocol='https',host_name_port='example.com',api_key='API_KEY',api_endpoint='azure',log_key="KEY")model.list_models()model.generate_text_full(query="Hello, introduce yourself",model='gpt-35-turbo-0613-vanilla',api_version='2023-05-15')ConclusionAIaaS_Falcon library simplifies interactions with the LLM API's, providing a straightforward way to perform various operations such as listing models, creating embeddings, and generating text.Authors@Praveengovianalytics@zhuofanGoogle ColabGet start with aiaas_falconBadges