Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test_anthropic_websearch

Ishaan Jaffercd379c13210a
diff --git a/tests/llm_translation/test_anthropic_completion.py b/tests/llm_translation/test_anthropic_completion.py
index 677cf13c933..42a3cbfca38 100644
--- a/tests/llm_translation/test_anthropic_completion.py
+++ b/tests/llm_translation/test_anthropic_completion.py
@@ -1258,7 +1258,7 @@ def test_anthropic_websearch(optional_params: dict):
litellm._turn_on_debug()
params = {
"model": "anthropic/claude-sonnet-4-5-20250929",
- "messages": [{"role": "user", "content": "Who won the World Cup in 2022?"}],
+ "messages": [{"role": "user", "content": "What is the current weather in Tokyo right now?. Make sure to search the web for an answer"}],
**optional_params,
}
@@ -1270,7 +1270,9 @@ def test_anthropic_websearch(optional_params: dict):
assert response is not None
print(f"response: {response}\n")
- assert response.usage.server_tool_use.web_search_requests == 1
+ # When web search is requested and used, server_tool_use should be present
+ assert response.usage.server_tool_use is not None
+ assert response.usage.server_tool_use.web_search_requests >= 1
def test_anthropic_text_editor():