Skip to content

Commit f5eff18

Browse files
committed
fix(voyageai): use nested inputs and drop unsupported chunk_size for contextualized embeddings
The pinned voyageai SDK (>=0.3.6,<0.4.0) contextualized_embed expects inputs as List[List[str]] and does not accept a chunk_size argument. Restore the working voyage-context-3 call pattern for voyage-context-4.
1 parent ccbfbb0 commit f5eff18

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

  • llama-index-integrations/embeddings/llama-index-embeddings-voyageai/llama_index/embeddings/voyageai

llama-index-integrations/embeddings/llama-index-embeddings-voyageai/llama_index/embeddings/voyageai/base.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,12 +392,11 @@ def _embed(self, texts: List[str], input_type: str) -> List[List[float]]:
392392
for batch, _ in self._build_batches(texts):
393393
if self.model_name in CONTEXT_MODELS:
394394
r = self._client.contextualized_embed(
395-
inputs=batch,
395+
inputs=[batch],
396396
model=self.model_name,
397397
input_type=input_type,
398398
output_dtype=self.output_dtype,
399399
output_dimension=self.output_dimension,
400-
chunk_size=32000,
401400
).results
402401
embeddings.extend(r[0].embeddings)
403402
elif self.model_name in MULTIMODAL_MODELS:
@@ -428,12 +427,11 @@ async def _aembed(self, texts: List[str], input_type: str) -> List[List[float]]:
428427
for batch, _ in self._build_batches(texts):
429428
if self.model_name in CONTEXT_MODELS:
430429
ar = await self._aclient.contextualized_embed(
431-
inputs=batch,
430+
inputs=[batch],
432431
model=self.model_name,
433432
input_type=input_type,
434433
output_dtype=self.output_dtype,
435434
output_dimension=self.output_dimension,
436-
chunk_size=32000,
437435
)
438436
r = ar.results
439437
embeddings.extend(r[0].embeddings)

0 commit comments

Comments
 (0)