Package org.springframework.ai.embedding
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 Summary
-
Method Details
-
batch
EmbeddingModel implementations can call this method to optimize embedding tokens. The incoming collection ofDocuments are split into sub-batches. It is important to preserve the order of the list ofDocuments 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.
-