RAGToolkit.AI.DataRetrieval.Abstractions 1.2.0

dotnet add package RAGToolkit.AI.DataRetrieval.Abstractions --version 1.2.0
                    
NuGet\Install-Package RAGToolkit.AI.DataRetrieval.Abstractions -Version 1.2.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="RAGToolkit.AI.DataRetrieval.Abstractions" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RAGToolkit.AI.DataRetrieval.Abstractions" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="RAGToolkit.AI.DataRetrieval.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 RAGToolkit.AI.DataRetrieval.Abstractions --version 1.2.0
                    
#r "nuget: RAGToolkit.AI.DataRetrieval.Abstractions, 1.2.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 RAGToolkit.AI.DataRetrieval.Abstractions@1.2.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=RAGToolkit.AI.DataRetrieval.Abstractions&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=RAGToolkit.AI.DataRetrieval.Abstractions&version=1.2.0
                    
Install as a Cake Tool

RAGToolkit.AI.DataRetrieval.Abstractions

检索管线的契约与数据模型。只定义形状,不含任何实现。

类型

类型 说明
IRetriever 检索入口:RetrieveAsync(query, topK, …)
RetrievalQuery 查询:Text + Variants(多路召回时每条变体各检索一次)
RetrievalChunk 命中块基类:Content、Score、补充元数据字典 Record
RetrievalChunk<TRecord> 强类型命中块:额外携带源记录 Record(TRecord),无字典键、无强转
RetrievalResults 结果集:Chunks(IList<RetrievalChunk>)+ Metadata
RetrievalProviderOptions 传给 provider 的覆写:EmbeddingQueryText、CandidateCount(每分支取数深度,默认 20)
RetrievalQueryProcessor 检索前的处理器契约
RetrievalResultProcessor 检索后的处理器契约
IReranker cross-encoder 重排契约
ParentChildMetadata 父子块关系,供上下文扩展使用

设计约定

  • 算法类不持有领域约定 —— 需要领域知识的地方一律靠委托注入。 判据:换个领域(法律 / 医疗 / 电商),这个类还能不能用。
  • 元数据键的存在性不依赖数据形状 —— 分支只决定"做什么",元数据统一在分支之后写一次。
  • 强类型与形状无关分两层 —— 知道记录形状的调用方用 RetrievalChunk<TRecord> 直接读 Record; 不知道形状的处理器(ParentContextResultProcessor 等)走基类 RetrievalChunk 的补充字典按名读。 两层是同一个块实例,RetrievalChunk<TRecord> 只是多了一个强类型视图。
  • 结果集不泛型 —— IList<T> 是不变的,泛型的 Chunks 视图只能是一份会过期的副本 (结果处理器会替换/过滤列表),所以结果集保持非泛型;知道形状的调用方用 chunks.Cast<RetrievalChunk<TRecord>>() 收回强类型。

依赖

  • .NET 10
  • Microsoft.Extensions.VectorData.Abstractions

许可证

MIT —— 见 LICENSE。

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on RAGToolkit.AI.DataRetrieval.Abstractions:

Package Downloads
RAGToolkit.AI.DataRetrieval

Retrieval pipeline utilities for RAG.

RAGToolkit.AI.DataRetrieval.Cohere

Cohere Rerank API provider for RAGToolkit.AI.DataRetrieval.

RAGToolkit.AI.DataRetrieval.Tei

Text Embeddings Inference provider for RAGToolkit.AI.DataRetrieval.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 42 10/12/2026
1.1.0 52 10/11/2026
1.0.0 53 10/9/2026

1.2.0: RetrievalChunk<TRecord> — a strongly typed chunk whose Record is the source record (TRecord) instead of an untyped dictionary, so callers read chunk.Record.Id rather than chunk.Record["Id"]. It derives from the unchanged non-generic RetrievalChunk, which keeps the supplementary dictionary the record-agnostic processors read by key. RetrievalResults stays non-generic: IList<T> is invariant, so a typed Chunks view could only be a stale copy — cast the chunks with chunks.Cast<RetrievalChunk<TRecord>>() instead.