Mythosia.AI.Rag.Abstractions 6.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Mythosia.AI.Rag.Abstractions --version 6.3.0
                    
NuGet\Install-Package Mythosia.AI.Rag.Abstractions -Version 6.3.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Mythosia.AI.Rag.Abstractions" Version="6.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mythosia.AI.Rag.Abstractions" Version="6.3.0" />
                    
Directory.Packages.props
<PackageReference Include="Mythosia.AI.Rag.Abstractions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Mythosia.AI.Rag.Abstractions --version 6.3.0
                    
#r "nuget: Mythosia.AI.Rag.Abstractions, 6.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Mythosia.AI.Rag.Abstractions@6.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Mythosia.AI.Rag.Abstractions&version=6.3.0
                    
Install as a Cake Addin
#tool nuget:?package=Mythosia.AI.Rag.Abstractions&version=6.3.0
                    
Install as a Cake Tool

Mythosia.AI.Rag.Abstractions

v6.3.0: Adds IRagRetriever and RagRetrievalRequest for custom request-based retrieval. Use Mythosia.AI.Rag 8.1.0 for the corresponding builder and pipeline APIs; IRetrievalStrategy remains supported. See the release notes.

Package Summary

Core interfaces and models for the Mythosia.AI RAG ecosystem.
This package defines the contracts that all RAG components implement — you only need this directly if you're building a custom implementation.

Interfaces

Interface Description
IRagPipeline Main pipeline contract: ProcessAsync(query) → RagProcessedQuery
IEmbeddingProvider Text → vector embedding (GetEmbeddingAsync, GetEmbeddingsAsync)
IVectorStore Vector storage & search (UpsertAsync, SearchAsync, DeleteAsync)
IRagDiagnosticsStore Optional diagnostics contract (ListAllRecordsAsync, ScoredListAsync)
ITextSplitter Document → chunks (Split(RagDocument))
IContextBuilder Search results → LLM prompt (BuildContext(query, results))
IQueryRewriter Rewrites queries into retrieval-ready form using conversation history, and decides whether document search is needed (search gate)
IRagRetriever Request-based retrieval without a mandatory query embedding; owns preparation, filtering, limits and cancellation
IRetrievalStrategy Existing dense-input strategy, retained through a compatibility adapter
IReranker Re-ranks search results post-retrieval for improved relevance

Models

Model Description
RagRetrievalRequest Read-only Query, nullable TextQuery, TopK, Filter, ProgressAsync; null lexical override uses the full query in built-in retrievers
RagChunk A chunk of text with ID, content, document ID, index, and metadata
RagDocument A loaded document with Id, Content, Source, and Metadata for the RAG pipeline
RagProcessedQuery Pipeline output: original query, rewritten semantic query, retrieval keywords, RequestMessageContent, references, RetrievalCandidates, SearchSkipped, RewriteResult, HasReferences flag, and Diagnostics
QueryRewriteResult Result of rewriting a query into retrieval-ready form, including search gate decision (NeedsSearch) and optional retrieval keywords. Factory methods Pass() and Search()
ConversationTurn Lightweight DTO representing a single conversation turn (role + content) for IQueryRewriter context
RagQueryDiagnostics Applied retrieval metadata (FinalTopK, RetrievalTopK, AppliedFinalMinScore, AppliedRetrievalMinScore, ElapsedMs, RewriteElapsedMs)
RagPipelineOptions Configuration: DefaultQuery, PromptTemplate, EmbeddingBatchSize. Includes Clone() for snapshot-style runtime updates
RagQueryOptions Per-request overrides: FinalFilter, RetrievalDerivation, StoreFilter, FinalSelection, ProgressAsync. Includes Clone() for safe per-query overrides on top of RagPipelineOptions.DefaultQuery
RagFinalSelectionOptions Final selection policy after re-ranking (Mode, RetrievalWeight). Includes Clone()
RagFinalSelectionMode Enum: RerankerOnly (default) or WeightedBlend
RagFilter Final selection policy (TopK, MinScore). Includes Clone()
RagRetrievalDerivation Controls how retrieval candidates are derived (TopKMultiplier, MinScoreDivider). Includes Clone()
RagRetrievalFilter Immutable computed retrieval filter (TopK, MinScore)
RagProgressStage Enum for pipeline stage progress reporting (QueryRewrite, Embedding, Filtering, Retrieval, Reranking, ContextBuild)
VectorRecord Stored vector with ID, content, embedding, and metadata
VectorSearchResult Search result with record and similarity score
VectorFilter Filter by metadata conditions or minimum score

Per-Query Overrides via Clone()

RagPipelineOptions, RagQueryOptions, RagFilter, RagRetrievalDerivation, and RagFinalSelectionOptions all expose a Clone() method. Use Clone() to override a single field on top of RagPipelineOptions.DefaultQuery without losing the other configured fields (notably StoreFilter and ProgressAsync):

var options = pipeline.Options.DefaultQuery.Clone();
options.FinalFilter.TopK = 10;
await pipeline.QueryAsync(query, options);

Constructing new RagQueryOptions { FinalFilter = ... } from scratch silently drops every other field, including any tenant/permission scope on StoreFilter and any progress callback on ProgressAsync. Clone() makes the "inherit defaults, override one field" pattern safe.

Custom Implementation Example

Custom implementations must preserve the association between each document, chunk and vector. A splitter returns non-null chunks with nonblank IDs unique across the target store; include the document ID and chunk index, and copy inherited metadata when access filters depend on it. Indexing rejects blank or duplicate chunk IDs within a document before embedding or persistence and does not invent replacement IDs.

An embedding batch returns exactly one vector per input, in input order, with the provider's positive Dimensions and finite values in every coordinate. RAG indexing validates each batch and copies its vectors before asking for another batch. Provider-owned buffers may therefore be reused by a later sequential call; they must remain stable while the caller is reading the current response. A validation failure preserves that document's previous index when it occurs before persistence. See the indexing validation guide for exception types and storage boundaries.

Single query embeddings follow the same dimension and finite-value contract. Built-in vector, hybrid and legacy retrieval adapters validate and copy a completed query vector before invoking retrieval progress callbacks or the store. This keeps a later sequential call from changing an earlier query through a reused provider buffer. Providers must still keep returned data stable while it is being read or copied; custom IRagRetriever implementations own their preparation and validation. Keyword-only retrieval does not inspect or call the embedding provider. See query embedding validation.

public class MyEmbeddingProvider : IEmbeddingProvider
{
    public int Dimensions => 768;

    public Task<float[]> GetEmbeddingAsync(string text, CancellationToken ct = default)
    {
        // Your embedding logic here
    }

    public Task<IReadOnlyList<float[]>> GetEmbeddingsAsync(
        IEnumerable<string> texts, CancellationToken ct = default)
    {
        // Batch embedding logic here
    }
}

Then register via the builder:

.WithRag(rag => rag.UseEmbedding(new MyEmbeddingProvider()))

Custom retrieval without mandatory embeddings

An external search index should not need a dense query embedding merely to connect to RAG. Implement IRagRetriever and register it with RagBuilder.UseRetriever(...). Preparation belongs to the retriever; the rest of the pipeline can still apply reranking and assemble context. Respect the request filter, top-K and cancellation, and return the content and metadata needed downstream. See the custom retriever guide. Existing IRetrievalStrategy implementations remain supported through an embedding adapter. This changes query retrieval, not the document-ingestion contract.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Mythosia.AI.Rag.Abstractions:

Package Downloads
Mythosia.AI.Rag

Ground AI answers in application-managed documents with loading, splitting, embeddings, vector/text/hybrid retrieval, reranking and metadata filters. Provides standard and Agentic RAG, streaming runs, cancellation and optional PIXIE search. Supports Voyage Context 4, Gemini Embedding 2, OpenAI, Ollama and Perplexity embeddings. Retrieval-aware providers distinguish documents from queries and receive complete ordered document inputs; existing IEmbeddingProvider implementations remain compatible. Validates embedding results before document replacement and isolates query rewriting and reranking. Depends on Mythosia.AI.Abstractions and Mythosia.AI.Rag.Abstractions without referencing the full Mythosia.AI implementation. What's New in v8.3.0: Diagnostics use optional IVectorStoreDiagnostics and InMemory 4.3.0; migrate old InMemory diagnostic interface casts. This minor release intentionally includes a breaking interface migration.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.5.0 133 10/3/2026
6.4.0 153 9/27/2026
6.3.0 211 9/24/2026
6.2.0 793 4/28/2026
6.1.0 1,016 4/4/2026
6.0.0 413 3/30/2026
5.1.0 216 3/29/2026
5.0.0 275 3/22/2026
4.0.1 225 3/15/2026
4.0.0 181 3/15/2026 4.0.0 is deprecated because it has critical bugs.
3.2.0 156 3/11/2026 3.2.0 is deprecated because it has critical bugs.
3.1.0 185 3/7/2026 3.1.0 is deprecated because it has critical bugs.
3.0.0 297 3/6/2026
2.0.0 162 3/5/2026
1.0.0 332 2/25/2026

v6.3.0: Adds IRagRetriever and RagRetrievalRequest for request-based retrieval without mandatory query embeddings. Requests carry full/lexical query text, top-K, filters and optional progress; RetrieveAsync accepts cancellation. Existing IRetrievalStrategy implementations remain supported. Built-in retrievers use the full query for a null lexical override and skip text search for an empty override. Full notes: https://github.com/AJ-comp/Mythosia.AI/blob/main/src/rag/Mythosia.AI.Rag.Abstractions/RELEASE_NOTES.md#v630