client
autogen.oai.client.OpenAIClient
OpenAIClient
Follows the Client protocol and wraps the OpenAI client.
Parameters:Name | Description |
---|---|
client | Type: Union[OpenAI, AzureOpenAI] |
response_format | Type: Union[BaseModel, dict[str, Any], None] Default: None |
Static Methods
get_usage
Name | Description |
---|---|
response | Type: Union[ChatCompletion, Completion] |
Instance Methods
cost
Calculate the cost of the response.
Parameters:Name | Description |
---|---|
response | Type: Union[ChatCompletion, Completion] |
create
Create a completion for a given config using openai’s client.
Name | Description |
---|---|
params | The params for the completion. Type: dict[str, Any] |
Type | Description |
---|---|
openai.types.chat.chat_completion.ChatCompletion | The completion. |
message_retrieval
Retrieve the messages from the response.
Parameters:Name | Description |
---|---|
response | Type: Union[ChatCompletion, Completion] |