Bitzsoft.Integrations.SemanticKernel 1.1.0

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

Bitzsoft.Integrations.SemanticKernel

已弃用 / 退场通知:Bitzsoft.Integrations.SemanticKernel 全部公开接口、配置类型与依赖注入扩展已标注 [Obsolete("已由 Bitzsoft.Integrations.AgentFramework 与 Bitzsoft.Integrations.AI 替代,将在后续主版本移除。", false)]。新项目与存量改造请迁移至 Bitzsoft.Integrations.AgentFramework、Bitzsoft.Integrations.AI.Conversation 与 Bitzsoft.Integrations.AI。

Semantic Kernel 插件兼容编排层仅用于尚待改造的历史项目过渡。它不再创建厂商客户端或持有 API Key,而是复用 Microsoft.Extensions.AI.IChatClient。

迁移至现代 Agent 框架对照表

过时 API (Bitzsoft.Integrations.SemanticKernel) 推荐现代替代 (AgentFramework + AI + AI.Conversation)
services.AddBitzSemanticKernel(...) services.AddBitzsoftAIAgent(...) / BitzAgentBuilder / services.AddBitzsoftAgentService()
ISemanticKernelClient.SendMessageAsync IAgentService.ChatInSessionAsync / AIAgent.RunAsync / IChatClient.GetResponseAsync
ISemanticKernelClient.SendMessageStreamAsync IAgentService.SendMessageStreamAsync / IBitzAgentConversationService.ChatInSessionStreamAsync
AddBitzSemanticKernelPlugin<TPlugin>() AIFunctionFactory.Create(...) + GuardedAIFunction / BitzAgentBuilder.WithTools(...)
DateTimePlugin TimeProvider + AIFunctionFactory.Create(...) 受控只读工具
BitzOrcasVNext AgentServiceAdapter Bitzsoft.Integrations.AgentFramework.Interfaces.IAgentService (BitzAgentService)

安装与兼容性

# 新项目推荐:
dotnet add package Bitzsoft.Integrations.AI
dotnet add package Bitzsoft.Integrations.AgentFramework

# 历史过渡期(已标注 Obsolete,将在后续主版本移除):
dotnet add package Bitzsoft.Integrations.SemanticKernel
  • 目标框架:net8.0;net10.0;
  • 全部公开成员与 DI 扩展已标记 [Obsolete(..., false)](编译提示 CS0618,将在后续主版本移除);
  • 不提供 ApiKey、Endpoint、ProviderId 或 ModelId 配置。

迁移最小示例

完整最小示例

以下示例展示脱离 SemanticKernel 兼容层后,直接使用统一 Microsoft.Extensions.AI.IChatClient 与 AIFunctionFactory 完成租户隔离工具调用的最小迁移方式(无 CS0618 过时警告;如需完整会话持久化、技能目录、HITL 审批与循环编排,请进一步接入 Bitzsoft.Integrations.AgentFramework):

using System.ComponentModel;
using Bitzsoft.Integrations.AI;
using Bitzsoft.Integrations.Core;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();

// 仅开发/测试:生产环境应注册对接 Vault、KMS 或云密钥服务的解析器。
services.AddInMemoryIntegrationCredentials();

// 直接注册租户感知 IChatClient,无需 SemanticKernel 包装层。
services.AddBitzChatClient(options =>
{
    options.ProviderId = "deepseek-dev";
    options.ProfileId = "deepseek";
    options.ModelId = "deepseek-flash";
});

await using var provider = services.BuildServiceProvider(
    new ServiceProviderOptions { ValidateScopes = true });

// 写入 tenant-a 的开发密钥;using 确保调用方持有的密钥快照被清理。
var credentialStore = provider.GetRequiredService<
    InMemoryIntegrationCredentialStore>();
using (var credential = new IntegrationCredential(
[
    new(AICredentialFieldNames.ApiKey, "<从 User Secrets 读取的开发密钥>")
]))
{
    credentialStore.Set(
        new IntegrationCredentialKey(
            tenantId: "tenant-a",
            providerKey: "AI:deepseek-dev",
            environment: IntegrationEnvironments.Development),
        credential);
}

// 每个业务请求建立自己的 Scope 和 IntegrationContext。
await using var scope = provider.CreateAsyncScope();
var contextAccessor = scope.ServiceProvider
    .GetRequiredService<IIntegrationContextAccessor>();
using var contextScope = contextAccessor.Push(
    new IntegrationContext(
        tenantId: "tenant-a",
        region: "cn-east",
        environment: IntegrationEnvironments.Development));

var chatClient = scope.ServiceProvider.GetRequiredService<IChatClient>();
var timeTool = AIFunctionFactory.Create(
    ([Description("IANA 或系统时区")] string? _) =>
        TimeProvider.System.GetUtcNow().ToString("O"),
    name: "get_utc_now",
    description: "获取当前 UTC 时间");

var chatOptions = new ChatOptions
{
    Instructions = "只回答当前租户已授权的业务问题。",
    Tools = [timeTool],
};

Console.WriteLine($"Ready for tenant {contextAccessor.Current?.TenantId}: {chatClient.GetType().Name} with {chatOptions.Tools.Count} tool(s).");

历史兼容层行为说明(退场参考)

存量代码在完成迁移前如需暂留兼容层,请知悉以下既有约束将在移除前保持不变:

  1. Scope 与插件隔离:旧版 AddBitzSemanticKernel(name, ...) 通过命名 Key 解析 IChatClient,并通过 AddBitzSemanticKernelPlugin<TPlugin> 将包含 [KernelFunction] 的插件绑定到对应命名管道,不自动扫描程序集。
  2. 工具调用护栏:SemanticKernelOptions 默认限制 MaximumFunctionInvocationIterations = 5 与 MaximumConsecutiveFunctionErrors = 1,不提供模型厂商密钥字段。
  3. 退场计划:所有公开类型 ISemanticKernelClient、SemanticKernelOptions、DateTimePlugin 与 SemanticKernelServiceCollectionExtensions 均已标注 CS0618 过时警告,后续主版本将正式移除本包及 Microsoft.SemanticKernel 传递依赖。
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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 (1)

Showing the top 1 NuGet packages that depend on Bitzsoft.Integrations.SemanticKernel:

Package Downloads
Bitzsoft.Integrations.All

Bitzsoft 第三方集成聚合包 — net5.0 包含传统连接器,net8.0+ 额外包含受上游 TFM 限制的 AI 模块

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 0 11/14/2026
1.0.4 193 9/23/2026
1.0.2 166 8/29/2026
1.0.1 182 8/3/2026
1.0.0 165 8/2/2026
1.0.0-alpha.10 97 7/26/2026
1.0.0-alpha.9 103 7/12/2026
1.0.0-alpha.8 346 7/1/2026
1.0.0-alpha.7 109 6/16/2026
1.0.0-alpha.6 103 6/16/2026
1.0.0-alpha.5 94 6/14/2026
1.0.0-alpha.3 102 6/7/2026
1.0.0-alpha.2 93 5/29/2026
1.0.0-alpha.1 93 5/28/2026