Class MistralAiBatchChatModel
- All Implemented Interfaces:
BatchChatModel
BatchChatModel for the Mistral
Batch API, which processes multiple chat
requests asynchronously at 50% of the standard per-token price.
Requests are submitted inline: each ChatRequest is mapped to a request identical to the one
MistralAiChatModel would send, so per-request parameters (temperature, tools, response format, etc.)
behave the same in a batch as in a single call. The returned BatchResponse carries the batch id and
its current BatchState; results are fetched by retrieve(String) once the job has produced
them, preserving submission order.
All requests in a batch run against the single model configured on this batch model
(via MistralAiBatchChatModel.Builder.modelName(String)), matching the Mistral constraint of one model per job.
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuilder()voidCancels a chat batch operation that is currently pending or running.list(@Nullable BatchPagination pagination) Lists chat batch jobs with optional pagination.Retrieves the current state and results of a chat batch operation.submit(BatchRequest<ChatRequest> request) Creates a batch of chat requests and submits them for asynchronous processing.
-
Constructor Details
-
MistralAiBatchChatModel
-
-
Method Details
-
submit
Description copied from interface:BatchChatModelCreates a batch of chat requests and submits them for asynchronous processing.The returned
BatchResponserepresents the status of the batch operation.- Specified by:
submitin interfaceBatchChatModel- Parameters:
request- the list of chat requests to process in the batch- Returns:
- a
BatchResponserepresenting the initial state of the batch operation
-
retrieve
Description copied from interface:BatchChatModelRetrieves the current state and results of a chat batch operation.The response indicates whether the batch is still processing, completed successfully, or failed. Clients should poll this method at intervals until the batch completes.
- Specified by:
retrievein interfaceBatchChatModel- Parameters:
batchId- the batch identifier obtained fromBatchChatModel.submit(BatchRequest)- Returns:
- a
BatchResponserepresenting the current state of the chat batch operation
-
cancel
Description copied from interface:BatchChatModelCancels a chat batch operation that is currently pending or running.- Specified by:
cancelin interfaceBatchChatModel- Parameters:
batchId- the batch identifier to cancel
-
list
Lists chat batch jobs with optional pagination.The Mistral Batch API paginates by zero-based page index. When more pages remain, the returned
BatchPage.nextPageToken()is the next page index (as a string) to pass back viaBatchPagination.pageToken().- Specified by:
listin interfaceBatchChatModel- 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 chat batch responses and pagination information
-
builder
-