Skip to content

[Platform] Declare INPUT_MULTIPLE capability for OpenAI embedding models #2127

@MolloKhan

Description

@MolloKhan
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
      }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingPlatformIssues & PRs about the AI Platform componentStatus: Needs Review

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions