AzureOpenAIConfigBase Class
Internal class for configuring a connection to an Azure OpenAI service.
Internal class for configuring a connection to an Azure OpenAI service.
The validate_call decorator is used with a configuration that allows arbitrary types. This is necessary for types like HttpsUrl and OpenAIModelTypes.
Constructor
AzureOpenAIConfigBase(deployment_name: str, ai_model_type: OpenAIModelTypes, endpoint: Annotated[Url, UrlConstraints(max_length=2083, allowed_schemes=['https'], host_required=None, default_host=None, default_port=None, default_path=None)] | None = None, base_url: Annotated[Url, UrlConstraints(max_length=2083, allowed_schemes=['https'], host_required=None, default_host=None, default_port=None, default_path=None)] | None = None, api_version: str = '2024-10-21', service_id: str | None = None, api_key: str | None = None, ad_token: str | None = None, ad_token_provider: Callable[[], str | Awaitable[str]] | None = None, token_endpoint: str | None = None, default_headers: Mapping[str, str] | None = None, client: AsyncAzureOpenAI | None = None, instruction_role: str | None = None)
Parameters
Name | Description |
---|---|
deployment_name
Required
|
Name of the deployment. |
ai_model_type
Required
|
<xref:semantic_kernel.connectors.ai.open_ai.services.azure_config_base.OpenAIModelTypes>
The type of OpenAI model to deploy. |
endpoint
|
<xref:semantic_kernel.connectors.ai.open_ai.services.azure_config_base.HttpsUrl>
The specific endpoint URL for the deployment. (Optional) Default value: None
|
base_url
|
<xref:semantic_kernel.connectors.ai.open_ai.services.azure_config_base.HttpsUrl>
The base URL for Azure services. (Optional) Default value: None
|
api_version
|
Azure API version. Defaults to the defined DEFAULT_AZURE_API_VERSION. Default value: 2024-10-21
|
service_id
|
Service ID for the deployment. (Optional) Default value: None
|
api_key
|
API key for Azure services. (Optional) Default value: None
|
ad_token
|
Azure AD token for authentication. (Optional) Default value: None
|
ad_token_provider
|
A callable or coroutine function providing Azure AD tokens. (Optional) Default value: None
|
token_endpoint
|
Azure AD token endpoint use to get the token. (Optional) Default value: None
|
default_headers
|
Default headers for HTTP requests. (Optional) Default value: None
|
client
|
<xref:semantic_kernel.connectors.ai.open_ai.services.azure_config_base.AsyncAzureOpenAI>
An existing client to use. (Optional) Default value: None
|
instruction_role
|
<xref:<xref:semantic_kernel.connectors.ai.open_ai.services.azure_config_base.str | None>>
The role to use for 'instruction' messages, for example, summarization prompts could use developer or system. (Optional) Default value: None
|
Methods
to_dict |
Convert the configuration to a dictionary. |
to_dict
Convert the configuration to a dictionary.
to_dict() -> dict[str, str]
Attributes
ai_model_type
ai_model_type: OpenAIModelTypes
client
client: AsyncOpenAI
completion_tokens
completion_tokens: int
prompt_tokens
prompt_tokens: int
total_tokens
total_tokens: int