Use OpenAPI 3.1.0 format for Anthropic JSON schemas (#181803)

This commit is contained in:
Denis Shulyaka
2026-09-10 07:04:04 +02:00
committed by GitHub
parent 5ba5c40c3a
commit b171bb8c80
2 changed files with 6 additions and 2 deletions
@@ -577,7 +577,7 @@ class ConversationSubentryFlowHandler(ConfigSubentryFlow):
"format": {
"type": "json_schema",
"schema": {
**to_openapi(location_schema),
**to_openapi(location_schema, openapi_version="3.1.0"),
"additionalProperties": False,
},
}
+5 -1
View File
@@ -150,7 +150,9 @@ def _format_tool(
) -> ToolParam:
"""Format tool specification."""
unsupported_keys = {"oneOf", "anyOf", "allOf"}
schema = to_openapi(tool.parameters, custom_serializer=custom_serializer)
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}
return ToolParam(
@@ -1114,6 +1116,7 @@ class AnthropicBaseLLMEntity(CoordinatorEntity[AnthropicCoordinator]):
custom_serializer=chat_log.llm_api.custom_serializer
if chat_log.llm_api
else llm.selector_serializer,
openapi_version="3.1.0",
),
"additionalProperties": False,
},
@@ -1162,6 +1165,7 @@ class AnthropicBaseLLMEntity(CoordinatorEntity[AnthropicCoordinator]):
custom_serializer=chat_log.llm_api.custom_serializer
if chat_log.llm_api
else llm.selector_serializer,
openapi_version="3.1.0",
),
)
)