Back to catalog / Retrieval
Answer internal knowledge questions from retrieved chunks
Chunk internal documents by heading, retrieve multiple relevant passages, then synthesize with source locations.
Goal
Build traceable retrieval-augmented Q&A over an authorized document set.
Steps
- Chunk documents by heading as in the notebook, retaining heading, text, and source-link metadata. [rag]
- Embed with Voyage
Client.embed(...), retrieve top-k by cosine similarity, and pass only those chunks to Claude. [rag] - Require answers to rely only on
<document>evidence and list sources; report insufficient evidence rather than guess. [rag]
How to verify
Check source coverage and answer correctness on a multi-chunk evaluation set, saving retrieval and end-to-end scores separately.
Troubleshooting
If a key chunk is missed, inspect boundaries, top-k, and embedding version; do not let the answer layer fabricate links.
Permissions
Prerequisites
- Python 3.11+, Anthropic and Voyage API keys, authorized documents, and an evaluation set.
Permissions
- Embed authorized material only; restrict vector/cache access and define deletion.
Limitations
The example vector store is an in-memory/local pickle demo, not production storage; enforce document ACLs before retrieval.
Pinned upstream source
- Repository
- anthropics/anthropic-cookbook
- File path
- capabilities/retrieval_augmented_generation/guide.ipynb
- Pinned commit
9c1e493ddd2b82df399d2a61b9c806c539e18be6- Source checked
- 2026-10-14 · Reviewed against the pinned upstream source
Repository metrics
These values describe the upstream repository, not popularity or likes for an individual skill or playbook.
- Stars
- Not collected
- Forks
- Not collected
- Observed at
- Not collected
No metrics snapshot is available yet.
License: MIT
Main topic
Turn ecommerce campaign materials into a reviewable weekly brief