rag.core.backends.langchain.backend¶

LangChain LCEL retrieve-and-generate over a strategy-scoped Chroma directory.

Classes¶

LangChainBackend

LangChain retriever + ChatOpenAI over a dedicated Chroma persist dir.

Module Contents¶

class rag.core.backends.langchain.backend.LangChainBackend[source]¶

LangChain retriever + ChatOpenAI over a dedicated Chroma persist dir.

ingest(*, config: rag.core.config.RagConfig, rebuild: bool = True, embed_model: object | None = None) rag.core.ingest.IngestResult[source]¶

Chunk, embed, and persist pages with LangChain + Chroma.

Parameters:
  • config (RagConfig) – Paths, chunking, and model settings.

  • rebuild (bool) – When True, delete the existing collection before writing.

  • embed_model (object or None) – Unused; LangChain builds HuggingFace embeddings from config.

Returns:

Counts and paths for the run.

Return type:

IngestResult

ask(*, question: str, config: rag.core.config.RagConfig) rag.core.query.QueryResult[source]¶

Retrieve chunks and generate an answer with LangChain.

Parameters:
  • question (str) – User question.

  • config (RagConfig) – Retrieval and model settings.

Returns:

Answer and citations.

Return type:

QueryResult

Raises:

IndexMissingError – If the Chroma collection is empty.

is_ready(*, config: rag.core.config.RagConfig) bool[source]¶

Return True when the LangChain Chroma collection is non-empty.

Parameters:

config (RagConfig) – Index configuration.

Returns:

True when at least one chunk is stored.

Return type:

bool