mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
fix(tests): stabilize anthropic advisor can_handle assertions
Made-with: Cursor
This commit is contained in:
parent
cad1d06c01
commit
bfd0b9fa5f
1 changed files with 22 additions and 13 deletions
|
|
@ -74,16 +74,21 @@ def test_can_handle_edge_cases():
|
|||
)
|
||||
|
||||
h = AdvisorOrchestrationHandler()
|
||||
|
||||
assert h.can_handle([ADVISOR_TOOL], "openai")
|
||||
assert h.can_handle([ADVISOR_TOOL], "bedrock")
|
||||
assert h.can_handle([ADVISOR_TOOL], "gemini")
|
||||
assert not h.can_handle([ADVISOR_TOOL], "anthropic")
|
||||
assert not h.can_handle([], "openai")
|
||||
assert not h.can_handle(None, "openai")
|
||||
assert not h.can_handle([{"type": "function", "name": "bash"}], "openai")
|
||||
# provider=None: unknown → should intercept (treat as non-native)
|
||||
assert h.can_handle([ADVISOR_TOOL], None)
|
||||
# Ensure this edge-case test is deterministic regardless of any proxy-level
|
||||
# model_group_alias configured by other tests.
|
||||
with patch(
|
||||
"litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor.resolve_proxy_model_alias_to_litellm_model",
|
||||
return_value="",
|
||||
):
|
||||
assert h.can_handle([ADVISOR_TOOL], "openai")
|
||||
assert h.can_handle([ADVISOR_TOOL], "bedrock")
|
||||
assert h.can_handle([ADVISOR_TOOL], "gemini")
|
||||
assert not h.can_handle([ADVISOR_TOOL], "anthropic")
|
||||
assert not h.can_handle([], "openai")
|
||||
assert not h.can_handle(None, "openai")
|
||||
assert not h.can_handle([{"type": "function", "name": "bash"}], "openai")
|
||||
# provider=None: unknown → should intercept (treat as non-native)
|
||||
assert h.can_handle([ADVISOR_TOOL], None)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
@ -102,9 +107,13 @@ async def test_anthropic_native_interceptor_skipped():
|
|||
)
|
||||
|
||||
h = AdvisorOrchestrationHandler()
|
||||
assert not h.can_handle(
|
||||
[ADVISOR_TOOL], "anthropic"
|
||||
), "Interceptor must NOT trigger for anthropic provider"
|
||||
with patch(
|
||||
"litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor.resolve_proxy_model_alias_to_litellm_model",
|
||||
return_value="",
|
||||
):
|
||||
assert not h.can_handle(
|
||||
[ADVISOR_TOOL], "anthropic"
|
||||
), "Interceptor must NOT trigger for anthropic provider"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue