Skip to content

Conversation

natewiebe13
Copy link
Contributor

Q A
Bug fix? no
New feature? yes
Docs? no
License MIT

Added additional options for working with Voyage embeddings. I did also bump the default model used, as the newer one is cheaper and higher quality (ref: https://blog.voyageai.com/2025/05/20/voyage-3-5/)

@carsonbot carsonbot changed the title Voyage embedding update Voyage embedding update Aug 27, 2025
@OskarStark OskarStark added the Platform Issues & PRs about the AI Platform component label Aug 27, 2025
@carsonbot carsonbot changed the title Voyage embedding update [Platform] Voyage embedding update Aug 27, 2025
@OskarStark OskarStark changed the title [Platform] Voyage embedding update [Platform][Voyage] Embedding update Aug 27, 2025
@natewiebe13 natewiebe13 force-pushed the voyage-embedding-update branch 2 times, most recently from e00eb5b to 8dddb8d Compare August 29, 2025 13:05
Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, small change request but close to merge 👍

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for newer Voyage embedding models and additional configuration options. The changes introduce the newer V3.5 model family and CODE_3 model, while updating the default model to the more cost-effective V3_5_LITE.

  • Added support for V3.5 model family (V3_5, V3_5_LITE) and V3_LARGE, CODE_3 models
  • Enhanced model configuration with input_type, truncation, and dimensions options
  • Updated default model from V3 to V3_5_LITE for better cost efficiency

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/platform/src/Bridge/Voyage/Voyage.php Added new model constants, input type constants, enhanced constructor documentation, and changed default model
src/platform/src/Bridge/Voyage/ModelClient.php Added support for new model options (input_type, truncation, output_dimension) in API requests
src/platform/tests/Bridge/Voyage/ResultConverterTest.php Added test coverage for new model constants

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

*/
class Voyage extends Model
{
/** Supported dimensions: 2048, 1024, 512, or 256 */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's useful to have this information here. Could we validate the dimensions option in the constructor and indicate the dimensions supported in case of error?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm usually a bit reluctant to bring in those validations because we don't really own that and don't rely on that ourselves, but it is only with Voyage.

Change scenario could be that they open up or change the support, the lib user want to leverage it, but is limited by our design - and we would need to patch and release to enable them.

We should check tho what happens if the user submits wrong options to the API, and if the error message gets back to the developer - that one of our weak spots still ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@natewiebe13 by any chance, did you check that already?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chr-hertel a \Symfony\AI\Platform\Exception\RuntimeException is thrown with Response does not contain embedding data.

* @param array{dimensions?: int, input_type?: self::INPUT_TYPE_*, truncation?: bool} $options
*/
public function __construct(string $name = self::V3, array $options = [])
public function __construct(string $name = self::V3_5_LITE, array $options = [])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets not change the default version

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it might be best to not specify a default. People are notorious for using the defaults because it's easy. Keeping an outdated, more expensive model as a default likely isn't the best long-term. If not, what would the process be for updating the default? If the hesitation is going to a "lite" version, what about V3_5 as the new default?

@OskarStark OskarStark force-pushed the voyage-embedding-update branch from 3e6c545 to ac27544 Compare September 2, 2025 05:37
@OskarStark
Copy link
Contributor

Thank you, I made some changes while merging.

@OskarStark OskarStark merged commit 5d708ca into symfony:main Sep 2, 2025
7 checks passed
@OskarStark OskarStark mentioned this pull request Sep 2, 2025
OskarStark added a commit that referenced this pull request Sep 2, 2025
This PR was merged into the main branch.

Discussion
----------

[Platform] Fix minor

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| Docs?         | no
| Issues        | Follows #359
| License       | MIT

Commits
-------

d8910a6 [Platform] Fix minor
@natewiebe13
Copy link
Contributor Author

Thank you, I made some changes while merging.

@OskarStark the one thing I'll mention is that the comments regarding dimensions was copied from \Symfony\AI\Platform\Bridge\Gemini\Embeddings. From a consistency standpoint, it might be a good idea to either remove them from that class or come up with a better way of including this info. It is nice to have so that way you don't always have to jump into docs to see what's available.

@OskarStark
Copy link
Contributor

Let's remove them there as well I would say. We are not able to keep track of this, and if they may change the number of dimensions in the future. Is this the raw exception from the API? I think not and there is an open PR/issue to improve error logging from the platforms, so we should tackle this with better logging

@natewiebe13
Copy link
Contributor Author

@OskarStark that's the content from the exception being thrown (vendor/symfony/ai-platform/src/Bridge/Voyage/ResultConverter.php:39).

The raw response json is:

{"detail":"Value '1234' supplied for argument 'output_dimension' is not valid -- accepted values for 'voyage-3.5-lite' are [256, 512, 1024, 2048]."}

@OskarStark
Copy link
Contributor

Thats super helpful, so lets propagate this raw error from the vendor somehow

OskarStark added a commit that referenced this pull request Sep 2, 2025
…ons (OskarStark)

This PR was merged into the main branch.

Discussion
----------

[Platform][Gemini][Embeddings] Remove comments for dimensions

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| Docs?         | no
| Issues        | Follows #359
| License       | MIT

cc `@natewiebe13`

Commits
-------

3d07897 [Platform][Gemini][Embeddings] Remove comments for dimensions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature Platform Issues & PRs about the AI Platform component Status: Needs Review Status: Waiting feedback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants