From 28a90031033f787ad99af3597f3e50cb4576509b Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Sat, 24 Jan 2026 12:10:42 -0800 Subject: [PATCH] docs fix --- .../docs/providers/anthropic_tool_search.md | 99 +++++++++---------- 1 file changed, 48 insertions(+), 51 deletions(-) diff --git a/docs/my-website/docs/providers/anthropic_tool_search.md b/docs/my-website/docs/providers/anthropic_tool_search.md index de4bc588837..b2a60a23f65 100644 --- a/docs/my-website/docs/providers/anthropic_tool_search.md +++ b/docs/my-website/docs/providers/anthropic_tool_search.md @@ -231,15 +231,16 @@ model_list: #### Client Request ```python showLineNumbers title="Client Request via Proxy" -import openai +from anthropic import Anthropic -client = openai.OpenAI( +client = Anthropic( api_key="your-litellm-proxy-key", base_url="http://0.0.0.0:4000" ) -response = client.chat.completions.create( +response = client.messages.create( model="claude-sonnet", + max_tokens=1024, messages=[ {"role": "user", "content": "What's the weather?"} ], @@ -249,17 +250,14 @@ response = client.chat.completions.create( "name": "tool_search_tool_regex" }, { - "type": "function", - "function": { - "name": "get_weather", - "description": "Get weather information", - "parameters": { - "type": "object", - "properties": { - "location": {"type": "string"} - }, - "required": ["location"] - } + "name": "get_weather", + "description": "Get weather information", + "input_schema": { + "type": "object", + "properties": { + "location": {"type": "string"} + }, + "required": ["location"] }, "defer_loading": True } @@ -496,45 +494,44 @@ model_list: #### Client Request ```python showLineNumbers title="Client Request via Proxy (Messages API)" -import httpx +from anthropic import Anthropic -async with httpx.AsyncClient() as client: - response = await client.post( - "http://0.0.0.0:4000/anthropic/v1/messages", - headers={ - "Authorization": "Bearer your-litellm-proxy-key", - "anthropic-beta": "advanced-tool-use-2025-11-20" - }, - json={ - "model": "claude-sonnet-messages", - "messages": [ - { - "role": "user", - "content": "What's the weather?" - } - ], - "tools": [ - { - "type": "tool_search_tool_regex_20251119", - "name": "tool_search_tool_regex" - }, - { - "name": "get_weather", - "description": "Get weather information", - "input_schema": { - "type": "object", - "properties": { - "location": {"type": "string"} - }, - "required": ["location"] - }, - "defer_loading": True - } - ], - "max_tokens": 1024 +client = Anthropic( + api_key="your-litellm-proxy-key", + base_url="http://0.0.0.0:4000" +) + +response = client.messages.create( + model="claude-sonnet-messages", + max_tokens=1024, + messages=[ + { + "role": "user", + "content": "What's the weather?" } - ) - print(response.json()) + ], + tools=[ + { + "type": "tool_search_tool_regex_20251119", + "name": "tool_search_tool_regex" + }, + { + "name": "get_weather", + "description": "Get weather information", + "input_schema": { + "type": "object", + "properties": { + "location": {"type": "string"} + }, + "required": ["location"] + }, + "defer_loading": True + } + ], + extra_headers={"anthropic-beta": "advanced-tool-use-2025-11-20"} +) + +print(response) ``` ---