| Q |
A |
| Bug fix? |
yes |
| New feature? |
no |
| Docs? |
no |
| Issues |
- |
| License |
MIT |
OpenAI's /v1/embeddings endpoint natively accepts an array input and returns a parallel array of embeddings in a single response (OpenAI API reference). The Embeddings\ModelClient already forwards array payloads correctly:
// src/platform/src/Bridge/OpenAi/Embeddings/ModelClient.php
'json' => array_merge($options, [
'model' => $model->getName(),
'input' => $payload,
]),
However, the OpenAI ModelCatalog does not declare Capability::INPUT_MULTIPLE for any embedding model. As a result, Symfony\AI\Store\Document\Vectorizer::vectorizeStrings() falls through to the sequential branch and issues one HTTP request per input, even when the caller passes an array:
// src/store/src/Document/Vectorizer.php
if ($this->platform->getModelCatalog()->getModel($this->model)->supports(Capability::INPUT_MULTIPLE)) {
// single batched call — never reached for OpenAI embeddings today
} else {
foreach ($stringValues as $string) {
$results[] = $this->platform->invoke($this->model, $string, $options); // N sequential calls
}
}
OpenAI's
/v1/embeddingsendpoint natively accepts an arrayinputand returns a parallel array of embeddings in a single response (OpenAI API reference). TheEmbeddings\ModelClientalready forwards array payloads correctly:However, the OpenAI
ModelCatalogdoes not declareCapability::INPUT_MULTIPLEfor any embedding model. As a result,Symfony\AI\Store\Document\Vectorizer::vectorizeStrings()falls through to the sequential branch and issues one HTTP request per input, even when the caller passes an array: