Pryanshu Sharma's picture

Pryanshu Sharma PRO

5m4ck3r

AI & ML interests

None yet

Recent Activity

Organizations

Logic Spine's profile picture

5m4ck3r's activity

view reply

Hi Great Project by the way but i am having a small issue,

I'm using smolagents with a QWEN 32B model (via CodeAgent) and have run into an issue with the generated code. Sometimes, the code produced by the agent includes multiple calls to final_answer, with one appearing in the middle of the script. Because final_answer is designed to signal the end of execution, any code following its first occurrence (for example, calls like task_to_do()) doesn't get executed.

What I've tried:

  • I've attempted to β€œteach” the model to avoid placing final_answer in the middle of the code, but this approach has been unreliable.

My goal is:

  • To have an execution model or workaround in smolagents that ensures the complete code block executes, even if a premature final_answer is generated.

Question:
Is there an agent configuration, workaround, or best practice within smolagents that can allow all code to execute even if final_answer is called early? Any guidance or suggestions would be greatly appreciated.

Thanks in advance!