We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f070637 commit 59e228eCopy full SHA for 59e228e
agent.py
@@ -22,8 +22,8 @@
22
Content,
23
Candidate,
24
FunctionResponse,
25
+ FinishReason,
26
)
-import base64
27
import time
28
from rich.console import Console
29
from rich.table import Table
@@ -262,6 +262,15 @@ def run_one_iteration(self) -> Literal["COMPLETE", "CONTINUE"]:
262
263
reasoning = self.get_text(candidate)
264
function_calls = self.extract_function_calls(candidate)
265
+
266
+ # Retry the request in case of malformed FCs.
267
+ if (
268
+ not function_calls
269
+ and not reasoning
270
+ and candidate.finish_reason == FinishReason.MALFORMED_FUNCTION_CALL
271
+ ):
272
+ return "CONTINUE"
273
274
if not function_calls:
275
print(f"Agent Loop Complete: {reasoning}")
276
self.final_reasoning = reasoning
0 commit comments