feat(voyageai): add output_dimension support for embeddings#904
Merged
sixlive merged 1 commit intoFeb 26, 2026
Merged
Conversation
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>
sixlive
force-pushed
the
feature/voyageai-output-dimension
branch
from
February 26, 2026 16:56
ce0c359 to
f6e5bc5
Compare
sixlive
approved these changes
Feb 26, 2026
markritterman
added a commit
to markritterman/ai
that referenced
this pull request
Mar 5, 2026
The PrismGateway maps the dimensions parameter to provider-specific options for Gemini and OpenAI but not for VoyageAI. This causes VoyageAI to return its default 1024-dimension vectors instead of the requested size, leading to dimension mismatches when storing in pgvector columns configured for larger dimensions. Prism already supports `outputDimension` as a provider option for VoyageAI (prism-php/prism#904), so we just need to pass it through. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
taylorotwell
added a commit
to laravel/ai
that referenced
this pull request
Mar 5, 2026
* fix: pass outputDimension for VoyageAI embeddings The PrismGateway maps the dimensions parameter to provider-specific options for Gemini and OpenAI but not for VoyageAI. This causes VoyageAI to return its default 1024-dimension vectors instead of the requested size, leading to dimension mismatches when storing in pgvector columns configured for larger dimensions. Prism already supports `outputDimension` as a provider option for VoyageAI (prism-php/prism#904), so we just need to pass it through. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: verify provider-specific dimension options in PrismGateway Adds unit tests verifying that PrismGateway::generateEmbeddings() passes the correct provider option key for embedding dimensions: - OpenAI: dimensions - Gemini: outputDimensionality - VoyageAI: outputDimension Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Delete tests/Unit/Gateway/Prism/PrismEmbeddingsTest.php --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Taylor Otwell <taylor@laravel.com>
sulimanbenhalim
pushed a commit
to sulimanbenhalim/ai
that referenced
this pull request
Mar 6, 2026
* fix: pass outputDimension for VoyageAI embeddings The PrismGateway maps the dimensions parameter to provider-specific options for Gemini and OpenAI but not for VoyageAI. This causes VoyageAI to return its default 1024-dimension vectors instead of the requested size, leading to dimension mismatches when storing in pgvector columns configured for larger dimensions. Prism already supports `outputDimension` as a provider option for VoyageAI (prism-php/prism#904), so we just need to pass it through. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: verify provider-specific dimension options in PrismGateway Adds unit tests verifying that PrismGateway::generateEmbeddings() passes the correct provider option key for embedding dimensions: - OpenAI: dimensions - Gemini: outputDimensionality - VoyageAI: outputDimension Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Delete tests/Unit/Gateway/Prism/PrismEmbeddingsTest.php --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Taylor Otwell <taylor@laravel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
outputDimensionprovider option support to the VoyageAI embeddings handler, allowing control over the number of dimensions in embedding responses.Voyage AI models like
voyage-4andvoyage-multimodal-3.5support Matryoshka-style dimension truncation via theoutput_dimensionAPI parameter. This was previously not forwarded by the Prism handler.Usage
When
outputDimensionis not set, the parameter is omitted from the request (no change in default behaviour).Tests
output_dimensionis included in the API request whenoutputDimensionprovider option is setoutput_dimensionis omitted from the API request when not set