Eric Zhu 69c0b2b5ef
fix: Add model info validation and improve error messaging (#5556)
Introduce validation for the ModelInfo dictionary to ensure required
fields are present.

Resolves #5501
2025-02-14 18:09:33 -08:00

23 lines
527 B
Python

import pytest
from autogen_core.models import ModelInfo, validate_model_info
def test_model_info() -> None:
# Valid model info.
info: ModelInfo = {
"family": "gpt-4o",
"vision": True,
"function_calling": True,
"json_output": True,
}
validate_model_info(info)
# Invalid model info.
info = {
"family": "gpt-4o",
"vision": True,
"function_calling": True,
} # type: ignore
with pytest.raises(ValueError):
validate_model_info(info)