RAGToolkit.AI.VectorData.Qdrant 1.0.1

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

RAGToolkit.AI.VectorData.Qdrant

Qdrant 的 VectorStore / VectorStoreCollection 实现,在官方 provider 基础上加了稀疏向量。

核心类型

类型 说明
QdrantVectorStore VectorStore 实现
QdrantCollection<TKey, TRecord> VectorStoreCollection + IKeywordHybridSearchable 实现
QdrantDynamicCollection 无模型的 Dictionary<string, object?> 集合
QdrantServiceCollectionExtensions AddQdrantVectorStore / AddQdrantCollection 及其 keyed 变体

选项

类型 关键成员
QdrantVectorStoreOptions EmbeddingGenerator、HasNamedVectors、SparseVectors / SparseVector
QdrantCollectionOptions 同上,另有 SparseVectorProperty
QdrantSparseVectorOptions StorageName(默认 "sparse")、Modifier、Index、EmbeddingGenerator、SourcePropertyName
QdrantSparseIndexOptions FullScanThreshold、OnDisk
QdrantSparseModifier None / Idf

SparseVector 是 SparseVectors 里第一条的快捷方式(getter 取 [0],setter 整个替换)。

稀疏向量选项的解析顺序

按优先级取第一个命中的,后面的不看:

  1. options.SparseVectors(显式列表)
  2. options.SparseVectorProperty
  3. TRecord 上的 [VectorStoreSparseVector] 特性(全扫,可以标多个)

也就是说:显式配置会整个覆盖特性标注,不是合并。

混合检索

HybridSearchAsync(dense, keywords, top) 发一个带两路 Prefetch 的 Qdrant 查询, 用 Fusion.Rrf 在服务端融合:

Query
├─ Prefetch[0]   nearest: 稠密向量          using: "Embedding"
└─ Prefetch[1]   nearest: 稀疏向量 / bm25   using: "sparse"
   fusion: Rrf

keywords 为空、或者根本没配稀疏选项时,只发稠密那一路。

DI 自动挂生成器

AddQdrantVectorStore / AddQdrantCollection 会在选项没显式给生成器时,从容器里捞:

  • IEmbeddingGenerator → EmbeddingGenerator
  • ISparseEmbeddingGenerator<string> → 每个既没 EmbeddingGenerator 又没 SourcePropertyName 的稀疏选项
builder.Services.AddSingleton<ISparseEmbeddingGenerator<string>>(sparseGenerator);

写入时的稀疏构造

UpsertAsync 对每条记录、每个稀疏选项:

  • 有 EmbeddingGenerator → 客户端生成 SparseVector{indices, values};
  • 只有 SourcePropertyName → 把原文当 BM25 文档发过去,服务端索引;
  • 源文本为空 → 这一条跳过该稀疏字段。

依赖

  • RAGToolkit.AI.VectorData.Abstractions
  • Microsoft.Extensions.VectorData.Abstractions
  • Microsoft.Extensions.AI.Abstractions
  • Microsoft.Extensions.DependencyInjection.Abstractions
  • Qdrant.Client

许可证

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.1 46 10/9/2026
1.0.0 38 10/9/2026