Feature Proposal: Langfuse/LangSmith Observability Integration for RAG Pipeline #253
codingdoneraitt
started this conversation in
Ideas
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem/Use Case
We're running LibreChat with rag_api in production and have Langfuse tracing enabled for LibreChat's LLM calls. However, we're missing visibility into the RAG pipeline itself:
Currently, Langfuse shows us the LLM conversation but not the RAG retrieval steps that happen before. This makes debugging poor retrieval quality or performance issues difficult.
Proposed Solution
Add optional LangChain Callbacks support (Langfuse/LangSmith) to trace:
- File metadata (name, size, type)
- Chunking stats (chunk count, avg size)
- Embedding generation time & batches
- User query
- Query embedding generation
- Vector search with top K results + scores
- Retrieved chunk content (truncated)
Example Implementation
Optional Langfuse integration
from langfuse.callback import CallbackHandler
Questions
- Optional configuration (no breaking changes)
- Support for multiple backends (Langfuse, LangSmith, or any LangChain callback)
- Minimal performance overhead (async logging)
Benefits
All reactions