{"record":{"id":"da2f6580472c7bd5","repo":"microsoft/autogen","slug":"missing-required-field-field-in-modelinfo-sta","errorCode":null,"errorMessage":"Missing required field '{field}' in ModelInfo. Starting in v0.4.7, the required fields are enforced.","messagePattern":"Missing required field '(.+?)' in ModelInfo\\. Starting in v0\\.4\\.7, the required fields are enforced\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-core/src/autogen_core/models/_model_client.py","lineNumber":194,"sourceCode":"    \"\"\"True if the model supports json output, otherwise False. Note: this is different to structured json.\"\"\"\n    family: Required[ModelFamily.ANY | str]\n    \"\"\"Model family should be one of the constants from :py:class:`ModelFamily` or a string representing an unknown model family.\"\"\"\n    structured_output: Required[bool]\n    \"\"\"True if the model supports structured output, otherwise False. This is different to json_output.\"\"\"\n    multiple_system_messages: Optional[bool]\n    \"\"\"True if the model supports multiple, non-consecutive system messages, otherwise False.\"\"\"\n\n\ndef validate_model_info(model_info: ModelInfo) -> None:\n    \"\"\"Validates the model info dictionary.\n\n    Raises:\n        ValueError: If the model info dictionary is missing required fields.\n    \"\"\"\n    required_fields = [\"vision\", \"function_calling\", \"json_output\", \"family\"]\n    for field in required_fields:\n        if field not in model_info:\n            raise ValueError(\n                f\"Missing required field '{field}' in ModelInfo. \"\n                \"Starting in v0.4.7, the required fields are enforced.\"\n            )\n    new_required_fields = [\"structured_output\"]\n    for field in new_required_fields:\n        if field not in model_info:\n            warnings.warn(\n                f\"Missing required field '{field}' in ModelInfo. \"\n                \"This field will be required in a future version of AutoGen.\",\n                UserWarning,\n                stacklevel=2,\n            )\n\n\nclass ChatCompletionClient(ComponentBase[BaseModel], ABC):\n    # Caching has to be handled internally as they can depend on the create args that were stored in the constructor\n    @abstractmethod\n    async def create(","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-core/src/autogen_core/models/_model_client.py#L176-L212","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nclient = MyChatCompletionClient(\n    model=\"my-model\",\n    model_info={\"vision\": False, \"function_calling\": True},  # ValueError: missing 'json_output'\n)\n\n# after\nclient = MyChatCompletionClient(\n    model=\"my-model\",\n    model_info={\n        \"vision\": False,\n        \"function_calling\": True,\n        \"json_output\": True,\n        \"structured_output\": False,\n        \"family\": \"unknown\",\n    },\n)","handlingStrategy":"validation","validationCode":"REQUIRED = [\"vision\", \"function_calling\", \"json_output\", \"family\"]\n\ndef complete_model_info(info: dict) -> dict:\n    missing = [f for f in REQUIRED + [\"structured_output\"] if f not in info]\n    if missing:\n        raise ValueError(f\"model_info missing fields: {missing}\")\n    return info\n\nmodel_info = complete_model_info(model_info)","typeGuard":"from typing import TypedDict\n\nclass CompleteModelInfo(TypedDict, total=True):\n    vision: bool\n    function_calling: bool\n    json_output: bool\n    structured_output: bool\n    family: str\n\ndef is_complete_model_info(d: dict) -> bool:\n    return all(k in d for k in CompleteModelInfo.__annotations__)","tryCatchPattern":null,"preventionTips":["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."],"tags":["python","autogen-core","models","configuration","version-migration","validation"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}