OpenAI
OpenAIExecutor
¶
Class representing an interface to the Azure OpenAI API.
Source code in ragfit/models/openai_executor.py
__init__(azure_endpoint: str, api_key: str = None, api_version: str = '2024-02-15-preview', model: str = 'GPT-4-32k-Bot', chat_parameters: dict = None, delay: int = 1)
¶
Initialize the OpenAIExecutor.
Parameters:
-
azure_endpoint(str) –The Azure endpoint.
-
api_key(str, default:None) –The API key, can also read of ENV variable.
-
api_version(str, default:'2024-02-15-preview') –The API version.
-
model(str, default:'GPT-4-32k-Bot') –The model to use, sometimes called deployment or engine.
-
chat_parameters(dict, default:None) –The chat parameters.
-
delay(int, default:1) –delay between calls.
Source code in ragfit/models/openai_executor.py
chat(prompt: Union[List, str], instruction: str = None) -> str
¶
Chat with the OpenAI API.
Parameters:
-
prompt(Union[List, str]) –The prompt to chat.
-
instruction(str, default:None) –The instruction to use.
Returns:
-
str(str) –The response. Empty string if error.