22using BotSharp . Abstraction . Planning ;
33using BotSharp . Abstraction . Routing . Enums ;
44using BotSharp . Abstraction . Routing . Reasoning ;
5- using BotSharp . Core . Routing . Reasoning ;
65
76namespace 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