下载技能 ZIP
在 Claude 中上传
前往 设置 → 功能 → 技能 → 上传技能
开启并开始使用
测试它
正在使用“langchain-architecture”。 How do I choose the right memory type for my LangChain agent?
预期结果:
对于 10 条消息以下的短对话,使用 ConversationBufferMemory 存储所有消息。对于较长的对话,使用 ConversationSummaryMemory 总结旧消息。对于跟踪特定实体,使用 ConversationEntityMemory。对于语义检索相关历史记录,使用 VectorStoreRetrieverMemory。
正在使用“langchain-architecture”。 Create a multi-step chain that extracts entities, analyzes them, and generates a summary.
预期结果:
使用 SequentialChain 和三个 LLMChain 组件:extract_prompt 提取实体,analyze_prompt 分析实体,summary_prompt 生成最终摘要。设置 output_variables 以捕获所有中间和最终输出。
安全审计
安全All 27 static findings are false positives. The skill contains Python code examples in markdown documentation. The scanner incorrectly identified 'external_commands' (markdown code blocks), 'weak cryptographic algorithm' (agent type constants containing 'DESCRIPTION'), and 'network reconnaissance' (use case descriptions). This is educational documentation about LangChain with no executable code, network requests, or cryptographic operations.
低风险问题 (3)
质量评分
你能构建什么
AI 应用开发者
构建使用 LLM 代理的工具访问功能,以自动化多步工作流的应用程序
数据工程师
创建将内部文档与 LLM 功能相结合的 RAG 管道,用于智能查询
ML 工程师
设计具有适当记忆管理、错误处理和可观测性的生产就绪 LLM 系统
试试这些提示
创建一个可以使用搜索工具和计算器的简单 LangChain 代理。展示如何初始化代理、添加工具和运行查询。
展示如何使用 LangChain 构建检索增强生成系统。包括文档加载、文本分割、向量存储创建和问答链。
解释 LangChain 中的不同记忆类型,并展示实现 ConversationBufferMemory、ConversationSummaryMemory 和 ConversationEntityMemory 的代码。
将 LangChain 应用程序部署到生产的最佳实践是什么?包括错误处理、用于监控的回调、速率限制和测试策略。
最佳实践
- 在将用户输入传递给 LLM 链之前,始终验证和清理用户输入以防止提示注入
- 在代理和链执行周围使用 try-catch 块实现适当的错误处理
- 使用回调在生产中记录和监控令牌使用、延迟和错误
避免
- 不要超过上下文窗口限制 - 实现适当的记忆截断或摘要
- 避免使用定义不佳的工具描述 - 代理依赖描述来选择正确的工具
- 不要跳过输入验证 - 在链或提示中使用所有用户输入之前进行验证