Merge pull request #372 from hchen2020/master

Save function result to Storage
This commit is contained in:
C. Oceania 2024-03-28 14:12:15 -05:00 committed by GitHub
commit 198ceb409b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 4 deletions

View file

@ -12,7 +12,7 @@ public class HumanInterventionNeededHandler : RoutingHandlerBase, IRoutingHandle
{
new ParameterPropertyDef("reason", "why need customer service"),
new ParameterPropertyDef("summary", "the whole conversation summary with important information"),
new ParameterPropertyDef("response", "tell the user that you are being transferred to customer service")
new ParameterPropertyDef("response", "confirm with user that whether to connect with customer service")
};
public HumanInterventionNeededHandler(IServiceProvider services, ILogger<HumanInterventionNeededHandler> logger, RoutingSettings settings)

View file

@ -74,9 +74,11 @@ public partial class RoutingService
else
{
// Save to memory dialogs
dialogs.Add(RoleDialogModel.From(message,
var msg = RoleDialogModel.From(message,
role: AgentRole.Function,
content: message.Content));
content: message.Content);
dialogs.Add(msg);
// Send to Next LLM
var agentId = routing.Context.GetCurrentAgentId();

View file

@ -68,6 +68,10 @@ public partial class RoutingService
message.FunctionName = originalFunctionName;
}
// Save to Storage as well
var storage = _services.GetRequiredService<IConversationStorage>();
storage.Append(Context.ConversationId, message);
return result;
}
}

View file

@ -3,4 +3,5 @@ Route to the last handling agent in priority.
{% if expected_next_action_agent != empty -%}
Expected next action agent is {{ expected_next_action_agent }}.
{%- endif %}
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.
If user wants to or is processing with a specific task that can be handled by agents, respond with appropriate agents.