M5_UGL_1_R - Plan execution - Extracted Answer shows: None

Hello, the extracted answer output shows NONE. I have checked all all variables. The generated Python code creates the right answer. Does anyone have the same effect?

Thanks in advance!

Martin

Can you try printing the “result” instead of “result[“answer”]“ and check whether the agent is working correctly? if not could you share what the “result“ prints?

I had the same problem. The issue seems to come from the fact that the agent generates wrong python code:

cond = (
    (S.quantity_in_stock > 0) &
    (S.price < price_limit) &
    (S.description.test(lambda desc: shape_keyword in desc.lower(), desc))
)

This line is not correct:

(S.description.test(lambda desc: shape_keyword in desc.lower(), desc))

In order to fix it, I modified the agent prompt, and added an instruction:

Constraints:
- Use TinyDB Query for filt...
- Keep code clear an...

# THIS IS THE NEW INSTRUCTION
- Make sure the Query syntax is correct, especially when invoking description.test

With that, the code generated is different:

# Filter by style in description
if style_keyword:
    cond = Q.description.test(lambda desc, sk=style_keyword: sk in desc.lower())

And works as expected:

Plan Execution · Extracted Answer

Yes, we have our Classic round sunglasses in stock for $60.

Cheers

1 Like

@lesly.zerna can you verify this finding?

Thanks! I have rerun several times. Now it works.

Regards, Martin

2 Likes

Thanks for reporting and thanks @TMosh for the support!

We’ll also double check with the team!