A minimal Retrieval-Augmented Generation (RAG) example using LangChain and Claude.
- Loads a small markdown knowledge base from
data/ - Splits and embeds it locally with a HuggingFace sentence-transformers model (no embeddings API key needed)
- Stores the embeddings in a Chroma vector index
- Answers questions by retrieving relevant chunks and passing them to Claude (
claude-opus-4-8vialangchain-anthropic)
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# edit .env and set ANTHROPIC_API_KEYpython rag_example.pyThis asks a few sample questions against data/orbit_notes.md and prints Claude's answers, including one question ("Does Orbit integrate with Jira?") that isn't covered by the docs, to show the model declining to guess.
- Add more
.mdfiles underdata/— they're picked up automatically. - Swap
Chromafor another LangChain-supported vector store (e.g. FAISS, Pinecone). - Swap the local embeddings model for a hosted one (e.g. Voyage AI, which Anthropic recommends for embeddings) by replacing
HuggingFaceEmbeddingsinrag_example.py.