OpenAI
OpenAI¶
OpenAI extends the Base LLM and implements the OpenAI API.
OpenAI Config¶
OpenAI Config is the configuration object for OpenAI. It is used to configure OpenAI and is passed to OpenAI when it is created.
director.llm.openai.OpenaiConfig
¶
OpenAI Interface¶
OpenAI is the LLM used by the agents and tools. It is used to generate responses to messages.
director.llm.openai.OpenAI
¶
Bases: BaseLLM
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config |
OpenaiConfig
|
OpenAI Config |
None
|
Source code in backend/director/llm/openai.py
_format_messages
¶
Format the messages to the format that OpenAI expects.
Source code in backend/director/llm/openai.py
_format_tools
¶
Format the tools to the format that OpenAI expects.
Example::
[
{
"type": "function",
"function": {
"name": "get_delivery_date",
"description": "Get the delivery date for a customer's order.",
"parameters": {
"type": "object",
"properties": {
"order_id": {
"type": "string",
"description": "The customer's order ID."
}
},
"required": ["order_id"],
"additionalProperties": False
}
}
}
]
Source code in backend/director/llm/openai.py
chat_completions
¶
Get completions for chat.
docs: https://platform.openai.com/docs/guides/function-calling