mirror of
https://github.com/home-assistant/core.git
synced 2026-09-12 19:49:41 +01:00
Use OpenAPI 3.1.0 format for Anthropic JSON schemas (#181803)
This commit is contained in:
@@ -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,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user