-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid JSON response when using Claude due to unescaped quotes #2128
Comments
Hey @rpvitruvix! I’d love to help you out with this. I tried running the example from our cookbook myself
and everything worked fine on my end. Could you let me know if there’s something specific you’re trying out? I’m happy to troubleshoot with you and get this sorted! |
Thank you for your response. I apologize for not being specific enough in my initial report. Let me clarify: The issue occurs intermittently when using structured output - not always. Specifically, when Claude includes quotes (") within string values in the JSON response, these quotes sometimes appear unescaped, which breaks JSON parsing. For example: {
"surrounding_text": "...this power of attorney would be a "Springing Power of Attorney" in that..."
} Note the unescaped quotes around "Springing Power of Attorney" - this causes JSON parsing errors. The correct JSON format should escape these internal quotes like this: {
"surrounding_text": "...this power of attorney would be a \"Springing Power of Attorney\" in that..."
} I want to emphasize that this is not a consistent issue - it happens intermittently. I'm raising this here to see if it's a known issue and if there might be a way to prevent it through prompting. |
Thanks @rpvitruvix, we'll look into it! |
When using Claude with structured output, I'm getting JSON parsing errors due to unescaped quotes in string values. I know this might be an Anthropic issue, but wanted to check if there's anything we can do on the Agno side?
Example error:
The issue happens in responses like this:
Any suggestions on how to handle this?
The text was updated successfully, but these errors were encountered: