mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-17 04:34:25 +00:00
fix(anthropic): drop the json tool description that makes sonnet-5 omit required keys
This commit is contained in:
parent
9b5ae73da9
commit
779006fdf9
5 changed files with 1 additions and 16 deletions
|
|
@ -1586,9 +1586,6 @@ OPENAI_FINISH_REASONS: Final = [
|
|||
]
|
||||
HUMANLOOP_PROMPT_CACHE_TTL_SECONDS: Final = int(os.getenv("HUMANLOOP_PROMPT_CACHE_TTL_SECONDS", 60)) # 1 minute
|
||||
RESPONSE_FORMAT_TOOL_NAME = "json_tool_call" # default tool name used when converting response format to tool call
|
||||
RESPONSE_FORMAT_TOOL_DESCRIPTION: Final = (
|
||||
"Return the final answer as this structured object, filling every required field."
|
||||
)
|
||||
|
||||
########################### Logging Callback Constants ###########################
|
||||
AZURE_STORAGE_MSFT_VERSION: Final = "2019-07-07"
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ from litellm.constants import (
|
|||
DEFAULT_REASONING_EFFORT_MEDIUM_THINKING_BUDGET,
|
||||
DEFAULT_REASONING_EFFORT_MINIMAL_THINKING_BUDGET,
|
||||
DEFAULT_REASONING_EFFORT_XHIGH_THINKING_BUDGET,
|
||||
RESPONSE_FORMAT_TOOL_DESCRIPTION,
|
||||
RESPONSE_FORMAT_TOOL_NAME,
|
||||
)
|
||||
from litellm.litellm_core_utils.core_helpers import map_finish_reason
|
||||
|
|
@ -1755,7 +1754,6 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig):
|
|||
|
||||
_tool: Final = AnthropicMessagesTool(
|
||||
name=RESPONSE_FORMAT_TOOL_NAME,
|
||||
description=RESPONSE_FORMAT_TOOL_DESCRIPTION,
|
||||
input_schema=_input_schema,
|
||||
)
|
||||
return _tool
|
||||
|
|
|
|||
|
|
@ -7498,7 +7498,6 @@ def test_vertex_claude_tool_emulated_response_format_returns_the_object_the_mode
|
|||
)
|
||||
json_tool = next(tool for tool in request["tools"] if tool["name"] == RESPONSE_FORMAT_TOOL_NAME)
|
||||
assert json_tool["input_schema"]["required"] == ["tier", "summary"]
|
||||
assert json_tool["description"]
|
||||
assert "output_format" not in request
|
||||
assert "output_config" not in request
|
||||
completion_response = {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ from litellm.constants import (
|
|||
DEFAULT_REASONING_EFFORT_HIGH_THINKING_BUDGET,
|
||||
DEFAULT_REASONING_EFFORT_LOW_THINKING_BUDGET,
|
||||
DEFAULT_REASONING_EFFORT_MEDIUM_THINKING_BUDGET,
|
||||
RESPONSE_FORMAT_TOOL_DESCRIPTION,
|
||||
)
|
||||
from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler
|
||||
from litellm.llms.databricks.chat.transformation import (
|
||||
|
|
@ -2144,7 +2143,6 @@ def test_databricks_claude_json_schema_preserves_refs_in_tool_parameters() -> No
|
|||
"function": {
|
||||
"name": "json_tool_call",
|
||||
"parameters": JSON_SCHEMA_RESPONSE_FORMAT["json_schema"]["schema"],
|
||||
"description": RESPONSE_FORMAT_TOOL_DESCRIPTION,
|
||||
},
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import pytest
|
|||
|
||||
import litellm
|
||||
from litellm import Router, get_optional_params
|
||||
from litellm.constants import RESPONSE_FORMAT_TOOL_DESCRIPTION
|
||||
from litellm.llms.vertex_ai.gemini.transformation import _process_gemini_media
|
||||
from litellm.types.llms.vertex_ai import BlobType
|
||||
|
||||
|
|
@ -2693,13 +2692,7 @@ def test_gemini_pro_json_schema_args_sent_httpx(
|
|||
request_body: Final = json.loads(route.calls[0].request.content)
|
||||
if "claude" in model:
|
||||
assert request_body["tool_choice"] == {"type": "tool", "name": "json_tool_call"}
|
||||
assert request_body["tools"] == [
|
||||
{
|
||||
"name": "json_tool_call",
|
||||
"description": RESPONSE_FORMAT_TOOL_DESCRIPTION,
|
||||
"input_schema": _RECIPES_SCHEMA,
|
||||
}
|
||||
]
|
||||
assert request_body["tools"] == [{"name": "json_tool_call", "input_schema": _RECIPES_SCHEMA}]
|
||||
else:
|
||||
assert request_body["generationConfig"]["response_mime_type"] == "application/json"
|
||||
assert request_body["generationConfig"]["response_json_schema"] == _RECIPES_SCHEMA
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue