Skip to content

Commit 87089a0

Browse files
authored
Merge pull request #189 from hchen2020/master
Return states in InstructResult.
2 parents 41a0b35 + 684b35e commit 87089a0

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

src/Infrastructure/BotSharp.Abstraction/Instructs/Models/InstructResult.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ public class InstructResult
44
{
55
public string Text { get; set; }
66
public object Data { get; set; }
7+
public ConversationState States { get; set; }
78
}

src/Infrastructure/BotSharp.Core/Routing/RoutingService.InvokeAgent.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ private async Task<RoleDialogModel> InvokeFunction(Agent agent, RoleDialogModel
6262
response = await InvokeAgent(response.CurrentAgentId);
6363
}
6464
}
65+
else
66+
{
67+
response.Role = AgentRole.Assistant;
68+
}
6569

6670
return response;
6771
}

src/Infrastructure/BotSharp.OpenAPI/Controllers/InstructModeController.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ public async Task<InstructResult> InstructCompletion([FromRoute] string agentId,
4646
}
4747

4848
var instructor = _services.GetRequiredService<IInstructService>();
49-
return await instructor.Execute(agent,
49+
var result = await instructor.Execute(agent,
5050
new RoleDialogModel(AgentRole.User, input.Text));
51+
52+
result.States = state.GetStates();
53+
54+
return result;
5155
}
5256

5357
[HttpPost("/instruct/text-completion")]

src/WebStarter/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/instruction.liquid

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ You're {{router.name}} ({{router.description}}). Follow these steps to handle us
33
2. Select a appropriate function from [FUNCTIONS].
44
3. Determine which agent is suitable to handle this conversation.
55
4. Re-think about the selected function or agent is the best choice.
6+
5. For agent required arguments, leave it blank if user doesn't provide it.
67

78
[FUNCTIONS]
89
{% for handler in routing_handlers %}

0 commit comments

Comments
 (0)