Skip to content

Commit 5d708ca

Browse files
committed
feature #359 [Platform][Voyage] Embedding update (natewiebe13)
This PR was squashed before being merged into the main branch. Discussion ---------- [Platform][Voyage] Embedding update | 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/) Commits ------- ac27544 keep default and remove info about dimensions of the model ac26687 [Platform][Voyage] Embedding update
2 parents b72429a + ac27544 commit 5d708ca

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/platform/src/Bridge/Voyage/ModelClient.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ public function request(Model $model, object|string|array $payload, array $optio
3939
'json' => [
4040
'model' => $model->getName(),
4141
'input' => $payload,
42+
'input_type' => $options['input_type'] ?? null,
43+
'truncation' => $options['truncation'] ?? true,
44+
'output_dimension' => $options['dimensions'] ?? null,
4245
],
4346
]));
4447
}

src/platform/src/Bridge/Voyage/Voyage.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,24 @@
1919
*/
2020
class Voyage extends Model
2121
{
22+
public const V3_5 = 'voyage-3.5';
23+
public const V3_5_LITE = 'voyage-3.5-lite';
2224
public const V3 = 'voyage-3';
2325
public const V3_LITE = 'voyage-3-lite';
26+
public const V3_LARGE = 'voyage-3-large';
2427
public const FINANCE_2 = 'voyage-finance-2';
2528
public const MULTILINGUAL_2 = 'voyage-multilingual-2';
2629
public const LAW_2 = 'voyage-law-2';
30+
public const CODE_3 = 'voyage-code-3';
2731
public const CODE_2 = 'voyage-code-2';
2832

33+
public const INPUT_TYPE_DOCUMENT = 'document';
34+
public const INPUT_TYPE_QUERY = 'query';
35+
2936
/**
30-
* @param array<string, mixed> $options
37+
* @param array{dimensions?: int, input_type?: self::INPUT_TYPE_*, truncation?: bool} $options
3138
*/
32-
public function __construct(string $name = self::V3, array $options = [])
39+
public function __construct(string $name = self::V3_5, array $options = [])
3340
{
3441
parent::__construct($name, [Capability::INPUT_MULTIPLE], $options);
3542
}

src/platform/tests/Bridge/Voyage/ResultConverterTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,15 @@ public function testItSupportsVoyageModel(string $modelName)
104104

105105
public static function voyageModelsProvider(): iterable
106106
{
107+
yield 'V3_5' => [Voyage::V3_5];
108+
yield 'V3_5_LITE' => [Voyage::V3_5_LITE];
107109
yield 'V3' => [Voyage::V3];
108110
yield 'V3_LITE' => [Voyage::V3_LITE];
111+
yield 'V3_LARGE' => [Voyage::V3_LARGE];
109112
yield 'FINANCE_2' => [Voyage::FINANCE_2];
110113
yield 'MULTILINGUAL_2' => [Voyage::MULTILINGUAL_2];
111114
yield 'LAW_2' => [Voyage::LAW_2];
115+
yield 'CODE_3' => [Voyage::CODE_3];
112116
yield 'CODE_2' => [Voyage::CODE_2];
113117
}
114118
}

0 commit comments

Comments
 (0)