Skip to content

LangChain / LlamaIndex retriever integration #28

Description

@adaamko

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.pyVerbatimRetriever(BaseRetriever)
  • verbatim_rag/integrations/llamaindex.pyVerbatimRetriever(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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions