XiHan.Framework.AI.Conformance
5.0.0-preview.1
Prefix Reserved
This is a prerelease version of XiHan.Framework.AI.Conformance.
There is a newer prerelease version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package XiHan.Framework.AI.Conformance --version 5.0.0-preview.1
NuGet\Install-Package XiHan.Framework.AI.Conformance -Version 5.0.0-preview.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="XiHan.Framework.AI.Conformance" Version="5.0.0-preview.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XiHan.Framework.AI.Conformance" Version="5.0.0-preview.1" />
<PackageReference Include="XiHan.Framework.AI.Conformance" />
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 XiHan.Framework.AI.Conformance --version 5.0.0-preview.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: XiHan.Framework.AI.Conformance, 5.0.0-preview.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 XiHan.Framework.AI.Conformance@5.0.0-preview.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=XiHan.Framework.AI.Conformance&version=5.0.0-preview.1&prerelease
#tool nuget:?package=XiHan.Framework.AI.Conformance&version=5.0.0-preview.1&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
XiHan.Framework.AI.Conformance
AI 一致性套件(工具链,RFC-0022):Provider 继承抽象测试类并实现夹具,通过全部用例。
| 类型 | 用途 |
|---|---|
KnowledgeStoreConformance + KnowledgeStoreHost |
IKnowledgeStore:写入与按相似度排序、top、文档与元数据过滤、同 ID 重写入替换、按文档删除、按块序号裁剪、集合隔离、空集合搜索 |
AIProviderConformance + AIProviderHost |
IAIProviderCatalog 上的聊天与嵌入 Provider:应答、嵌入维度与批量条数、缓存与 Invalidate、未知名字 AI_NOTFOUND_001;默认名——StartAsync 的夹具里被测 Provider 是聊天与嵌入的默认,StartWithoutDefaultAsync 的夹具没有默认(不写名字即 AI_NOTFOUND_001),能把两种默认分开的目录覆写 StartWithSeparateDefaultsAsync(AIProviderHost.EmbeddingProviderName 给出默认嵌入 Provider),不覆写时该例跳过 |
HashingEmbeddingGenerator、HashingEmbeddingGeneratorFactory、HashingEmbeddingFeature |
确定性的词袋哈希嵌入(Kind = hashing)与提供 ai.embedding@1 的特性,让知识库 Provider 的测试不依赖外部模型 |
下面是 AI.VectorData 自己的一致性测试的写法。TestVectorStore 是测试项目里写的进程内 VectorStore 替身(test/XiHan.Framework.AI.VectorData.Tests/TestVectorStore.cs),仓库不引用任何向量库连接器;验证真实连接器时换成它的 VectorStore,并在测试项目里引用连接器的包。
public sealed class VectorDataKnowledgeStoreConformanceTests : KnowledgeStoreConformance
{
protected override async Task<KnowledgeStoreHost> StartAsync()
{
var host = await TestHost.StartAsync(static b => b.UseFeature<HashingEmbeddingFeature>().UseFeature<VectorDataKnowledgeFeature>(),
[new("XiHan:AI:Providers:hash:Kind", "hashing"), new("XiHan:AI:Providers:hash:EmbeddingDimensions", "64"), new("XiHan:AI:Knowledge:Dimensions", "64")],
services => services.AddSingleton<VectorStore>(new TestVectorStore()));
return new KnowledgeStoreHost(host.Services.GetRequiredService<IKnowledgeStore>(), 64, host);
}
}
依赖方向
依赖 XiHan.Framework.AI.Abstractions 与 xUnit v3。被各 Provider 的测试项目引用。
状态
P0:可用(Preview)。
| Product | Versions 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
- Microsoft.Extensions.AI.Abstractions (>= 10.11.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.14)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Diagnostics.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Options (>= 10.0.14)
- System.Threading.RateLimiting (>= 10.0.14)
- XiHan.Framework.AI.Abstractions (>= 5.0.0-preview.1)
- xunit.v3.assert (>= 4.0.2)
- xunit.v3.extensibility.core (>= 4.0.2)
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 |
|---|---|---|
| 5.0.0-preview.2 | 43 | 11/6/2026 |
| 5.0.0-preview.1 | 49 | 11/4/2026 |