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 |
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 |
---|---|
ChatCompletion | The completion. |
get_usage
Name | Description |
---|---|
response | Type: Union[ChatCompletion, Completion] |
message_retrieval
Retrieve the messages from the response.
Name | Description |
---|---|
response | The response from openai. Type: Union[ChatCompletion, Completion] |
Type | Description |
---|---|
Union[list[str], list[ChatCompletionMessage]] | The message from the response. |