RAGToolkit.AI.DataRetrieval.Tei 1.0.0

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

RAGToolkit.AI.DataRetrieval.Tei

HuggingFace Text Embeddings Inference 的 reranker 实现(IReranker)。

类型

类型 说明
TextEmbeddingsInferenceReranker 调 TEI /rerank 的 IReranker
RerankRequest 请求体
RerankResponseItem 响应项

用法

using RAGToolkit.AI.DataRetrieval.Tei;

IReranker reranker = new TextEmbeddingsInferenceReranker(
    httpClient,
    requestPath: "/rerank",
    maxDocumentsPerBatch: 32);

pipeline.ResultProcessors.Add(new RerankingResultProcessor(reranker));

构造函数签名:TextEmbeddingsInferenceReranker(HttpClient httpClient, string requestPath = "/rerank", int maxDocumentsPerBatch = 32)。

注意

  • TEI 的 /rerank 一次最多 32 条文档 —— --max-client-batch-size 默认 32,超了服务端直接拒。 本实现按 MaxDocumentsPerBatch 自动分批,只在服务端调大了该参数时才需要跟着调大。
  • RerankRequest 没有 top_n —— 要截断请用 TopNResultProcessor。
  • cross-encoder 分数跨批可比(每对 (query, document) 独立打分),所以分批后合并不需要再做 rank fusion,直接降序排即可。
  • 未被打分的块保持原位置与原分数,不会被丢掉。
  • TEI 只能做 embedding / rerank,不能做文本生成。

依赖

  • RAGToolkit.AI.DataRetrieval.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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 42 10/9/2026