commit
b7a210efec
|
|
@ -31,7 +31,7 @@ public interface IRoutingService
|
||||||
List<RoutingHandlerDef> GetHandlers(Agent router);
|
List<RoutingHandlerDef> GetHandlers(Agent router);
|
||||||
void ResetRecursiveCounter();
|
void ResetRecursiveCounter();
|
||||||
Task<bool> InvokeAgent(string agentId, List<RoleDialogModel> dialogs);
|
Task<bool> InvokeAgent(string agentId, List<RoleDialogModel> dialogs);
|
||||||
Task<bool> InvokeFunction(string name, RoleDialogModel message, bool restoreOriginalFunctionName = true);
|
Task<bool> InvokeFunction(string name, RoleDialogModel message);
|
||||||
Task<RoleDialogModel> InstructLoop(RoleDialogModel message);
|
Task<RoleDialogModel> InstructLoop(RoleDialogModel message);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Amazon.Runtime.Internal.Transform;
|
||||||
using BotSharp.Abstraction.Agents.Models;
|
using BotSharp.Abstraction.Agents.Models;
|
||||||
using BotSharp.Abstraction.Functions.Models;
|
using BotSharp.Abstraction.Functions.Models;
|
||||||
using BotSharp.Abstraction.Repositories.Filters;
|
using BotSharp.Abstraction.Repositories.Filters;
|
||||||
|
|
@ -111,9 +112,11 @@ public class NaivePlanner : IPlaner
|
||||||
{
|
{
|
||||||
var template = router.Templates.First(x => x.Name == "planner_prompt.naive").Content;
|
var template = router.Templates.First(x => x.Name == "planner_prompt.naive").Content;
|
||||||
|
|
||||||
|
var states = _services.GetRequiredService<IConversationStateService>();
|
||||||
var render = _services.GetRequiredService<ITemplateRender>();
|
var render = _services.GetRequiredService<ITemplateRender>();
|
||||||
return render.Render(template, new Dictionary<string, object>
|
return render.Render(template, new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
|
{ "next_action_agent", states.GetState("next_action_agent")}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ namespace BotSharp.Core.Routing;
|
||||||
|
|
||||||
public partial class RoutingService
|
public partial class RoutingService
|
||||||
{
|
{
|
||||||
public async Task<bool> InvokeFunction(string name, RoleDialogModel message, bool restoreOriginalFunctionName = true)
|
public async Task<bool> InvokeFunction(string name, RoleDialogModel message)
|
||||||
{
|
{
|
||||||
var function = _services.GetServices<IFunctionCallback>().FirstOrDefault(x => x.Name == name);
|
var function = _services.GetServices<IFunctionCallback>().FirstOrDefault(x => x.Name == name);
|
||||||
if (function == null)
|
if (function == null)
|
||||||
|
|
@ -57,8 +57,7 @@ public partial class RoutingService
|
||||||
|
|
||||||
// restore original function name
|
// restore original function name
|
||||||
if (!message.StopCompletion &&
|
if (!message.StopCompletion &&
|
||||||
message.FunctionName != originalFunctionName &&
|
message.FunctionName != originalFunctionName)
|
||||||
restoreOriginalFunctionName)
|
|
||||||
{
|
{
|
||||||
message.FunctionName = originalFunctionName;
|
message.FunctionName = originalFunctionName;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
What is the next step based on the CONVERSATION?
|
What is the next step based on the CONVERSATION?
|
||||||
Route to the Agent that last handled the conversation if necessary.
|
If user is replying with agent's question, you must route back to the previous agent {{ next_action_agent }}.
|
||||||
If user wants to speak to customer service, use function human_intervention_needed.
|
If user wants to speak to customer service, use function human_intervention_needed.
|
||||||
Loading…
Reference in a new issue