ensure_strict_json_schema(
schema: dict[str, Any],
) -> dict[str, Any]
Mutates the given JSON schema to ensure it conforms to the strict standard
that the OpenAI API expects.
Source code in src/agents/strict_schema.py
| def ensure_strict_json_schema(
schema: dict[str, Any],
) -> dict[str, Any]:
"""Mutates the given JSON schema to ensure it conforms to the `strict` standard
that the OpenAI API expects.
"""
if schema == {}:
return _EMPTY_SCHEMA
return _ensure_strict_json_schema(schema, path=(), root=schema)
|