[Platform] Throw InvalidArgumentException when ModelClient receives a string payload

This commit is contained in:
Fabien Potencier
2026-03-01 22:00:22 +01:00
committed by Oskar Stark
parent f6c952af20
commit 062e5061e6

View File

@@ -65,6 +65,10 @@ final class OllamaClient implements ModelClientInterface
*/
private function doCompletionRequest(array|string $payload, array $options = []): RawHttpResult
{
if (\is_string($payload)) {
throw new InvalidArgumentException(\sprintf('Payload must be an array, but a string was given to "%s".', self::class));
}
// Revert Ollama's default streaming behavior
$options['stream'] ??= false;