-
-
Notifications
You must be signed in to change notification settings - Fork 54
Description
Description:
The ModelClientInterface defines $payload
as array|string but many implementations use array_merge($payload, $options)
without type checking, causing fatal errors when a string payload is passed.
Affected Files
Multiple ModelClient implementations fail to handle string payloads properly,
Current Behavior
Interface allows: request(Model $model, array|string $payload, array $options = [])
Many implementations call: array_merge($payload, $options)
Result: Fatal error when $payload is string: array_merge(): Expected parameter 1 to be an array, string given
Expected Behavior
All implementations should handle both array and string payloads consistently.
Inconsistent Implementation
Some implementations handle this correctly:
Albert/EmbeddingsModelClient.php:45
Albert/GptModelClient.php:50
Cerebras/ModelClient.php:58
These use: \is_array($payload) ? array_merge($payload, $options) : $payload
Or assigning the payload to ['input => $payload]
before merge
But many others don't perform this check.