Use OpenAPI 3.1.0 format for litellm (#182926)

This commit is contained in:
Denis Shulyaka
2026-09-22 19:13:44 +02:00
committed by GitHub
parent b5ab1d7740
commit 6eecf17ed6
+4 -2
View File
@@ -38,8 +38,10 @@ def _format_tool(
custom_serializer: Callable[[Any], Any] | None,
) -> ChatCompletionFunctionToolParam:
"""Format tool specification."""
unsupported_keys = {"oneOf", "anyOf", "allOf"}
schema = to_openapi(tool.parameters, custom_serializer=custom_serializer)
unsupported_keys = {"oneOf", "anyOf", "allOf", "enum", "not"}
schema = to_openapi(
tool.parameters, custom_serializer=custom_serializer, openapi_version="3.1.0"
)
schema = {k: v for k, v in schema.items() if k not in unsupported_keys}
tool_spec = FunctionDefinition(