Agent Name is contaminated.

This commit is contained in:
C. Oceania 2024-04-10 15:02:19 -05:00 committed by GitHub
parent ed7cabde4f
commit 5564287871
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -165,6 +165,22 @@ public class NaivePlanner : IPlaner
malformed = true;
}
// Agent Name is contaminated.
if (args.Function == "route_to_agent")
{
// Action agent name
if (!agents.Any(x => x.Name == args.AgentName))
{
args.AgentName = agents.FirstOrDefault(x => args.AgentName.Contains(x.Name))?.Name ?? args.AgentName;
}
// Goal agent name
if (!agents.Any(x => x.Name == args.OriginalAgent))
{
args.OriginalAgent = agents.FirstOrDefault(x => args.OriginalAgent.Contains(x.Name))?.Name ?? args.OriginalAgent;
}
}
if (malformed)
{
_logger.LogWarning($"Captured LLM malformed response");