XiHan.Framework.AI.Abstractions 5.0.0-preview.2

Prefix Reserved
This is a prerelease version of XiHan.Framework.AI.Abstractions.
dotnet add package XiHan.Framework.AI.Abstractions --version 5.0.0-preview.2
                    
NuGet\Install-Package XiHan.Framework.AI.Abstractions -Version 5.0.0-preview.2
                    
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.Abstractions" Version="5.0.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XiHan.Framework.AI.Abstractions" Version="5.0.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="XiHan.Framework.AI.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 XiHan.Framework.AI.Abstractions --version 5.0.0-preview.2
                    
#r "nuget: XiHan.Framework.AI.Abstractions, 5.0.0-preview.2"
                    
#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.Abstractions@5.0.0-preview.2
                    
#: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.Abstractions&version=5.0.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=XiHan.Framework.AI.Abstractions&version=5.0.0-preview.2&prerelease
                    
Install as a Cake Tool

XiHan.Framework.AI.Abstractions

关于

XiHan.Framework.AI.Abstractions 定义 AI 的统一入口:以 Microsoft.Extensions.AI 的 IChatClient、IEmbeddingGenerator 为基础,提供模型目录、带提示词与护栏的聊天、把操作暴露成模型工具,以及知识库(RAG)流水线。它还自带进程内的工具目录。

主要特性

  • 按名字解析聊天与嵌入模型,默认模型随配置
  • 聊天入口统一处理提示词、护栏、工具与超时
  • Expose.Ai 的操作自动成为模型可调用的工具
  • 知识库摄入、检索与提示增强,存储由提供程序实现

如何使用

安装

dotnet add package XiHan.Framework.AI.Abstractions --prerelease

使用

通常由实现包带入;写业务代码或自定义提供程序时才直接引用。模型由 XiHan.Framework.AI.OpenAI 提供,知识库存储由 XiHan.Framework.AI.VectorData 提供。其他组合里启用工具目录并调用聊天入口:

builder.AddXiHan(xihan => xihan
    .UseStandardProfile()
    .UseFeature<AIToolsFeature>());
var reply = await chat.CompleteAsync(new AIChatRequest
{
    Messages = [new ChatMessage(ChatRole.User, "How many orders are pending?")],
    Prompt = "assistant",
    Tools = ["orders_list"],
}, ct);

主要类型

此库提供的主要类型:

  • IAIChat、AIChatRequest:聊天入口,CompleteAsync / StreamAsync
  • IAIProviderCatalog:按名字解析聊天与嵌入客户端
  • IAIPromptCatalog、AIPromptTemplate:提示词模板
  • IAIGuardrail、KeywordBlocklistGuardrail:输入护栏
  • IAIToolCatalog:工具目录
  • IKnowledgeIngestor、IKnowledgeRetriever、IKnowledgeStore:知识库流水线与存储契约

更多文档

相关包

反馈与贡献

XiHan.Framework.AI.Abstractions 以 MIT 许可证 开源。欢迎到 GitHub 仓库 提交问题和贡献。

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 (5)

Showing the top 5 NuGet packages that depend on XiHan.Framework.AI.Abstractions:

Package Downloads
XiHan.Framework.AI

曦寒框架 AI 扩展库

XiHan.Framework.Profiles.Full

曦寒框架 Full 组合包

XiHan.Framework.AI.Conformance

曦寒框架 AI 一致性测试套件

XiHan.Framework.AI.VectorData

曦寒框架 AI 知识库的向量存储提供程序

XiHan.Framework.AI.OpenAI

曦寒框架 AI 的 OpenAI 兼容提供程序

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.0-preview.2 49 11/6/2026
5.0.0-preview.1 49 11/4/2026
4.8.0 171 10/22/2026
4.7.1 111 10/21/2026
4.7.0 138 10/15/2026
4.6.2 117 10/13/2026
4.6.1 279 10/3/2026
4.6.0 146 9/25/2026
4.5.0 129 9/23/2026
4.4.0 133 9/22/2026
4.3.0 150 9/12/2026
4.2.0 178 9/4/2026
4.1.0 151 8/31/2026
4.0.0 142 8/28/2026
3.14.0 154 8/26/2026
3.13.0 174 8/15/2026
3.12.1 146 8/14/2026
3.12.0 414 8/13/2026
3.11.1 154 8/11/2026
3.11.0 381 8/11/2026
Loading failed