Documentation Index
Fetch the complete documentation index at: https://docs.raglight.com/llms.txt
Use this file to discover all available pages before exploring further.
Observability with Langfuse
Overview
RAGLight integrates with Langfuse to give you full visibility over your RAG pipeline. Every call togenerate() or generate_streaming() produces a structured trace showing exactly what happened at each step.
Retrieve
See which documents were retrieved, from which collection, with which query.
Rerank
Inspect the reranking step when a CrossEncoder is active.
Generate
Trace the LLM call — prompt, model, latency, and token counts.
Installation
langfuse==4.0.0 alongside RAGLight.
Configuration
Tracing is configured viaLangfuseConfig, a dataclass that holds your Langfuse credentials.
Usage with RAGPipeline
Usage with the Builder API
Streaming support
Langfuse tracing works identically for streaming. The trace is emitted when the stream completes.Session ID
By default, a UUID is generated once perRAG instance and reused for every generate() call. This groups all turns of the same conversation under a single Langfuse session.
You can pin a custom session ID:
Use with raglight serve
When using the REST API, pass Langfuse credentials as environment variables:
.env
When
LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, and LANGFUSE_HOST (or LANGFUSE_BASE_URL) are all set, tracing is enabled automatically. If any of these are missing, RAGLight disables Langfuse entirely — no connection attempt is made to localhost:3000.Run Langfuse locally
The fastest way to get Langfuse running locally is Docker Compose:http://localhost:3000.
Summary
- Install with
pip install "raglight[langfuse]" - Pass
LangfuseConfigtoRAGConfigorbuild_rag() - Both
generate()andgenerate_streaming()are traced automatically - All LLM providers are supported
- Sessions group all turns of a conversation together
- For
raglight serve, setLANGFUSE_*env vars — no code changes needed