Class GoogleGenAiBatchChatModel

java.lang.Object
dev.langchain4j.model.google.genai.GoogleGenAiBatchChatModel
All Implemented Interfaces:
BatchChatModel

@Experimental public final class GoogleGenAiBatchChatModel extends Object implements BatchChatModel
Provides an interface for interacting with the Google GenAI Batch API for Chat models.
  • Method Details

    • builder

      public static GoogleGenAiBatchChatModel.Builder builder()
    • submit

      Description copied from interface: BatchChatModel
      Creates a batch of chat requests and submits them for asynchronous processing.

      The returned BatchResponse represents the status of the batch operation.

      Specified by:
      submit in interface BatchChatModel
      Parameters:
      request - the list of chat requests to process in the batch
      Returns:
      a BatchResponse representing the initial state of the batch operation
    • retrieve

      public BatchResponse<ChatResponse> retrieve(String batchId)
      Description copied from interface: BatchChatModel
      Retrieves 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:
      retrieve in interface BatchChatModel
      Parameters:
      batchId - the batch identifier obtained from BatchChatModel.submit(BatchRequest)
      Returns:
      a BatchResponse representing the current state of the chat batch operation
    • cancel

      public void cancel(String batchId)
      Description copied from interface: BatchChatModel
      Cancels a chat batch operation that is currently pending or running.
      Specified by:
      cancel in interface BatchChatModel
      Parameters:
      batchId - the batch identifier to cancel
    • list

      public BatchPage<ChatResponse> list(BatchPagination pagination)
      Description copied from interface: BatchChatModel
      Lists chat batch jobs with optional pagination.
      Specified by:
      list in interface BatchChatModel
      Parameters:
      pagination - the maximum number of batch jobs to return and token for retrieving a specific page; if null, uses server default
      Returns:
      a BatchPage containing chat batch responses and pagination information
    • submit

      public BatchResponse<ChatResponse> submit(String displayName, List<ChatRequest> requests)
      Creates and enqueues a batch of content generation requests for asynchronous processing. All requests must use the same model.
      Parameters:
      displayName - a user-defined name for the batch
      requests - a list of chat requests to be processed in the batch
      Returns:
      a BatchResponse representing the initial state of the batch operation
    • submit

      public BatchResponse<ChatResponse> submit(String displayName, com.google.genai.types.File file)
      Creates a batch of chat requests from an uploaded file.
      Parameters:
      displayName - a user-defined name for the batch
      file - the Google GenAI File object representing the uploaded file containing batch requests
      Returns:
      a BatchResponse representing the initial state of the batch operation
    • deleteBatchJob

      public void deleteBatchJob(String batchId)
      Deletes a batch job from the system.