LangChain

Installation
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
Installs
2
First Seen
Apr 21, 2026
LangChain from skills.volces.com