Skip to content

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

Merged
oobabooga merged 10 commits into
oobabooga:devfrom
mamei16:fix_gemma_tool_args
Apr 15, 2026
Merged

oobabooga merged 10 commits into
oobabooga:devfrom
mamei16:fix_gemma_tool_args

Conversation

@mamei16

@mamei16 mamei16 commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

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

mamei16 commented Apr 11, 2026

Copy link
Copy Markdown
Contributor Author

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!

@oobabooga

Copy link
Copy Markdown
Owner

I'm glad you agree, could you make the change so I can merge?

@mamei16

mamei16 commented Apr 13, 2026

Copy link
Copy Markdown
Contributor Author

Of course! I just hesitated because I didn't want to take credit for your idea.

@oobabooga
oobabooga merged commit fbd95bd into oobabooga:dev Apr 15, 2026
@oobabooga

Copy link
Copy Markdown
Owner

Ty :) your fix entirely.

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