microsoft/autogen · error · ValueError
Missing required field '{field}' in ModelInfo. Starting in v
Error message
Missing required field '{field}' in ModelInfo. Starting in v0.4.7, the required fields are enforced. What it means
validate_model_info enforces that every ModelInfo dict passed to a ChatCompletionClient contains the keys vision, function_calling, json_output, and family — a contract made mandatory in autogen v0.4.7. Missing any one raises ValueError naming the field. A fifth key, structured_output, currently only emits a UserWarning but will become required in a future release.
Source
Thrown at python/packages/autogen-core/src/autogen_core/models/_model_client.py:194
"""True if the model supports json output, otherwise False. Note: this is different to structured json."""
family: Required[ModelFamily.ANY | str]
"""Model family should be one of the constants from :py:class:`ModelFamily` or a string representing an unknown model family."""
structured_output: Required[bool]
"""True if the model supports structured output, otherwise False. This is different to json_output."""
multiple_system_messages: Optional[bool]
"""True if the model supports multiple, non-consecutive system messages, otherwise False."""
def validate_model_info(model_info: ModelInfo) -> None:
"""Validates the model info dictionary.
Raises:
ValueError: If the model info dictionary is missing required fields.
"""
required_fields = ["vision", "function_calling", "json_output", "family"]
for field in required_fields:
if field not in model_info:
raise ValueError(
f"Missing required field '{field}' in ModelInfo. "
"Starting in v0.4.7, the required fields are enforced."
)
new_required_fields = ["structured_output"]
for field in new_required_fields:
if field not in model_info:
warnings.warn(
f"Missing required field '{field}' in ModelInfo. "
"This field will be required in a future version of AutoGen.",
UserWarning,
stacklevel=2,
)
class ChatCompletionClient(ComponentBase[BaseModel], ABC):
# Caching has to be handled internally as they can depend on the create args that were stored in the constructor
@abstractmethod
async def create(View on GitHub (pinned to 027ecf0a37)
Solutions
- Add all four required keys with correct booleans plus family, e.g. {"vision": False, "function_calling": True, "json_output": True, "family": "unknown", "structured_output": False}.
- Copy a complete ModelInfo from a known model in autogen's built-in model lists and adjust the booleans for your endpoint.
- Set family to "unknown" when the model is not a known family (ModelFamily.UNKNOWN).
- Add structured_output now to silence the future-deprecation warning.
Example fix
# before
client = MyChatCompletionClient(
model="my-model",
model_info={"vision": False, "function_calling": True}, # ValueError: missing 'json_output'
)
# after
client = MyChatCompletionClient(
model="my-model",
model_info={
"vision": False,
"function_calling": True,
"json_output": True,
"structured_output": False,
"family": "unknown",
},
) Defensive patterns
Strategy: validation
Validate before calling
REQUIRED = ["vision", "function_calling", "json_output", "family"]
def complete_model_info(info: dict) -> dict:
missing = [f for f in REQUIRED + ["structured_output"] if f not in info]
if missing:
raise ValueError(f"model_info missing fields: {missing}")
return info
model_info = complete_model_info(model_info) Type guard
from typing import TypedDict
class CompleteModelInfo(TypedDict, total=True):
vision: bool
function_calling: bool
json_output: bool
structured_output: bool
family: str
def is_complete_model_info(d: dict) -> bool:
return all(k in d for k in CompleteModelInfo.__annotations__) Prevention
- After upgrading past v0.4.7, audit every model_info dict for the four enforced keys plus structured_output.
- Define model_info once per model as a CompleteModelInfo TypedDict constant and reuse it.
- Write a config-load-time validator that checks required keys before any client is constructed.
When it happens
Trigger: Creating a client with `model_info={"vision": False, "function_calling": False}` (family/json_output missing); carrying ModelInfo dicts written for autogen < 0.4.7 into a newer version; copying partial dicts from tutorials that predate the enforcement.
Common situations: Upgrading autogen-core/autogen-ext past v0.4.7 with existing client configs; custom or local model clients (e.g. OpenAI-compatible endpoints) where model_info was hand-written; LLM-generated config code that omits fields.
Related errors
- buffer_size must be greater than 0.
- head_size must be greater than 0.
- tail_size must be greater than 0.
- token_limit must be greater than 0.
- {cls.__name__} is a namespace class and cannot be instantiat
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/da2f6580472c7bd5.
Report an issue: GitHub.