https://discord.gg/botpress logo
JSON AI Task Output Issue
# šŸ¤help
e
Hey, I'm experiencing a strange issue with the AI Tasks in my bot. For some reason a ton of the tasks are outputting JSON even though I'm explicitly telling the model to not. Here's a example of the outputs I'm getting: { "valueType": "dynamic", "dynamicValue": "" } It seems to wrap its response every time in this format. I've tried switching ai models currently using the default chat gpt 4o Mini, but switching models doesn't seem to help. For some I'm able to resolve it by creating a new AI task. The strange thing is this happens to some of my tasks but not others. I did notice though when I give it any sort of examples it always outputs its responses as a JSON. Any help with this would be greatly appreciated!! Luca
p
Have you tried clearing you cache? Can you also show your current workflow? If removing the examples solves the problem, is it a viable solution for all of the ai tasks with which you are having issues?
h
Hi Leanne and Luca, I“m having exactly the same issue! It started happening suddenly in the last few days and it's affecting all my bots. Leanne, when you refer to clearing the cache, which cache are you referring to? Thanks for your help.
In my case, the issue depends on the language model. With Gemini, it returns the JSON, while with GPT it doesn't (which is the expected behavior). I'm using version 1.0 of AI Task
I’m experiencing intermittent issues with different models, where the problem occurs randomly. To summarize what’s happening: There is a variable defined at the workflow level as a string. An AI Task Card is asked to perform an action and store the result in that variable. The variable randomly receives either a correct string from the AI Task, or sometimes a JSON with a dynamic value. The execute code that runs afterward fails because the value is not a string. This is something new that didn’t happen before…
p
Does the JSON contain the string you need? If @hallowed-branch-68168 I would suggest you modify the execute code card to have the two possible paths to the variable as a safeguard while we diagnose the issue further.
h
Yes, absolutely Leanne. The desired value is in the JSON inside the dynamicValue. The problem is that, since it doesn’t return a string, it complicates how the variable is handled in future uses. But I’ll make some adjustments until you’re able to find a solution. Best regards.
3 Views