Skip to content

Handle Double Quotes and Newline Chars in Gemma-4 Tool Call Arguments#7477

Open
mamei16 wants to merge 9 commits intooobabooga:devfrom
mamei16:fix_gemma_tool_args
Open

Handle Double Quotes and Newline Chars in Gemma-4 Tool Call Arguments#7477
mamei16 wants to merge 9 commits intooobabooga:devfrom
mamei16:fix_gemma_tool_args

Conversation

@mamei16
Copy link
Copy Markdown
Contributor

@mamei16 mamei16 commented Apr 8, 2026

Fixes #7476

Checklist:

@oobabooga
Copy link
Copy Markdown
Owner

This looks correct. I wonder if bare backslashes in values (Windows paths, regex patterns, etc.) could still break things, since the template doesn't escape them either. Would parts[idx] = json.dumps(parts[idx])[1:-1] on the odd parts work as an alternative?

@mamei16
Copy link
Copy Markdown
Contributor Author

mamei16 commented Apr 11, 2026

Yes, that is much simpler and seems to work better as well. I was looking for this specific functionality, but didn't think to dump a string back to a string, thus escaping it. That's nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants