Set default LlmConfig for Agent level.
This commit is contained in:
parent
1e89ea0c6a
commit
89af1d72a6
|
|
@ -4,4 +4,10 @@ public class AgentSettings
|
|||
{
|
||||
public string DataDir { get; set; } = string.Empty;
|
||||
public string TemplateFormat { get; set; } = "liquid";
|
||||
|
||||
/// <summary>
|
||||
/// This is the default LLM config for agent
|
||||
/// </summary>
|
||||
public AgentLlmConfig LlmConfig { get; set; }
|
||||
= new AgentLlmConfig();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,11 +19,12 @@ public partial class RoutingService
|
|||
}
|
||||
|
||||
var agentService = _services.GetRequiredService<IAgentService>();
|
||||
var agentSetting = _services.GetRequiredService<AgentSettings>();
|
||||
var agent = await agentService.LoadAgent(agentId);
|
||||
|
||||
var chatCompletion = CompletionProvider.GetChatCompletion(_services,
|
||||
provider: agent?.LlmConfig?.Provider,
|
||||
model: agent.LlmConfig?.Model);
|
||||
provider: agent?.LlmConfig?.Provider ?? agentSetting.LlmConfig.Provider,
|
||||
model: agent.LlmConfig?.Model ?? agentSetting.LlmConfig.Model);
|
||||
|
||||
var message = dialogs.Last();
|
||||
var response = chatCompletion.GetChatCompletions(agent, dialogs);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="StrongGrid" Version="0.102.0" />
|
||||
<PackageReference Include="Twilio.AspNet.Common" Version="8.0.2" />
|
||||
<PackageReference Include="Twilio.AspNet.Core" Version="8.0.2" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using StrongGrid;
|
||||
|
||||
namespace BotSharp.Plugin.Twilio.Controllers;
|
||||
|
||||
[AllowAnonymous]
|
||||
public class TwilioEmailController : ControllerBase
|
||||
{
|
||||
private readonly TwilioSetting _settings;
|
||||
private readonly IServiceProvider _services;
|
||||
|
||||
public TwilioEmailController(TwilioSetting settings, IServiceProvider services)
|
||||
{
|
||||
_settings = settings;
|
||||
_services = services;
|
||||
}
|
||||
|
||||
[HttpPost("/twilio/email")]
|
||||
public async Task<IActionResult> IncomingEmail()
|
||||
{
|
||||
// https://docs.sendgrid.com/api-reference/settings-inbound-parse/create-a-parse-setting
|
||||
var parser = new WebhookParser();
|
||||
var inboundEmail = await parser.ParseInboundEmailWebhookAsync(Request.Body).ConfigureAwait(false);
|
||||
|
||||
// ... do something with the inbound email ...
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
|
||||
public class SendGridWebhook
|
||||
{
|
||||
public string From { get; set; }
|
||||
public string To { get; set; }
|
||||
}
|
||||
|
|
@ -49,7 +49,11 @@
|
|||
"Agent": {
|
||||
"DataDir": "agents",
|
||||
"TemplateFormat": "liquid",
|
||||
"MaxRecursiveDepth": 3
|
||||
"MaxRecursiveDepth": 3,
|
||||
"LlmConfig": {
|
||||
"Provider": "azure-openai",
|
||||
"Model": "one"
|
||||
}
|
||||
},
|
||||
|
||||
"Conversation": {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,6 @@
|
|||
"isPublic": true,
|
||||
"llmConfig": {
|
||||
"provider": "azure-openai",
|
||||
"model": "gpt-35-turbo"
|
||||
"model": "one"
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue