Skip to content

Commit 3f43365

Browse files
add docs
1 parent cea80f2 commit 3f43365

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

libs/providers/langchain-anthropic/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,50 @@ const response = await llmWithMemory.invoke(
135135

136136
For more information, see [Anthropic's Memory Tool documentation](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/memory-tool).
137137

138+
### Web Search Tool
139+
140+
The web search tool (`webSearch_20250305`) gives Claude direct access to real-time web content, allowing it to answer questions with up-to-date information beyond its knowledge cutoff. Claude automatically cites sources from search results as part of its answer.
141+
142+
```typescript
143+
import { ChatAnthropic, webSearch_20250305 } from "@langchain/anthropic";
144+
145+
const llm = new ChatAnthropic({
146+
model: "claude-sonnet-4-5-20250929",
147+
});
148+
149+
// Basic usage
150+
const response = await llm.invoke("What is the weather in NYC?", {
151+
tools: [webSearch_20250305()],
152+
});
153+
```
154+
155+
The web search tool supports several configuration options:
156+
157+
```typescript
158+
const response = await llm.invoke("Latest news about AI?", {
159+
tools: [
160+
webSearch_20250305({
161+
// Maximum number of times the tool can be used in the API request
162+
maxUses: 5,
163+
// Only include results from these domains
164+
allowedDomains: ["reuters.com", "bbc.com"],
165+
// Or block specific domains (cannot be used with allowedDomains)
166+
// blockedDomains: ["example.com"],
167+
// Provide user location for more relevant results
168+
userLocation: {
169+
type: "approximate",
170+
city: "San Francisco",
171+
region: "California",
172+
country: "US",
173+
timezone: "America/Los_Angeles",
174+
},
175+
}),
176+
],
177+
});
178+
```
179+
180+
For more information, see [Anthropic's Web Search Tool documentation](https://docs.anthropic.com/en/docs/build-with-claude/tool-use/web-search-tool).
181+
138182
## Development
139183

140184
To develop the Anthropic package, you'll need to follow these instructions:

0 commit comments

Comments
 (0)