← 返回 Skills 市场
ivangdavila

LangChain

作者 Iván · GitHub ↗ · v1.0.0
linuxdarwinwin32 ✓ 安全检测通过
1402
总下载
2
收藏
16
当前安装
1
版本数
在 OpenClaw 中安装
/install langchain
功能描述
Avoid common LangChain mistakes — LCEL gotchas, memory persistence, RAG chunking, and output parser traps.
使用说明 (SKILL.md)

LCEL Basics

  • | pipes output to next — prompt | llm | parser
  • RunnablePassthrough() forwards input unchanged — use in parallel branches
  • RunnableParallel runs branches concurrently — {"a": chain1, "b": chain2}
  • .invoke() for single, .batch() for multiple, .stream() for tokens
  • Input must match expected keys — {"question": x} not just x if prompt expects {question}

Memory Gotchas

  • Memory doesn't auto-persist between sessions — save/load explicitly
  • ConversationBufferMemory grows unbounded — use ConversationSummaryMemory for long chats
  • Memory key must match prompt variable — memory_key="chat_history" needs {chat_history} in prompt
  • return_messages=True for chat models — False returns string for completion models

RAG Chunking

  • Chunk size affects retrieval quality — too small loses context, too large dilutes relevance
  • Chunk overlap prevents cutting mid-sentence — 10-20% overlap typical
  • RecursiveCharacterTextSplitter preserves structure — splits on paragraphs, then sentences
  • Embedding dimension must match vector store — mixing models causes silent failures

Output Parsers

  • PydanticOutputParser needs format instructions in prompt — call .get_format_instructions()
  • Parser failures aren't always loud — malformed JSON may partially parse
  • OutputFixingParser retries with LLM — wraps another parser, fixes errors
  • with_structured_output() on chat models — cleaner than manual parsing for supported models

Retrieval

  • similarity_search returns documents — .page_content for text
  • k parameter controls results count — more isn't always better, noise increases
  • Metadata filtering before similarity — filter={"source": "docs"} in most vector stores
  • max_marginal_relevance_search for diversity — avoids redundant similar chunks

Agents

  • Agents decide tool order dynamically — chains are fixed sequence
  • Tool descriptions matter — agent uses them to decide when to call
  • handle_parsing_errors=True — prevents crash on malformed agent output
  • Max iterations prevents infinite loops — max_iterations=10 default may be too low

Common Mistakes

  • Prompt template variables case-sensitive — {Question}{question}
  • Chat models need message format — ChatPromptTemplate, not PromptTemplate
  • Callbacks not propagating — pass config={"callbacks": [...]} through chain
  • Rate limits crash silently sometimes — wrap in retry logic
  • Token count exceeds context — use trim_messages or summarization for long histories
安全使用建议
This skill is a read-only guide for LangChain best practices and appears coherent and low-risk: it asks for nothing sensitive and contains only advisory text. Before installing, confirm you trust the skill source (source/homepage are unknown). Because it's instruction-only, there is no code to execute now, but if the skill is later updated to include install steps or code files, re-check those for downloads, required credentials, or instructions that run arbitrary commands. If you plan to have an agent execute LangChain code using these tips, ensure the agent's execution environment (python3, installed packages) and access to data/credentials are controlled and limited to what you expect.
功能分析
Type: OpenClaw Skill Name: langchain Version: 1.0.0 The skill bundle contains only metadata and a markdown file providing educational content about LangChain best practices and common mistakes. There is no executable code, no instructions for the OpenClaw agent to perform any actions, no attempts at prompt injection, data exfiltration, or any other malicious or suspicious behavior. The `SKILL.md` content is purely informational.
能力评估
Purpose & Capability
Name/description (LangChain gotchas and best practices) matches the content of SKILL.md. The only declared runtime requirement is python3, which is reasonable for LangChain-related advice; no unexpected credentials, binaries, or config paths are requested.
Instruction Scope
SKILL.md contains high-level usage guidance and warnings only — it does not instruct the agent to read files, call external endpoints, or access credentials. Note: instructions are advisory; they could be used to guide actions if an agent is later asked to execute code, but the skill itself does not command execution or data collection.
Install Mechanism
No install spec and no code files are present, so nothing is written to disk or downloaded. This is the lowest-risk install profile (instruction-only).
Credentials
The skill declares no required environment variables, credentials, or config paths. There is no disproportionate request for secrets or unrelated service tokens.
Persistence & Privilege
always is false and the skill is user-invocable; it does not request permanent presence or elevated platform privileges. Autonomous model invocation remains enabled by platform default but is not a special property of this skill.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install langchain
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /langchain 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release
元数据
Slug langchain
版本 1.0.0
许可证
累计安装 17
当前安装数 16
历史版本数 1
常见问题

LangChain 是什么?

Avoid common LangChain mistakes — LCEL gotchas, memory persistence, RAG chunking, and output parser traps. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 1402 次。

如何安装 LangChain?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install langchain」即可一键安装,无需额外配置。

LangChain 是免费的吗?

是的,LangChain 完全免费(开源免费),可自由下载、安装和使用。

LangChain 支持哪些平台?

LangChain 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(linux, darwin, win32)。

谁开发了 LangChain?

由 Iván(@ivangdavila)开发并维护,当前版本 v1.0.0。

💬 留言讨论