mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
test(anthropic): add advisor tool tests for /messages beta header path
This commit is contained in:
parent
ed4aa84235
commit
55f0e6605b
1 changed files with 26 additions and 0 deletions
|
|
@ -3503,3 +3503,29 @@ def test_advisor_tool_result_preserved_in_response():
|
|||
assert len(tool_results) == 1
|
||||
assert tool_results[0]["type"] == "advisor_tool_result"
|
||||
assert tool_results[0]["tool_use_id"] == "srvtoolu_abc123"
|
||||
|
||||
|
||||
def test_messages_path_advisor_beta_header_injected():
|
||||
"""advisor-tool-2026-03-01 beta header is auto-injected in /messages path."""
|
||||
config = AnthropicMessagesConfig()
|
||||
headers: dict = {}
|
||||
optional_params = {
|
||||
"tools": [
|
||||
{
|
||||
"type": "advisor_20260301",
|
||||
"name": "advisor",
|
||||
"model": "claude-opus-4-6",
|
||||
}
|
||||
]
|
||||
}
|
||||
result = config._update_headers_with_anthropic_beta(headers, optional_params)
|
||||
assert "advisor-tool-2026-03-01" in result.get("anthropic-beta", "")
|
||||
|
||||
|
||||
def test_messages_path_advisor_beta_header_preserved_when_user_sends_it():
|
||||
"""Existing anthropic-beta headers are preserved and advisor header is merged."""
|
||||
config = AnthropicMessagesConfig()
|
||||
headers: dict = {"anthropic-beta": "advisor-tool-2026-03-01"}
|
||||
optional_params: dict = {"tools": []}
|
||||
result = config._update_headers_with_anthropic_beta(headers, optional_params)
|
||||
assert "advisor-tool-2026-03-01" in result.get("anthropic-beta", "")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue