fc71d848e2
Define IAgent interface and implement CoreAgent (main conversational agent) and LibrarianAgent (knowledge retrieval agent). Includes DI service collection extensions for agent registration.
32 lines
838 B
C#
32 lines
838 B
C#
using Luna.Agents.Abstractions;
|
|
using Luna.Agents.Core;
|
|
using Luna.Agents.Librarian;
|
|
using Luna.Configuration.Extensions;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace Luna.Agents.Extensions;
|
|
|
|
public static class ServiceCollectionExtensions
|
|
{
|
|
extension(IServiceCollection services)
|
|
{
|
|
public IServiceCollection AddAgents()
|
|
{
|
|
services.AddAgent<CoreAgent>();
|
|
services.AddAgent<LibrarianAgent>();
|
|
|
|
return services;
|
|
}
|
|
|
|
public IServiceCollection AddAgent<TAgent>(string? name = null)
|
|
where TAgent : class, IAgent
|
|
{
|
|
name ??= TAgent.Name;
|
|
|
|
services.AddAgentOptions(name);
|
|
services.AddKeyedTransient<IAgent, TAgent>(name);
|
|
|
|
return services;
|
|
}
|
|
}
|
|
} |