fix: infinite loop of function calls on poor LLM (#585)

This commit is contained in:
sigoden 2024-06-11 17:52:04 +08:00 committed by GitHub
parent b05b730cb5
commit aa94fb2f83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -28,6 +28,9 @@ pub fn eval_tool_calls(
return Ok(output);
}
calls = ToolCall::dedup(calls);
if calls.is_empty() {
bail!("The request was aborted because an infinite loop of function calls was detected.")
}
for call in calls {
let result = call.eval(config)?;
output.push(ToolCallResult::new(call, result));