https://discord.gg/botpress logo
Problem with AI response
# 🤝help
m
I’m using AI Task to generate very short user messages, and since today I’ve run into an issue. When the conversation flow reaches that node, instead of returning the generated text, it sends me tags with the AI’s internal reasoning process. I’ve attached screenshots of the prompt. What should I do to fix this? https://cdn.discordapp.com/attachments/1422163491820933140/1422163492168798350/Screenshot_2025-09-29_120722.png?ex=68dbac77&is=68da5af7&hm=e5327346b3c8bbd001c1bacfac1f1de103eafcaee4b4513bf7a075bc8c58fd5f& https://cdn.discordapp.com/attachments/1422163491820933140/1422163492575776808/Screenshot_2025-09-29_120921.png?ex=68dbac77&is=68da5af7&hm=0f69ff0eccc4974f73107e4fbae28ad1194988e26f144200306b89d394fcf0ce&
I also noticed that this only occurs inside Ai Task, few days ago i reported problem with Gemini 2.5 Flash not working, however it is also not working for AI Task only. I'm using it in Autonomous Node and it works perfectly fine.
w
this seems like a problem on botpress's end, that happens when you ask the model to include thinking
but maybe AI generate text works?
l
Good morning @miniature-daybreak-20569 🙂 Which LLM are you using? I just tested it out on my end using an AI Generate Text card too and no tags! https://cdn.discordapp.com/attachments/1422163491820933140/1422221885399236730/image.png?ex=68dbe2d9&is=68da9159&hm=3a02ab82e56589a8ca7e14e8bb0f13dc1d656b1338fa660f7e4c9509bb7f59ad&
m
can you try on webchat? It was deepseek R1 and claude 3.5 Haiku.
i see the think tags are indeed generating! @miniature-daybreak-20569 will ask the team and get back, not sure if this is an issue on the LLM side or our side.
note claude 3.5haiku did not give think tags
Found the solution @miniature-daybreak-20569
Provide "Before Outgoing" Hook with the following code:
`` function cleanMarkdown(markdownString) { // Remove fenced code blocks but keep the content let cleaned = markdownString.replace(/```[a-zA-Z]*\n?([\s\S]*?)```/g, '$1') // Remove indented code blocks but keep the content (remove 4 spaces or 1 tab from start of line) cleaned = cleaned.replace(/^( |\t)(.*)$/gm, '$2') // Remove inline code blocks but keep the content cleaned = cleaned.replace(/`([^`\n]*)`/g, '$1') // Remove HTML tags but keep their content cleaned = cleaned.replace(/]*>/g, '') // Normalize nested blockquotes to single level // This handles cases like "> > > text" or "> > text" and converts to "> text" cleaned = cleaned.replace(/^(>\s*)+/gm, '> ') // Clean up excessive whitespace that may result from removals cleaned = cleaned.replace(/\n\s*\n\s*\n/g, '\n\n') // Replace multiple empty lines with double newline cleaned = cleaned.trim() // Remove leading/trailing whitespace return cleaned } // The type of the event payload is extracted const { type } = outgoingEvent.payload // Log the payload if a 'custom' type of payload is used for future references if (type == 'custom') { console.warn('Custom event sent', outgoingEvent.payload) } if (outgoingEvent.preview) { outgoingEvent.preview = cleanMarkdown(outgoingEvent.preview) } if (outgoingEvent.payload.text) { outgoingEvent.payload.text = cleanMarkdown(outgoingEvent.payload.text) } ``
The tags should be removed 🙂
m
Okay thansk for resonse, i will certainly do this, i would also like to know is there known issue with Gemini 2.5? I can't use it for couple of days...
w
yes, gemini is having a lot of problems with overload and huge latency unfortunately
3 Views