web_search.py — anthropic-sdk-python Source File
Architecture documentation for web_search.py, a python file in the anthropic-sdk-python codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 6ed99850_2ca1_0563_7f4a_bf5873a14a69["web_search.py"] d10c5377_2939_0f0b_cc44_8759393f2853["anthropic"] 6ed99850_2ca1_0563_7f4a_bf5873a14a69 --> d10c5377_2939_0f0b_cc44_8759393f2853 style 6ed99850_2ca1_0563_7f4a_bf5873a14a69 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from __future__ import annotations
from anthropic import Anthropic
client = Anthropic()
# Create a message with web search enabled
message = client.messages.create(
model="claude-sonnet-4-5-20250929",
max_tokens=1024,
messages=[{"role": "user", "content": "What's the weather in New York?"}],
tools=[
{
"name": "web_search",
"type": "web_search_20250305",
}
],
)
# Print the full response
print("\nFull response:")
print(message.model_dump_json(indent=2))
# Extract and print the content
print("\nResponse content:")
for content_block in message.content:
if content_block.type == "text":
print(content_block.text)
# Print usage information
print("\nUsage statistics:")
print(f"Input tokens: {message.usage.input_tokens}")
print(f"Output tokens: {message.usage.output_tokens}")
if message.usage.server_tool_use:
print(f"Web search requests: {message.usage.server_tool_use.web_search_requests}")
Domain
Subdomains
Functions
Dependencies
- anthropic
Source
Frequently Asked Questions
What does web_search.py do?
web_search.py is a source file in the anthropic-sdk-python codebase, written in python. It belongs to the AnthropicClient domain, SyncAPI subdomain.
What functions are defined in web_search.py?
web_search.py defines 2 function(s): content_block, print.
What does web_search.py depend on?
web_search.py imports 1 module(s): anthropic.
Where is web_search.py in the architecture?
web_search.py is located at examples/web_search.py (domain: AnthropicClient, subdomain: SyncAPI, directory: examples).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free