Property | Description | Default | Type | Required |
---|---|---|---|---|
open_ai_use_https | If this flag is True, the stage is going to use the https version of open ai, if not it uses the python version. | False | boolean | No |
open_ai_api_key | This is your openai key to use the chat from your service provider. | os.environ.get('OPEN_AI_API_KEY', 'default_key') | string | Yes |
open_ai_api_base_url | Base url of your service provider for open ai chat. | os.environ.get('OPEN_AI_API_BASE_URL', 'default_url') | string | Yes |
open_ai_type | API type, its restricted by the types allowed by the enum. | EnumOpenAiType.Azure | EnumOpenAiType | Yes |
open_ai_api_version | API version of the openai chat endpoint. | os.environ.get('OPEN_AI_API_VERSION', '2023-03-15-preview') | string | Yes |
open_ai_engine_name | Name of the engine to be used. | gpt-35-turbo | string | No |
open_ai_model_name | Name of the model to be used. | gpt-35-turbo | string | No |
azure_deployment_name | Deployment name for the model (AZURE ONLY). | None | Union[string, None] | No |
open_ai_temperature | Temperature hyperparameter for open ai chat. | 0.0 | string | No |
open_ai_max_tokens | Max tokens hyperparameter for open ai chat. | 1500 | int | No |
open_ai_frequency_penalty | Hyperparameter for open ai chat. | 0.0 | float | No |
open_ai_presence_penalty | Hyperparameter for open ai chat. | 0.0 | float | No |
open_ai_top_p | Hyperparameter for open ai chat. | 1.0 | float | No |
open_ai_certificates_path | Path to pem with the certificates for your open ai chat provider. | None | string | No |
prompt_templates_begin | Path to prompt template file to be used as the starting message. | config/prompt_templates/begin/begin.tlp | Path | No |
prompt_templates_context | Path to prompt template file to be used as the context message or messages. This parameter is only used when there's no context provided in the intermediate using the api request. | config/prompt_templates/context/context.tlp | Path | No |
prompt_templates_query | Path to prompt template file to be used as the question to ask to open ai chat at the current iteration. | config/prompt_templates/query/test.tlp | Path | No |
data_preparation_stage_name | Name of the stage where the data is prepared to be ingested in the template. | - | string | Yes |
data_preparation_keys | The data preparation keys to be extracted (url, id, doc_title). | "CONTENT:doc_id, content" | Union[string, None] | No |
open_ai_url_path | The rest of the url to call open ai when using https, it's added to the api base url. If not provided, the link is builded with the other parameters provided (engine name, type, version, etc) | None | string | No |
For more info about open ai hyperparameters check the azure openai documentation Customize a model with Azure OpenAI Service - Azure OpenAI | Microsoft Learn
You can download the certificates from the main url of your service provider, using the browser button to check site's certificates information.
Parameter | Description |
---|---|
context | This is the context passed on the api call which is going to act as a template instead of the prompt_template_context. We recommend to use this feature instead of the template itself since the context for the prompt may be the previous interactions on a session so the open ai chat can have a record of the conversation it is having with the user. |
Remember that the intermediate can be fill with either other stages or the original request body that trigger the pipeline, making this essentially REST API parameters
_generative_ai_prompt = GenerativeAIPromptStage( type='GenerativeAIPromptStage', enable=True, name='MoviesPrompt', open_ai_use_https=True, open_ai_api_key='yourapikey', open_ai_api_base_url='baseurl', open_ai_api_type=EnumOpenAiType.AZURE, azure_deployment_name=my_deployment_name, open_ai_certificates_path='path/to/certs.pem', data_preparation_stage_name=_search_mapping.name, data_preparation_keys="CONTENT:MOVIE_TITLE, CONTENT" )