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

pull/586/head
sigoden 4 months ago committed by GitHub
parent b05b730cb5
commit aa94fb2f83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -28,6 +28,9 @@ pub fn eval_tool_calls(
return Ok(output); return Ok(output);
} }
calls = ToolCall::dedup(calls); 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 { for call in calls {
let result = call.eval(config)?; let result = call.eval(config)?;
output.push(ToolCallResult::new(call, result)); output.push(ToolCallResult::new(call, result));

Loading…
Cancel
Save