Table of Contents

Namespace Mythosia.AI.Rag

Classes

AgenticRagExtensions

Extension methods for enabling Agentic RAG on AIService. Registers the RAG pipeline as a callable tool within the agent's ReAct loop.

ConversationTurn

A lightweight representation of a single conversation turn (user or assistant). Used by IQueryRewriter to provide conversation context for rewriting queries into retrieval-ready form without depending on Mythosia.AI's Message class.

DefaultContextBuilder

Default implementation of IContextBuilder that formats search results into a numbered reference block suitable for LLM prompts.

DoclingDocumentConverter

Converts DoclingDocument instances into RagDocument models used by the RAG pipeline (split โ†’ embed โ†’ store).

DocumentSourceBuilder

Builder for configuring per-source document routing (extension, loader, splitter).

LlmQueryRewriter

Rewrites follow-up queries into retrieval-ready form using an LLM, and can derive retrieval-oriented keywords for hybrid/text search. Uses StatelessMode internally so the rewriting call does not pollute conversation history.

QueryRewriteResult

The result of rewriting a query into retrieval-ready form, including optional retrieval-oriented keywords and a search gate decision.

RagBuilder

Fluent builder for configuring a RAG pipeline. Follows the same builder pattern as Mythosia.AI's WithFunction, WithSystemMessage, etc.

RagChunk

Represents a text chunk produced by an ITextSplitter.

RagDiagnosticsExtensions

Extension methods for convenient access to RAG diagnostics.

RagDocument

Represents a loaded document with its text content and associated metadata.

RagEnabledService

Wraps an AIService to intercept queries through the RAG pipeline before sending to the LLM. All calls go through IRagPipeline.ProcessAsync โ€” the AIService itself is never modified.

RagFilter
RagFinalSelectionOptions

Final selection policy applied after retrieval and optional re-ranking.

RagPipeline

RAG (Retrieval Augmented Generation) orchestrator. Coordinates the full pipeline: load ??split ??embed ??store (indexing) and query ??search ??context build ??LLM call (querying).

RagPipelineOptions

Configuration options for the RAG pipeline.

RagProcessedQuery

The output of IRagPipeline.ProcessAsync โ€” contains the transient request message content ready for the LLM, along with the original query and retrieved references.

RagQueryDiagnostics

Diagnostics metadata captured during RAG query processing.

RagQueryOptions

Public request model for per-query RAG overrides.

RagQueryResult

The result of a RAG query, containing the assembled context and search results.

RagRetrievalDerivation
RagRetrievalFilter
RagServiceExtensions

Extension methods for AIService to enable RAG functionality. Follows the same Fluent API style as Mythosia.AI's WithFunction, WithSystemMessage, etc.

RagStore

A pre-built, shareable RAG index. Build once, share across multiple AIService instances.

RagStreamDelta

Represents a single delta event during a streaming RAG query.

TemplateContextBuilder

IContextBuilder that uses a user-defined template with {context} and {question} placeholders.

Interfaces

IContextBuilder

Assembles vector search results into a context string suitable for LLM prompts.

IEmbeddingProvider

Generates embedding vectors for text inputs. Implement this interface to wrap any embedding API (OpenAI, Azure, local models, etc.).

IQueryRewriter

Rewrites a query into retrieval-ready form using conversation history, and decides whether the query needs document search (search gate). This solves the classic multi-turn RAG problem where pronouns like "that", "it", or "tell me more" fail to retrieve relevant documents because they lack key terms. Implementations may also derive retrieval-oriented query terms for keyword or hybrid search.

IRagDiagnosticsStore

Optional vector store contract for advanced RAG diagnostics. Implement this interface to enable full diagnostic capabilities such as chunk-level text lookup and all-record scoring analysis.

IRagPipeline

Core RAG pipeline interface. Processes a user query through the retrieval-augmented generation pipeline. This is the key abstraction that allows swapping the entire RAG strategy (e.g., simple retrieval, multi-step, function-calling based RAG) without touching AIService code.

IReranker

Re-ranks retrieval results to improve relevance ordering. Applied after the initial retrieval strategy and before context building. The reranker only re-scores and reorders; topK trimming is the pipeline's responsibility.

IRetrievalStrategy

Defines a retrieval strategy for the RAG pipeline. Implementations decide how to fetch relevant documents (pure vector, hybrid BM25+vector, etc.). This is an orchestration-layer abstraction โ€” it uses IVectorStore internally but is not part of the storage contract.

ITextSplitter

Splits a document into smaller chunks suitable for embedding and retrieval.

Enums

RagFinalSelectionMode

Controls how the pipeline chooses final references after optional re-ranking.

RagProgressStage

RAG pipeline stages that can be reported for progress diagnostics.

RagStreamDeltaType

Types of events emitted during a streaming RAG query.