anthropics/claude-cookbooks
GitHub: anthropics/claude-cookbooks
一份面向开发者的 Claude 使用食谱集,提供可复用的代码示例与集成指导。
Stars: 40045 | Forks: 4437
# Claude 食谱集
Claude 食谱集提供代码和指导,旨在帮助开发者使用 Claude 进行构建,提供可直接复用的代码片段,方便您轻松集成到自己的项目中。
## 前置条件
要充分利用本食谱集中的示例,您需要一个 Claude API 密钥([免费注册](https://www.anthropic.com))。
虽然代码示例主要使用 Python 编写,但这些概念可以适配到任何支持与 Claude API 交互的编程语言。
如果您刚开始接触 Claude API,我们建议您先学习我们的 [Claude API 基础课程](https://github.com/anthropics/courses/tree/master/anthropic_api_fundamentals),以建立扎实的基础。
## 进一步探索
希望找到更多资源来增强您使用 Claude 和 AI 助手的体验?请查看以下链接:
- [Anthropic 开发者文档](https://docs.claude.com/claude/docs/guide-to-anthropics-prompt-engineering-resources)
- [Anthropic 支持文档](https://support.anthropic.com)
- [Anthropic Discord 社区](https://www.anthropic.com/discord)
## 贡献
Claude 食谱集的发展离不开开发者社区的贡献。我们重视您的每一条反馈,无论是提出想法、修正错别字、添加新指南,还是改进现有内容。您的贡献将让这份资源对所有人更有价值。
为避免重复劳动,请在贡献前先查看现有的问题和拉取请求。
如果您有新的示例或指南想法,请在 [问题页面](https://github.com/anthropics/anthropic-cookbook/issues) 上分享。
## 食谱目录
### 功能
- [分类](https://github.com/anthropics/anthropic-cookbook/tree/main/capabilities/classification):探索使用 Claude 进行文本和数据分类的技术。
- [检索增强生成](https://github.com/anthropics/anthropic-cookbook/tree/main/capabilities/retrieval_augmented_generation):学习如何借助外部知识增强 Claude 的响应。
- [摘要](https://github.com/anthropics/anthropic-cookbook/tree/main/capabilities/summarization):发现使用 Claude 进行高效文本摘要的技术。
### 工具使用与集成
- [工具使用](https://github.com/anthropics/anthropic-cookbook/tree/main/tool_use):学习如何将 Claude 与外部工具和函数集成以扩展其能力。
- [客户服务代理](https://github.com/anthropics/anthropic-cookbook/blob/main/tool_use/customer_service_agent.ipynb)
- [计算器集成](https://github.com/anthropics/anthropic-cookbook/blob/main/tool_use/calculator_tool.ipynb)
- [SQL 查询](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/how_to_make_sql_queries.ipynb)
### 第三方集成
- [检索增强生成](https://github.com/anthropics/anthropic-cookbook/tree/main/third_party):使用外部数据源补充 Claude 的知识。
- [向量数据库(Pinecone)](https://github.com/anthropics/anthropic-cookbook/blob/main/third_party/Pinecone/rag_using_pinecone.ipynb)
- [维基百科](https://github.com/anthropics/anthropic-cookbook/blob/main/third_party/Wikipedia/wikipedia-search-cookbook.ipynb/)
- [网页](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/read_web_pages_with_haiku.ipynb)
- [使用 Voyage AI 进行嵌入](https://github.com/anthropics/anthropic-cookbook/blob/main/third_party/VoyageAI/how_to_create_embeddings.md)
### 多模态功能
- [Claude 的视觉能力](https://github.com/anthropics/anthropic-cookbook/tree/main/multimodal):
- [开始使用图像](https://github.com/anthropics/anthropic-cookbook/blob/main/multimodal/getting_started_with_vision.ipynb)
- [视觉最佳实践](https://github.com/anthropics/anthropic-cookbook/blob/main/multimodal/best_practices_for_vision.ipynb)
- [解读图表和图形](https://github.com/anthropics/anthropic-cookbook/blob/main/multimodal/reading_charts_graphs_powerpoints.ipynb)
- [从表单提取内容](https://github.com/anthropics/anthropic-cookbook/blob/main/multimodal/how_to_transcribe_text.ipynb)
- [使用 Claude 生成图像](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/illustrated_responses.ipynb):结合 Stable Diffusion 使用 Claude 进行图像生成。
### 高级技巧
- [子代理](https://github.com/anthropics/anthropic-cookbook/blob/main/multimodal/using_sub_agents.ipynb):学习如何将 Haiku 与 Opus 结合用作子代理。
- [上传 PDF 到 Claude](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/pdf_upload_summarization.ipynb):解析并传递 PDF 文本给 Claude。
- [自动化评估](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/building_evals.ipynb):使用 Claude 自动化提示词评估流程。
- [启用 JSON 模式](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/how_to_enable_json_mode.ipynb):确保 Claude 输出一致的 JSON 格式。
- [创建内容审核过滤器](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/building_moderation_filter.ipynb):使用 Claude 为您的应用创建内容审核过滤器。
- [提示词缓存](https://github.com/anthropics/anthropic-cookbook/blob/main/misc/prompt_caching.ipynb):学习使用 Claude 进行高效提示词缓存的技巧。
## 额外资源
- [AWS 上的 Anthropic](https://github.com/aws-samples/anthropic-on-aws):探索在 AWS 基础设施上使用 Claude 的示例和解决方案。
- [AWS 代码示例](https://github.com/aws-samples/):来自 AWS 的一组代码示例,可适配用于 Claude。请注意,部分示例可能需要修改才能在 Claude 上最优运行。
标签:AI 助手, AI 应用, AI 编程, Anthropic, Apex, API 集成, CIS基准, Claude, Cookbook, CVE检测, Python, RAG, SEO 关键词, 代码生成, 代码示例, 函数调用, 分类, 可观察性, 多语言支持, 威胁情报, 安全测试框架, 开发指南, 开发者工具, 开源示例, 技术教程, 提示词工程, 数据分析, 数据防泄漏, 文本分类, 文档指南, 无后门, 机器学习, 检索增强生成, 模型调用, 渗透测试工具, 策略决策点, 逆向工具