File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
src/Infrastructure/BotSharp.Core/Routing/Planning Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -165,6 +165,22 @@ private void FixMalformedResponse(FunctionCallFromLlm args)
165
165
malformed = true ;
166
166
}
167
167
168
+ // Agent Name is contaminated.
169
+ if ( args . Function == "route_to_agent" )
170
+ {
171
+ // Action agent name
172
+ if ( ! agents . Any ( x => x . Name == args . AgentName ) )
173
+ {
174
+ args . AgentName = agents . FirstOrDefault ( x => args . AgentName . Contains ( x . Name ) ) ? . Name ?? args . AgentName ;
175
+ }
176
+
177
+ // Goal agent name
178
+ if ( ! agents . Any ( x => x . Name == args . OriginalAgent ) )
179
+ {
180
+ args . OriginalAgent = agents . FirstOrDefault ( x => args . OriginalAgent . Contains ( x . Name ) ) ? . Name ?? args . OriginalAgent ;
181
+ }
182
+ }
183
+
168
184
if ( malformed )
169
185
{
170
186
_logger . LogWarning ( $ "Captured LLM malformed response") ;
You can’t perform that action at this time.
0 commit comments