Set up Respan
Set up Respan
- Sign up — Create an account at platform.respan.ai
- Create an API key — Generate one on the API keys page
- Add credits or a provider key — Add credits on the Credits page or connect your own provider key on the Integrations page
Overview
A RAG pipeline has multiple steps — retrieval, optional reranking, and generation — that can each fail silently. Tracing lets you see exactly what was retrieved, what context the LLM received, and how it responded. When something goes wrong, you can pinpoint which step broke. This cookbook builds a simple RAG pipeline with Respan tracing, so every step appears as a span in the trace tree.Setup
Full example
What you’ll see in Respan
After running the pipeline, go to Traces to see the trace tree:- Input/Output: What went in and what came out
- Latency: How long each step took
- Cost: Token usage and cost for LLM calls
Add metadata for filtering
Tag your RAG traces with metadata so you can filter and analyze them:Debug a bad answer
When a RAG answer is wrong, the trace tells you why:- Bad retrieval: The
retrieve_documentsspan shows irrelevant documents were returned → fix your embeddings or retrieval logic - Good retrieval, bad generation: The context was relevant but the LLM ignored it → adjust your system prompt
- Missing context: No relevant documents found → add more data to your knowledge base