-
-
Save topherPedersen/fcb351fdd0ee6dd5018aa6fd6578086a to your computer and use it in GitHub Desktop.
Enable the Anthropic APIs Web Search Tool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Anthropic from '@anthropic-ai/sdk'; | |
const client = new Anthropic({ | |
apiKey: 'YoUR-APi-KeY-GOEs-HeRE', // This is the default and can be omitted | |
}); | |
async function main() { | |
const message = await client.messages.create({ | |
max_tokens: 1024, | |
messages: [{ role: 'user', content: 'What bands are playing tonight at Hotel Vegas in Austin, TX?' }], | |
model: 'claude-3-7-sonnet-20250219', | |
// Enable Claude Web Search | |
tools: [{ | |
type: "web_search_20250305", | |
name: "web_search", | |
max_uses: 5 | |
}], | |
}); | |
console.log(message.content); | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment