Skip to content

Commit

Permalink
Render assistant role as specific agent name.
Browse files Browse the repository at this point in the history
  • Loading branch information
Oceania2018 committed Oct 26, 2023
1 parent 9356cb6 commit d7ef99d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,24 @@ public async Task<FunctionCallFromLlm> GetNextInstruction()
model: _settings.Model);

int retryCount = 0;
var agentService = _services.GetRequiredService<IAgentService>();

while (retryCount < 3)
{
try
{
var conversation = "";

foreach (var dialog in _dialogs.TakeLast(20))
{
conversation += $"{dialog.Role}: {dialog.Content}\r\n";
var role = dialog.Role;
if (role != AgentRole.User)
{
var agent = await agentService.GetAgent(dialog.CurrentAgentId);
role = agent.Name;
}

conversation += $"{role}: {dialog.Content}\r\n";
}
content = $"{conversation}\r\n###\r\n{content}";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ You're {{router.name}} ({{router.description}}). Follow these steps to handle us
2. Select a appropriate function from [FUNCTIONS].
3. Determine which agent is suitable to handle this conversation.
4. Re-think about the selected function or agent is the best choice.
5. For agent required arguments, leave it blank if user doesn't provide it.
5. For agent required arguments, leave it as blank object if user doesn't provide it.

[FUNCTIONS]
{% for handler in routing_handlers %}
Expand Down

0 comments on commit d7ef99d

Please sign in to comment.