microsoft/autogen · error · ValueError
model_info is required for AzureAIChatCompletionClient
Error message
model_info is required for AzureAIChatCompletionClient
What it means
Raised by AzureAIChatCompletionClient._validate_config when kwargs lack 'model_info'. Unlike the OpenAI client, the Azure AI client cannot infer capabilities from a model name string, so the required ModelInfo dict (family, vision, function_calling, json_output, ...) must be supplied; it is then passed through validate_model_info().
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/models/azure/_azure_ai_client.py:306
"""
def __init__(self, **kwargs: Unpack[AzureAIChatCompletionClientConfig]):
config = self._validate_config(kwargs) # type: ignore
self._model_info = config["model_info"] # type: ignore
self._client = self._create_client(config)
self._create_args = self._prepare_create_args(config)
self._actual_usage = RequestUsage(prompt_tokens=0, completion_tokens=0)
self._total_usage = RequestUsage(prompt_tokens=0, completion_tokens=0)
@staticmethod
def _validate_config(config: Dict[str, Any]) -> AzureAIChatCompletionClientConfig:
if "endpoint" not in config:
raise ValueError("endpoint is required for AzureAIChatCompletionClient")
if "credential" not in config:
raise ValueError("credential is required for AzureAIChatCompletionClient")
if "model_info" not in config:
raise ValueError("model_info is required for AzureAIChatCompletionClient")
validate_model_info(config["model_info"])
if _is_github_model(config["endpoint"]) and "model" not in config:
raise ValueError("model is required for when using a Github model with AzureAIChatCompletionClient")
return cast(AzureAIChatCompletionClientConfig, config)
@staticmethod
def _create_client(config: AzureAIChatCompletionClientConfig) -> ChatCompletionsClient:
# Only pass the parameters that ChatCompletionsClient accepts
# Remove 'model_info' and other client-specific parameters
client_config = {k: v for k, v in config.items() if k not in ("model_info",)}
return ChatCompletionsClient(**client_config) # type: ignore
@staticmethod
def _prepare_create_args(config: Mapping[str, Any]) -> Dict[str, Any]:
create_args = {k: v for k, v in config.items() if k in create_kwargs}
return create_args
def add_usage(self, usage: RequestUsage) -> None:View on GitHub (pinned to 027ecf0a37)
Solutions
- Supply model_info explicitly: model_info={'family': ModelFamily.GPT_4O, 'vision': True, 'function_calling': True, 'json_output': True, 'structured_output': False}
- Copy a known ModelInfo from autogen_ext.models.openai configurations for the same underlying model
- Set the 'model' kwarg too when targeting GitHub Models so the right deployment is used
Example fix
# before
client = AzureAIChatCompletionClient(endpoint=ep, credential=cred)
# after
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_core.models import ModelInfo
client = AzureAIChatCompletionClient(
endpoint=ep, credential=cred,
model_info=ModelInfo(family="gpt-4o", vision=True, function_calling=True,
json_output=True, structured_output=False),
) Defensive patterns
Strategy: validation
Validate before calling
REQUIRED = ("endpoint", "credential", "model_info")
missing = [k for k in REQUIRED if k not in cfg]
if missing:
raise ValueError(f"AzureAI config missing: {missing}")
client = AzureAIChatCompletionClient(**cfg) Type guard
from typing import Mapping
def is_complete_azure_config(cfg: Mapping) -> bool:
return all(k in cfg for k in ("endpoint", "credential", "model_info")) Prevention
- Never port OpenAI client kwargs directly; model_info is mandatory here
- Keep a canonical ModelInfo dict per deployment in config
- Validate config dicts in tests
When it happens
Trigger: Constructing AzureAIChatCompletionClient(endpoint=..., credential=...) without model_info; passing model='gpt-4o' expecting AutoGen to look up capabilities (it will not).
Common situations: Porting code from OpenAIChatCompletionClient where model_info was optional; assuming model_capabilities can be auto-detected from the deployment.
Related errors
- endpoint is required for AzureAIChatCompletionClient
- credential is required for AzureAIChatCompletionClient
- model is required for when using a Github model with AzureAI
- model_info is required when model name is not a valid OpenAI
- BING_API_KEY environment variable is not set
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/8dcc221d0e8b95ce.
Report an issue: GitHub.