Summary
Wrap VerbatimRAG as a native LangChain BaseRetriever and/or LlamaIndex BaseRetriever so users already on those frameworks can drop verbatim extraction into existing pipelines.
Motivation
Many teams build on LangChain or LlamaIndex. A thin integration layer lets them replace the generation step with verbatim extraction without rewriting their retrieval setup.
Scope
A minimal LangChain integration could look like:
from verbatim_rag.integrations.langchain import VerbatimRetriever
retriever = VerbatimRetriever(rag=rag_system)
docs = retriever.get_relevant_documents("What is the main contribution?")
# Each Document.page_content is a verbatim span; metadata includes source doc
verbatim_rag/integrations/langchain.py — VerbatimRetriever(BaseRetriever)
verbatim_rag/integrations/llamaindex.py — VerbatimRetriever(BaseRetriever) (optional, same idea)
- Neither framework needs to be a hard dependency — guard imports with a clear error message
- Short usage example in
examples/
Notes
- The integration is a thin adapter; no changes to core logic needed
langchain-core is the relevant package for BaseRetriever (not full langchain)
Summary
Wrap
VerbatimRAGas a native LangChainBaseRetrieverand/or LlamaIndexBaseRetrieverso users already on those frameworks can drop verbatim extraction into existing pipelines.Motivation
Many teams build on LangChain or LlamaIndex. A thin integration layer lets them replace the generation step with verbatim extraction without rewriting their retrieval setup.
Scope
A minimal LangChain integration could look like:
verbatim_rag/integrations/langchain.py—VerbatimRetriever(BaseRetriever)verbatim_rag/integrations/llamaindex.py—VerbatimRetriever(BaseRetriever)(optional, same idea)examples/Notes
langchain-coreis the relevant package forBaseRetriever(not fulllangchain)