commit
fcaf72a0a5
|
|
@ -0,0 +1,7 @@
|
|||
namespace BotSharp.Abstraction.Infrastructures.Enums;
|
||||
|
||||
public class StateConst
|
||||
{
|
||||
public const string EXPECTED_ACTION_AGENT = "expected_next_action_agent";
|
||||
public const string EXPECTED_GOAL_AGENT = "expected_user_goal_agent";
|
||||
}
|
||||
|
|
@ -18,6 +18,7 @@ public class RoutingRule
|
|||
/// <summary>
|
||||
/// Field type: string, number, object
|
||||
/// </summary>
|
||||
[JsonPropertyName("field_type")]
|
||||
public string FieldType { get; set; } = "string";
|
||||
|
||||
public bool Required { get; set; }
|
||||
|
|
|
|||
|
|
@ -9,4 +9,8 @@ global using BotSharp.Abstraction.Agents.Models;
|
|||
global using BotSharp.Abstraction.Utilities;
|
||||
global using BotSharp.Abstraction.Conversations.Models;
|
||||
global using BotSharp.Abstraction.Agents.Enums;
|
||||
global using BotSharp.Abstraction.Infrastructures.Enums;
|
||||
global using BotSharp.Abstraction.Models;
|
||||
global using BotSharp.Abstraction.Routing.Models;
|
||||
global using BotSharp.Abstraction.Routing.Planning;
|
||||
global using BotSharp.Abstraction.Templating;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
using Amazon.Runtime.Internal.Transform;
|
||||
using BotSharp.Abstraction.Agents.Models;
|
||||
using BotSharp.Abstraction.Functions.Models;
|
||||
using BotSharp.Abstraction.Repositories.Filters;
|
||||
using BotSharp.Abstraction.Infrastructures.Enums;
|
||||
using BotSharp.Abstraction.Routing.Models;
|
||||
using BotSharp.Abstraction.Routing.Planning;
|
||||
using BotSharp.Abstraction.Templating;
|
||||
|
|
@ -116,7 +113,8 @@ public class NaivePlanner : IPlaner
|
|||
var render = _services.GetRequiredService<ITemplateRender>();
|
||||
return render.Render(template, new Dictionary<string, object>
|
||||
{
|
||||
{ "expected_next_action_agent", states.GetState("expected_next_action_agent")}
|
||||
{ StateConst.EXPECTED_ACTION_AGENT, states.GetState(StateConst.EXPECTED_ACTION_AGENT) },
|
||||
{ StateConst.EXPECTED_GOAL_AGENT, states.GetState(StateConst.EXPECTED_GOAL_AGENT) }
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,18 +4,18 @@ You're {{router.name}} ({{router.description}}). Follow these steps to handle us
|
|||
3. Determine which agent is suitable to handle this conversation.
|
||||
4. Re-think on whether the function you chose matches the reason.
|
||||
5. For agent required arguments, think carefully, leave it as blank object if user doesn't provide specific arguments.
|
||||
6. Please do not make up any parameters when there is no exact information available, leave it blank.
|
||||
6. Please do not make up any parameters when there is no exact value provided, you must set the parameter value as null.
|
||||
7. Response must be in JSON format.
|
||||
|
||||
{% if routing_requirements and routing_requirements != empty %}
|
||||
[REQUIREMENTS]
|
||||
{% for requirement in routing_requirements %}
|
||||
# {{ requirement }}
|
||||
{% endfor %}
|
||||
{% for requirement in routing_requirements -%}
|
||||
# {{ requirement }}{{ "\r\n" }}
|
||||
{%- endfor %}
|
||||
{% endif %}
|
||||
|
||||
[FUNCTIONS]
|
||||
{% for handler in routing_handlers %}
|
||||
{% for handler in routing_handlers -%}
|
||||
# {{ handler.description}}
|
||||
{% if handler.parameters and handler.parameters != empty -%}
|
||||
Parameters:
|
||||
|
|
@ -24,25 +24,29 @@ Parameters:
|
|||
- {{ p.name }} {% if p.required -%}(required){%- endif %}: {{ p.description }}{{ "\r\n " }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{% endfor %}
|
||||
{{ "\r\n" }}
|
||||
{%- endfor %}
|
||||
|
||||
[AGENTS]
|
||||
{% for agent in routing_agents %}
|
||||
{% for agent in routing_agents -%}
|
||||
* Agent: {{ agent.name }}
|
||||
{{ agent.description}}
|
||||
{% if agent.required_fields and agent.required_fields != empty -%}
|
||||
{%- if agent.required_fields and agent.required_fields != empty -%}
|
||||
{{ "\r\n" }}
|
||||
Required args:
|
||||
{% for f in agent.required_fields -%}
|
||||
- {{ f.name }} (type: {{ f.type }}): {{ f.description }}{{ "\r\n " }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{% if agent.optional_fields and agent.optional_fields != empty -%}
|
||||
{%- endif -%}
|
||||
{{ "\r\n" }}
|
||||
{%- if agent.optional_fields and agent.optional_fields != empty -%}
|
||||
Optional args:
|
||||
{% for f in agent.optional_fields -%}
|
||||
- {{ f.name }} (type: {{ f.type }}): {{ f.description }}{{ "\r\n " }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{% endfor %}
|
||||
{%- endif -%}
|
||||
{{ "\r\n" }}
|
||||
{%- endfor %}
|
||||
|
||||
[CONVERSATION]
|
||||
{{ conversation }}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
What is the next step based on the CONVERSATION?
|
||||
Route to the last handling agent in priority.
|
||||
{% if expected_next_action_agent != empty -%}
|
||||
|
||||
{%- if expected_next_action_agent != empty -%}
|
||||
Expected next action agent is {{ expected_next_action_agent }}.
|
||||
{%- endif %}
|
||||
{%- endif -%}
|
||||
{%- if expected_user_goal_agent != empty -%}
|
||||
Expected user goal agent is {{ expected_user_goal_agent }}.
|
||||
{%- endif -%}
|
||||
|
||||
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 in appropriate output format defined to let proper agent to handle the task.
|
||||
Loading…
Reference in a new issue