Bug Report
Summary
Llama models on Groq consistently serialize all tool call argument values
as JSON strings regardless of the declared parameter type. Groq validates
the model output against the schema Prism sends and rejects it with a 400
before the response reaches the caller.
Steps to Reproduce
- Configure Prism with Groq + llama-3.3-70b-versatile
- Register a tool with boolean or number parameters
- Ask a question that triggers that tool call
- Groq rejects with 400 before Prism receives the response
Error
Groq Error [400]: invalid_request_error - tool call validation failed:
parameters for tool get_transactions did not match schema: errors: [
/is_cash_in: expected boolean, but got string,
/limit: expected number, but got string,
/min_amount: expected number, but got string
]
Root Cause
The Llama model serializes true as "true" and 10 as "10". Since
ToolMap sends strict type: "boolean" / type: "number" schemas, Groq's
server-side validation rejects the mismatch. This makes boolean and number
parameters completely unusable with Llama models on Groq.
Expected Behaviour
Tool calls with boolean/number parameters should succeed with Llama models
on Groq.
Suggested Fix
In Providers/Groq/Maps/ToolMap.php, wrap non-string scalar types in
anyOf so Groq accepts both the declared type and a string representation:
if (in_array($type, ['boolean', 'number', 'integer'], true)) {
$prop['anyOf'] = [['type' => $type], ['type' => 'string']];
unset($prop['type']);
}
anyOf is standard JSON Schema and is fully supported by Groq's API.
The caller handles coercing string values to the correct PHP type before
invoking the tool handler.
Environment
- Provider: Groq
- Model: llama-3.3-70b-versatile
- Prism: v0.99.22
Bug Report
Summary
Llama models on Groq consistently serialize all tool call argument values
as JSON strings regardless of the declared parameter type. Groq validates
the model output against the schema Prism sends and rejects it with a 400
before the response reaches the caller.
Steps to Reproduce
Error
Groq Error [400]: invalid_request_error - tool call validation failed:
parameters for tool get_transactions did not match schema: errors: [
/is_cash_in: expected boolean, but got string,/limit: expected number, but got string,/min_amount: expected number, but got string]
Root Cause
The Llama model serializes true as "true" and 10 as "10". Since
ToolMap sends strict type: "boolean" / type: "number" schemas, Groq's
server-side validation rejects the mismatch. This makes boolean and number
parameters completely unusable with Llama models on Groq.
Expected Behaviour
Tool calls with boolean/number parameters should succeed with Llama models
on Groq.
Suggested Fix
In Providers/Groq/Maps/ToolMap.php, wrap non-string scalar types in
anyOf so Groq accepts both the declared type and a string representation:
if (in_array($type, ['boolean', 'number', 'integer'], true)) {
$prop['anyOf'] = [['type' => $type], ['type' => 'string']];
unset($prop['type']);
}
anyOf is standard JSON Schema and is fully supported by Groq's API.
The caller handles coercing string values to the correct PHP type before
invoking the tool handler.
Environment