The Anthropic Cookbook provides code and guides designed to help developers build with Claude, providing copy-able code snippets that you can easily integrate into your own projects.
To make the most of the examples in this cookbook, you'll need an Anthropic API key (sign up for free here).
While the code examples are primarily written in Python, the concepts can be adapted to any programming language that supports interaction with the Anthropic API.
Looking for more resources to enhance your experience with Claude and AI assistants? Check out these helpful links:
The Anthropic Cookbook thrives on the contributions of the developer community. We value your input, whether it's submitting an idea, fixing a typo, adding a new guide, or improving an existing one. By contributing, you help make this resource even more valuable for everyone.
To avoid duplication of efforts, please review the existing issues and pull requests before contributing.
If you have ideas for new examples or guides, share them on the issues page.
- Tool use: Learn how to integrate Claude with external tools and functions to extend its capabilities. Create a customer service agent, give Claude access to a calculator, and learn how to prompt Claude to make SQL queries.
- Retrieval augmented generation: Learn how to supplement Claude's knowledge and improve the accuracy and relevance of Claude's responses with data retrieved from vector databases, Wikipedia, specific webpages, and the internet.
- Citations: Learn how to prompt Claude to cite sources in its responses.
- Sub-agents: Learn how to use of Haiku as a sub-agent in combination with Opus.
- Embeddings: Learn how to use Voyage AI to handle embeddings.
- Explore vision with Claude: This cookbook has tips on getting started with images and best practice techniques to ensure the highest quality performance with images. See how you can effectively prompt Claude with images to carry out tasks such as interpreting and analyzing charts or extracting content from forms.
- Generate images with Claude: This cookbook will show you how to have Claude generate images via Stable Diffusion.
- Upload PDFs to Claude: Discover how to parse and pass PDFs as text to Claude
- Automated evaluations: Discover how to use Claude to automate the prompt evaluation process.
- Enable JSON mode: Ensure you always get JSON with this quick and easy cookbook. Or use tool use to get structured outputs.
- Create a moderation filter with Claude: Find out how to use Claude to create a content moderation filter for your application.