Interface BatchEmbeddingModel
- All Known Implementing Classes:
GoogleAiGeminiBatchEmbeddingModel
Used for processing multiple embedding requests asynchronously in a batch.
Batch processing typically offers significant cost reductions compared to real-time requests and is ideal for large-scale, non-urgent tasks.
Each successful result is a Response wrapping the computed Embedding. The
Response carries the per-embedding TokenUsage when the
provider reports it, and null otherwise.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidCancels an embedding batch operation that is currently pending or running.list(@Nullable BatchPagination pagination) Lists embedding batch jobs with optional pagination.Retrieves the current state and results of an embedding batch operation.submit(BatchRequest<TextSegment> request) Creates a batch of text segments and submits them for asynchronous embedding processing.
-
Method Details
-
submit
Creates a batch of text segments and submits them for asynchronous embedding processing.The returned
BatchResponserepresents the status of the batch operation.- Parameters:
request- the list of text segments to embed in the batch- Returns:
- a
BatchResponserepresenting the initial state of the batch operation
-
retrieve
Retrieves the current state and results of an embedding batch operation.The response indicates whether the batch is still processing, completed successfully, or failed. Use this to retrieve the computed embeddings once the state is success.
- Parameters:
batchId- the batch identifier obtained fromsubmit(BatchRequest)- Returns:
- a
BatchResponserepresenting the current state of the embedding batch operation
-
cancel
Cancels an embedding batch operation that is currently pending or running.- Parameters:
batchId- the batch identifier to cancel
-
list
Lists embedding batch jobs with optional pagination.- Parameters:
pagination- the maximum number of batch jobs to return and token for retrieving a specific page; if null, uses server default- Returns:
- a
BatchPagecontaining embedding batch responses and pagination information
-