Skip to content

Commit

Permalink
fix(llamaindex): avoid batching in embeddings
Browse files Browse the repository at this point in the history
  • Loading branch information
David Kristek authored and David Kristek committed Apr 26, 2024
1 parent f1786d9 commit a869bd4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/genai/extensions/llama_index/embeddings.py
@@ -1,6 +1,8 @@
import asyncio
from typing import Optional

from pydantic import Field

from genai._types import ModelLike
from genai.client import Client
from genai.schema import TextEmbeddingParameters
Expand All @@ -17,6 +19,9 @@ class IBMGenAILlamaIndexEmbedding(BaseEmbedding):
model_id: str
parameters: Optional[ModelLike[TextEmbeddingParameters]] = None
execution_options: Optional[ModelLike[CreateExecutionOptions]] = None
# Batch size is set to 100000 to avoid batching in
# LlamaIndex as it is handled by the SDK itself
embed_batch_size: int = Field(default=10000, description="The batch size for embedding calls.", gt=0)

@classmethod
def class_name(cls) -> str:
Expand Down

0 comments on commit a869bd4

Please sign in to comment.