Skip to content

Commit 29ea813

Browse files
add docs
1 parent 9e8c979 commit 29ea813

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
@@ -138,6 +138,50 @@ const response = await llmWithMemory.invoke(
138138

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

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

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

0 commit comments

Comments
 (0)