Merge pull request #189 from hchen2020/master

Return states in InstructResult.
This commit is contained in:
Haiping 2023-10-24 20:07:56 -05:00 committed by GitHub
commit 87089a0af5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 1 deletions

View file

@ -4,4 +4,5 @@ public class InstructResult
{
public string Text { get; set; }
public object Data { get; set; }
public ConversationState States { get; set; }
}

View file

@ -62,6 +62,10 @@ public partial class RoutingService
response = await InvokeAgent(response.CurrentAgentId);
}
}
else
{
response.Role = AgentRole.Assistant;
}
return response;
}

View file

@ -46,8 +46,12 @@ public class InstructModeController : ControllerBase, IApiAdapter
}
var instructor = _services.GetRequiredService<IInstructService>();
return await instructor.Execute(agent,
var result = await instructor.Execute(agent,
new RoleDialogModel(AgentRole.User, input.Text));
result.States = state.GetStates();
return result;
}
[HttpPost("/instruct/text-completion")]

View file

@ -3,6 +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.
[FUNCTIONS]
{% for handler in routing_handlers %}