I am having an issue with the Structured Output Parser.
I am getting the following error randomly:
ERROR: Failed to parse. Text: “{“id”: 1, “sentiment”: “neutral”}”. Error: [ { “code”: “invalid_type”, “expected”: “array”, “received”: “object”, “path”: [], “message”: “Expected array, received object” } ]
I belive this should be fixed with the latest version of the ai-beta image. Can you try updating and re-try?
If you’re using n8n Cloud just restarting your instance should do the trick. For self-hosted(Docker) you’d need to pull the latest ai-beta image to get the changes.
@Boris_Idesman This is because model returned null for id. But in your schema you define it as number hence the failed validation. You can either allow null as valid type in your schema(type = ['number', 'null']) or prompt the LM to never return null for id field.
and the error is:
ERROR: Failed to parse. Text: “{”__structured__output":{“__structured__output__object”:{},“__structured__output__array”:[]}}“. Error: Error: Failed to parse. Text: “{”__structured__output”:{“__structured__output__object”:{},“__structured__output__array”:[]}}". Error: [ { “code”: “custom”, “message”: “One and only one of __structured__output__object and __structured__output__array should be present.”, “path”: [ “__structured__output”, “__structured__output” ] } ]