#langchain
22 snippets tagged with #langchain
LangChain Prompt Chain (Python)
Build a simple LLMChain with a prompt template and ChatOpenAI in LangChain.
Best for: prompt chaining
LangChain RAG Chain Pipeline
Build a retrieval-augmented generation chain with LangChain using vector store retrieval and prompt templates.
Best for: Document Q&A
Build a RAG Pipeline with LangChain
Implement retrieval-augmented generation using LangChain, embeddings, and a vector store.
Best for: Knowledge base Q&A
LangChain Conversation with Memory
Maintain conversation context across turns using LangChain memory modules.
Best for: Multi-turn chatbots
LangChain Tool-Using Agent
Build a LangChain agent with custom tools for web search, calculator, and Python REPL.
Best for: AI agents
RAG with FAISS and LangChain Python
Build a local RAG pipeline using FAISS vector store and LangChain for document Q&A.
Best for: document Q&A
Structured LLM Output with Pydantic
Parse LLM responses into validated Pydantic models using LangChain's structured output binding.
Best for: structured extraction
LangChain Conversation with Memory
Build a stateful chatbot that remembers conversation history using LangChain memory.
Best for: stateful chatbots
LangChain SQL Database Agent
Create an AI agent that answers natural language questions by querying a SQL database.
Best for: NL2SQL
LangChain Recursive Text Splitter
Split long documents into overlapping chunks optimised for LLM context windows.
Best for: PDF ingestion
LangChain Few-Shot Prompt Examples
Improve LLM accuracy with dynamic few-shot examples selected by semantic similarity.
Best for: few-shot learning
LangChain Output Parser for Code
Parse AI-generated code blocks with LangChain's custom output parsers to extract clean code.
Best for: code extraction
LangChain ReAct Agent Pattern
Implement a ReAct (Reason+Act) agent that thinks step-by-step before calling tools.
Best for: reasoning agents
LangChain create_sql_query_chain
Generate SQL from natural language using LangChain's create_sql_query_chain with schema awareness.
Best for: NL to SQL
LangChain Sequential Multi-Step Chain
Build a multi-step reasoning pipeline where each step's output feeds into the next chain.
Best for: multi-step AI pipelines
LangChain Streaming Callback Handler
Capture LLM tokens as they stream using a custom callback handler for real-time UI updates.
Best for: streaming UI
LangChain Pydantic Output Parser
Use LangChain's PydanticOutputParser to reliably parse structured data from LLM text responses.
Best for: information extraction
LangChain RAG Retrieval Chain
Build a full RAG pipeline with source citations using LangChain's create_retrieval_chain.
Best for: RAG with citations
LangChain Agent with Persistent Memory
Build an AI agent that persists conversation context across sessions using LangChain memory stores.
Best for: persistent agents
LangChain Agent with Tavily Web Search
Build a ReAct agent that searches the web in real-time using the Tavily search tool.
Best for: web search AI
Graph RAG with Neo4j and LangChain
Build a graph-based RAG system using Neo4j knowledge graph for complex relationship queries.
Best for: knowledge graph Q&A
LangChain Self-Query Retriever
Enable natural language metadata filtering in vector search with LangChain's SelfQueryRetriever.
Best for: metadata filtering