Add required flag.

This commit is contained in:
Haiping Chen 2024-02-27 21:15:21 -06:00
parent f2c3123b26
commit a0bf65698f
3 changed files with 14 additions and 4 deletions

View file

@ -14,9 +14,18 @@ public class RouteToAgentRoutingHandler : RoutingHandlerBase, IRoutingHandler
public List<ParameterPropertyDef> Parameters => new List<ParameterPropertyDef> public List<ParameterPropertyDef> Parameters => new List<ParameterPropertyDef>
{ {
new ParameterPropertyDef("reason", "why route to agent"), new ParameterPropertyDef("reason", "why route to agent")
new ParameterPropertyDef("next_action_agent", "agent for next action based on user latest response"), {
new ParameterPropertyDef("user_goal_agent", "agent who can achieve user original goal"), Required = true
},
new ParameterPropertyDef("next_action_agent", "agent for next action based on user latest response")
{
Required = true
},
new ParameterPropertyDef("user_goal_agent", "agent who can achieve user original goal")
{
Required = true
},
new ParameterPropertyDef("args", "useful parameters of next action agent, format: { }") new ParameterPropertyDef("args", "useful parameters of next action agent, format: { }")
{ {
Type = "object" Type = "object"

View file

@ -12,6 +12,7 @@ public partial class RoutingService
var originalFunctionName = message.FunctionName; var originalFunctionName = message.FunctionName;
message.FunctionName = name; message.FunctionName = name;
message.Role = AgentRole.Function; message.Role = AgentRole.Function;
message.FunctionArgs = message.FunctionArgs;
var result = await function.Execute(message); var result = await function.Execute(message);
// restore original function name // restore original function name

View file

@ -13,7 +13,7 @@ You're {{router.name}} ({{router.description}}). Follow these steps to handle us
Parameters: Parameters:
- function: {{ handler.name }} - function: {{ handler.name }}
{% for p in handler.parameters -%} {% for p in handler.parameters -%}
- {{ p.name }}: {{ p.description }}{{ "\r\n " }} - {{ p.name }} {% if p.required -%}(required){%- endif %}: {{ p.description }}{{ "\r\n " }}
{%- endfor %} {%- endfor %}
{%- endif %} {%- endif %}
{% endfor %} {% endfor %}