fix(groq): handle Llama models embedding arguments in function name#987
Open
obalaweb wants to merge 1 commit intoprism-php:mainfrom
Open
fix(groq): handle Llama models embedding arguments in function name#987obalaweb wants to merge 1 commit intoprism-php:mainfrom
obalaweb wants to merge 1 commit intoprism-php:mainfrom
Conversation
Llama models running on Groq (e.g. llama-3.3-70b-versatile) occasionally
return tool calls where the entire argument payload is concatenated into
the function.name field:
"function": { "name": "get_transactions,{\"from_date\":\"2026-03-06\"}", "arguments": "" }
Prism passes this mangled string as the ToolCall name. On the follow-up
turn Groq validates the assistant message's tool_calls against the
original request.tools list and rejects the request because
"get_transactions,{...}" was never registered as a tool:
Groq Error [400]: tool call validation failed: attempted to call tool
'get_transactions,{"from_date":"..."}' which was not in request.tools
Fix: in mapToolCalls(), detect the "name,{...}" pattern, validate the
suffix is valid JSON, and split into a clean name + arguments string.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #983
Llama models running on Groq (e.g. llama-3.3-70b-versatile) occasionally return tool calls where the entire argument payload is concatenated into the function.name field:
"function": { "name": "get_transactions,{"from_date":"2026-03-06"}", "arguments": "" }
Prism passes this mangled string as the ToolCall name. On the follow-up turn Groq validates the assistant message's tool_calls against the original request.tools list and rejects the request because "get_transactions,{...}" was never registered as a tool:
Groq Error [400]: tool call validation failed: attempted to call tool
'get_transactions,{"from_date":"..."}' which was not in request.tools
Fix: in mapToolCalls(), detect the "name,{...}" pattern, validate the suffix is valid JSON, and split into a clean name + arguments string.