Interface BatchingStrategy

All Known Implementing Classes:
TokenCountBatchingStrategy

public interface BatchingStrategy
Contract for batching Document objects so that the call to embed them could be optimized.
Since:
1.0.0
Author:
Soby Chacko
  • Method Details

    • batch

      List<List<Document>> batch(List<Document> documents)
      EmbeddingModel implementations can call this method to optimize embedding tokens. The incoming collection of Documents are split into sub-batches. It is important to preserve the order of the list of Documents when batching as they are mapped to their corresponding embeddings by their order.
      Parameters:
      documents - to batch
      Returns:
      a list of sub-batches that contain Documents.