Converting the Final chat output to Json for it to be stored

I am creating a chatbox that should collect and store bday and anniversity dates and remind the customers through email.

Describe the problem/error/question

Problem in node ‘Intake Agent‘

Model output doesn’t fit required format

What is the error message (if any)?

Please share your workflow


Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
1 Like

Hi @Malieka_Forbes I see the issue, instead of using a normal output parser that AI can sometimes produce errors in, just use a auto fixing output parser:

2 Likes

Hi Welcome! the structured output parser is known to be pretty unreliable when attached directly to an agent node because the agent is still chatting back and forth and cant always produce clean JSON mid-conversation. What id recommend is removing the output parser from the Intake Agent and instead adding a separate Basic LLM Chain node after it that takes the final conversation output and extracts the dates into your JSON format, works way more consistently.

2 Likes

Thank you, I use the auto-fixing parser. Now I’m running into another problem, where the ai agent is replying to the user in JSON format.

2 Likes

@Malieka_Forbes Understood, that is more of a System Prompt problem and also in your output format you can enter the values and AI would see them as instructions.

1 Like

ok thank you

2 Likes

let me know if that works @Malieka_Forbes

2 Likes

Thank you, this worked along with the autofixing output parser..