Text classifier fails with an error (copied from the n8n template lib)

Describe the problem/error/question

I try to classify text and get an error like (ollama, locally):

Failed to parse. Text: "```markdown {"type":"object","properties":{"Request Quote":{"type":"boolean"},"Product info":{"type":"boolean"},"General problem":{"type":"boolean"},"Order":{"type":"boolean"},"fallback":{"type":"boolean"},"$schema":"http://json-schema.org/draft-07/schema#"},"additionalProperties":false} ``` No". Error: SyntaxError: Unexpected token '`', "```markdow"... is not valid JSON Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/OUTPUT_PARSING_FAILURE/ 

Please share your workflow

Basically, I just tried this one: Modular & Customizable AI-Powered Email Routing: Text Classifier for eCommerce | n8n workflow template

Information on your n8n setup

  • n8n version: 1.72.1
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker (the ai starter kit)
  • Operating system: Ubuntu 24.04

Hey @Chris7935 could you specify which llama model you are running? Would be helpful for reproducing

I think your best bet is to try something else than Llama as they seem to not work very well with structured output (which is required for this task)

See some examples here - All via openrouter, but some of these are definitely available on ollama and also depends on your hardware. I tried to use small models for local performace.

1 Like

I’ve been using Ollama 3.2 locally on a 3yr old laptop with amd-gpu.
For some things, it seems to be working ok.

Now, I’ve tried gemma 2-9 and it’s working directly. Will try and see whether my laptop can handle Ollama 8b and if not, go with the online versions.
I’d like to have it running offline, but I recognize my hardware limitations as well. :frowning:

1 Like

Also, you can try in ollama

You could set up some evals on classification of the incoming data and pick the one that gives you the best output.

If this helped, consider marking it as the solution :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.