Mythosia.AI.Rag.Abstractions
6.5.0
dotnet add package Mythosia.AI.Rag.Abstractions --version 6.5.0
NuGet\Install-Package Mythosia.AI.Rag.Abstractions -Version 6.5.0
<PackageReference Include="Mythosia.AI.Rag.Abstractions" Version="6.5.0" />
<PackageVersion Include="Mythosia.AI.Rag.Abstractions" Version="6.5.0" />
<PackageReference Include="Mythosia.AI.Rag.Abstractions" />
paket add Mythosia.AI.Rag.Abstractions --version 6.5.0
#r "nuget: Mythosia.AI.Rag.Abstractions, 6.5.0"
#:package Mythosia.AI.Rag.Abstractions@6.5.0
#addin nuget:?package=Mythosia.AI.Rag.Abstractions&version=6.5.0
#tool nuget:?package=Mythosia.AI.Rag.Abstractions&version=6.5.0
Mythosia.AI.Rag.Abstractions
v6.5.0: Retains
IRagDiagnosticsStoreas an obsolete compatibility bridge toMythosia.VectorDb.IVectorStoreDiagnosticsin VectorDb Abstractions 4.2.0. Existing custom diagnostic stores can use the bridge; new stores should implement the vector-layer contract. 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) |
IRetrievalEmbeddingProvider |
Optional IEmbeddingProvider capability: complete ordered document embeddings and explicit query embeddings |
IVectorStore |
Vector storage & search (UpsertAsync, SearchAsync, DeleteAsync) |
IVectorStoreDiagnostics |
Optional vector-layer inspection contract (ListAllRecordsAsync, ScoredListAsync), defined in Mythosia.VectorDb.Abstractions |
IRagDiagnosticsStore |
Obsolete compatibility interface inheriting IVectorStoreDiagnostics |
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 |
Diagnostics compatibility
Store inspection belongs to Mythosia.VectorDb.IVectorStoreDiagnostics. RAG analysis belongs to Mythosia.AI.Rag: RagDiagnostics and RagDiagnosticSession use the optional vector-layer capability for chunk lookup, all-record scoring and health checks. Implementing IVectorStore alone does not require diagnostics.
The obsolete IRagDiagnosticsStore keeps its original namespace, assembly and two method declarations (ListAllRecordsAsync, ScoredListAsync), inherits IVectorStoreDiagnostics, and supplies default interface bridges to those legacy methods. This supports existing custom implementations, including explicit implementations of the old members, when used with the updated contracts. New custom stores should implement IVectorStoreDiagnostics directly and can omit a RAG abstractions reference if they otherwise use only vector contracts.
A public class method takes precedence over a default interface bridge. If a legacy store also exposes public methods with those names, a direct call through IVectorStoreDiagnostics can select the public methods. RAG 8.3.0 uses an internal adapter that calls the original IRagDiagnosticsStore slots, preserving explicit legacy behavior in chunk lookup, scoring and health checks.
The bridge does not make InMemory 4.3.0 implement the old interface. Migrate old InMemory assignments, casts and is/as checks to IVectorStoreDiagnostics, then rebuild affected consumers. Upgrade RAG to 8.3.0 together with InMemory 4.3.0; older RAG packages paired with the new InMemory package are unsupported. This is not a guarantee that every previously compiled consumer remains compatible.
Models
| Model | Description |
|---|---|
EmbeddingDocument |
Immutable DocumentId, nullable Title, and a read-only snapshot of ordered Chunks |
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
If a provider needs neighbouring chunks or retrieval-specific input formatting, implement IRetrievalEmbeddingProvider in addition to its inherited generic methods. The pipeline supplies a complete document regardless of EmbeddingBatchSize, then calls the query method for dense retrieval and diagnostics. Existing providers keep their flat batches and generic query calls.
IRetrievalEmbeddingProvider embeddings = retrievalEmbeddingProvider;
var document = new EmbeddingDocument("policy", new[]
{
"Returns are accepted within fourteen days.",
"Keep the original receipt."
}, title: "Refund policy");
IReadOnlyList<float[]> chunks = await embeddings.GetDocumentEmbeddingsAsync(
document, cancellationToken);
float[] query = await embeddings.GetQueryEmbeddingAsync(
"What is the refund period?", cancellationToken);
Return one finite vector of exactly Dimensions per original chunk in order. Do not mutate the document or returned vectors while the caller copies them. Contextual providers must preserve the complete group; independent providers may manage HTTP batches or bounded concurrency internally. RAG captures the title from RagDocument.Metadata["title"], copies validated results, and preserves source text when a provider adds retrieval formatting to HTTP input. Invalid responses or cancellation before persistence preserve the previous document; store or callback behavior determines atomicity after persistence starts. Reindex when the model, dimensions or retrieval formatting changes. See the provider contract and built-in implementations.
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 | Versions 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. |
-
.NETStandard 2.1
- Mythosia.VectorDb.Abstractions (>= 4.2.0)
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 | 131 | 10/3/2026 | |
| 6.4.0 | 150 | 9/27/2026 | |
| 6.3.0 | 210 | 9/24/2026 | |
| 6.2.0 | 787 | 4/28/2026 | |
| 6.1.0 | 1,016 | 4/4/2026 | |
| 6.0.0 | 413 | 3/30/2026 | |
| 5.1.0 | 214 | 3/29/2026 | |
| 5.0.0 | 275 | 3/22/2026 | |
| 4.0.1 | 225 | 3/15/2026 | |
| 4.0.0 | 181 | 3/15/2026 | |
| 3.2.0 | 156 | 3/11/2026 | |
| 3.1.0 | 184 | 3/7/2026 | |
| 3.0.0 | 295 | 3/6/2026 | |
| 2.0.0 | 162 | 3/5/2026 | |
| 1.0.0 | 332 | 2/25/2026 |
v6.5.0: Retains IRagDiagnosticsStore in its original assembly and namespace as an obsolete compatibility interface inheriting IVectorStoreDiagnostics, with original members and default bridges. Public methods take precedence over default bridges; RAG 8.3.0 preserves explicit legacy dispatch through an adapter. Requires VectorDb.Abstractions 4.2.0. Full notes: https://github.com/AJ-comp/Mythosia.AI/blob/main/src/rag/Mythosia.AI.Rag.Abstractions/RELEASE_NOTES.md#v650