Skip to content

Commit f600f3d

Browse files
authored
Merge pull request #784 from iceljc/master
rename
2 parents d758e4b + e1e56b5 commit f600f3d

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

src/Infrastructure/BotSharp.Abstraction/Agents/Models/AgentUtility.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public AgentUtility(
2121
Functions = functions ?? [];
2222
Templates = templates ?? [];
2323
}
24+
25+
public override string ToString()
26+
{
27+
return Name;
28+
}
2429
}
2530

2631

src/Infrastructure/BotSharp.Core/Agents/AgentPlugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void RegisterDI(IServiceCollection services, IConfiguration config)
3131
{
3232
services.AddScoped<ILlmProviderService, LlmProviderService>();
3333
services.AddScoped<IAgentService, AgentService>();
34-
services.AddScoped<IAgentHook, CommonAgentHook>();
34+
services.AddScoped<IAgentHook, BasicAgentHook>();
3535

3636
services.AddScoped(provider =>
3737
{

src/Infrastructure/BotSharp.Core/Agents/Hooks/CommonAgentHook.cs renamed to src/Infrastructure/BotSharp.Core/Agents/Hooks/BasicAgentHook.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
namespace BotSharp.Core.Agents.Hooks;
22

3-
public class CommonAgentHook : AgentHookBase
3+
public class BasicAgentHook : AgentHookBase
44
{
55
public override string SelfId => string.Empty;
66

7-
public CommonAgentHook(IServiceProvider services, AgentSettings settings)
7+
public BasicAgentHook(IServiceProvider services, AgentSettings settings)
88
: base(services, settings)
99
{
1010
}

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using BotSharp.Abstraction.Planning;
33
using BotSharp.Abstraction.Routing.Enums;
44
using BotSharp.Abstraction.Routing.Reasoning;
5-
using BotSharp.Core.Routing.Reasoning;
65

76
namespace BotSharp.Core.Routing;
87

@@ -21,7 +20,7 @@ public async Task<RoleDialogModel> InstructLoop(RoleDialogModel message, List<Ro
2120
var states = _services.GetRequiredService<IConversationStateService>();
2221
var executor = _services.GetRequiredService<IExecutor>();
2322

24-
var planner = GetReasoner(_router);
23+
var reasoner = GetReasoner(_router);
2524

2625
_context.Push(_router.Id);
2726

@@ -46,7 +45,7 @@ public async Task<RoleDialogModel> InstructLoop(RoleDialogModel message, List<Ro
4645

4746
// Get first instruction
4847
_router.TemplateDict["conversation"] = await GetConversationContent(dialogs);
49-
var inst = await planner.GetNextInstruction(_router, message.MessageId, dialogs);
48+
var inst = await reasoner.GetNextInstruction(_router, message.MessageId, dialogs);
5049

5150
int loopCount = 1;
5251
while (true)
@@ -63,30 +62,30 @@ await hook.OnRoutingInstructionReceived(inst, message)
6362
#else
6463
_logger.LogInformation($"*** Next Instruction *** {inst}");
6564
#endif
66-
await planner.AgentExecuting(_router, inst, message, dialogs);
65+
await reasoner.AgentExecuting(_router, inst, message, dialogs);
6766

6867
// Handover to Task Agent
6968
if (inst.HandleDialogsByPlanner)
7069
{
71-
var dialogWithoutContext = planner.BeforeHandleContext(inst, message, dialogs);
70+
var dialogWithoutContext = reasoner.BeforeHandleContext(inst, message, dialogs);
7271
response = await executor.Execute(this, inst, message, dialogWithoutContext);
73-
planner.AfterHandleContext(dialogs, dialogWithoutContext);
72+
reasoner.AfterHandleContext(dialogs, dialogWithoutContext);
7473
}
7574
else
7675
{
7776
response = await executor.Execute(this, inst, message, dialogs);
7877
}
7978

80-
await planner.AgentExecuted(_router, inst, response, dialogs);
79+
await reasoner.AgentExecuted(_router, inst, response, dialogs);
8180

82-
if (loopCount >= planner.MaxLoopCount || _context.IsEmpty)
81+
if (loopCount >= reasoner.MaxLoopCount || _context.IsEmpty)
8382
{
8483
break;
8584
}
8685

8786
// Get next instruction from Planner
8887
_router.TemplateDict["conversation"] = await GetConversationContent(dialogs);
89-
inst = await planner.GetNextInstruction(_router, message.MessageId, dialogs);
88+
inst = await reasoner.GetNextInstruction(_router, message.MessageId, dialogs);
9089
loopCount++;
9190
}
9291

@@ -103,8 +102,7 @@ public IRoutingReasoner GetReasoner(Agent router)
103102
return _services.GetServices<IRoutingReasoner>().First(x => x.Name == "Naive Reasoner");
104103
}
105104

106-
var reasoner = _services.GetServices<IRoutingReasoner>().
107-
FirstOrDefault(x => x.GetType().Name.EndsWith(rule.Field));
105+
var reasoner = _services.GetServices<IRoutingReasoner>().FirstOrDefault(x => x.GetType().Name.EndsWith(rule.Field));
108106

109107
if (reasoner == null)
110108
{

0 commit comments

Comments
 (0)