diff --git a/src/platform/src/Bridge/OpenAi/Embeddings/ResultConverter.php b/src/platform/src/Bridge/OpenAi/Embeddings/ResultConverter.php index 4ad7912f..cae4321f 100644 --- a/src/platform/src/Bridge/OpenAi/Embeddings/ResultConverter.php +++ b/src/platform/src/Bridge/OpenAi/Embeddings/ResultConverter.php @@ -14,6 +14,7 @@ use Symfony\AI\Platform\Bridge\OpenAi\Embeddings; use Symfony\AI\Platform\Exception\RuntimeException; use Symfony\AI\Platform\Model; +use Symfony\AI\Platform\Result\RawHttpResult; use Symfony\AI\Platform\Result\RawResultInterface; use Symfony\AI\Platform\Result\VectorResult; use Symfony\AI\Platform\ResultConverterInterface; @@ -34,6 +35,10 @@ public function convert(RawResultInterface $result, array $options = []): Vector $data = $result->getData(); if (!isset($data['data'])) { + if ($result instanceof RawHttpResult) { + throw new RuntimeException(\sprintf('Response from OpenAI API does not contain "data" key. StatusCode: "%s". Response: "%s".', $result->getObject()->getStatusCode(), json_encode($result->getData(), \JSON_THROW_ON_ERROR))); + } + throw new RuntimeException('Response does not contain data.'); }