Skip to content

Conversation

@markritterman
Copy link
Contributor

Description

Adds outputDimension provider option support to the VoyageAI embeddings handler, allowing control over the number of dimensions in embedding responses.

Voyage AI models like voyage-4 and voyage-multimodal-3.5 support Matryoshka-style dimension truncation via the output_dimension API parameter. This was previously not forwarded by the Prism handler.

Usage

Prism::embeddings()
    ->using(Provider::VoyageAI, 'voyage-4')
    ->fromInput('some text')
    ->withProviderOptions(['outputDimension' => 2048])
    ->asEmbeddings();

When outputDimension is not set, the parameter is omitted from the request (no change in default behaviour).

Tests

  • Verifies output_dimension is included in the API request when outputDimension provider option is set
  • Verifies output_dimension is omitted from the API request when not set
  • All existing VoyageAI embeddings tests continue to pass

Allow controlling the number of dimensions in Voyage AI embedding
responses via the outputDimension provider option. This is useful
for models like voyage-4 and voyage-multimodal-3.5 that support
Matryoshka-style dimension truncation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant