Skip to content

[BUG] None check is not there for FinalOutput.output #1443

@bacharSalleh

Description

@bacharSalleh

Describe the bug
Missing None check for el.output when validating final answer. The code checks isinstance(el, FinalOutput) but doesn't verify that el.output is not None before attempting to validate the final answer, which can cause False finalizing.

Expected behavior
The code should check if el.output is not None before attempting to use it:

 if self.final_answer_checks and el.output is not None:
    self._validate_final_answer(final_answer)

Existing Code

if self.final_answer_checks:

One more thing
I think yield ing FinalOutput when output is None (which happens when is_final_answer is False) is somehow not correct in terms of typing.

Packages version:

smolagents==1.18.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions