You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
1 week ago | |
|---|---|---|
| .. | ||
| LINGYUN/Abp/AI/Agent | 1 week ago | |
| System/Collections/Generic | 1 week ago | |
| FodyWeavers.xml | 2 months ago | |
| FodyWeavers.xsd | 2 months ago | |
| LINGYUN.Abp.AI.Agent.csproj | 2 months ago | |
| README.md | 2 months ago | |
README.md
LINGYUN.Abp.AI.Agent
Abp AI Module 扩展.
功能特性
模块引用
[DependsOn(typeof(AbpAIAgentModule))]
public class YouProjectModule : AbpModule
{
// other
}
依赖模块
基本用法
兼容
IKernelAccessor与IChatClientAccessor的语法.
using LINGYUN.Abp.AI;
using LINGYUN.Abp.AI.Agent;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.SemanticKernel;
using Volo.Abp;
var application = await AbpApplicationFactory.CreateAsync<YouProjectModule>(options =>
{
options.UseAutofac();
});
await application.InitializeAsync();
var chatClientAgentFactory = application.ServiceProvider.GetRequiredService<IChatClientAgentFactory>();
var agent = await chatClientAgentFactory.CreateAsync<YouWorkspace>();
var agentResponse = agent.RunStreamingAsync("解释一下线性代数");
await foreach (var item in agentResponse)
{
Console.Write(item);
}
Console.WriteLine();
await application.ShutdownAsync();
Console.WriteLine();
Console.WriteLine("AI Console completed!");
Console.ReadKey();
支持动态工作区语法.
using LINGYUN.Abp.AI;
using LINGYUN.Abp.AI.Agent;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.SemanticKernel;
using Volo.Abp;
var application = await AbpApplicationFactory.CreateAsync<YouProjectModule>(options =>
{
options.UseAutofac();
});
await application.InitializeAsync();
var chatClientAgentFactory = application.ServiceProvider.GetRequiredService<IChatClientAgentFactory>();
var agent = await chatClientAgentFactory.CreateAsync("YouWorkspace");
var agentResponse = agent.RunStreamingAsync("解释一下线性代数");
await foreach (var item in agentResponse)
{
Console.Write(item);
}
Console.WriteLine();
await application.ShutdownAsync();
Console.WriteLine();
Console.WriteLine("AI Console completed!");
Console.ReadKey();