Class GoogleGenAiBatchEmbeddingModel

java.lang.Object
dev.langchain4j.model.google.genai.GoogleGenAiBatchEmbeddingModel
All Implemented Interfaces:
BatchEmbeddingModel

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

    • builder

      public static GoogleGenAiBatchEmbeddingModel.Builder builder()
    • submit

      Description copied from interface: BatchEmbeddingModel
      Creates a batch of text segments and submits them for asynchronous embedding processing.

      The returned BatchResponse represents the status of the batch operation.

      Specified by:
      submit in interface BatchEmbeddingModel
      Parameters:
      request - the list of text segments to embed in the batch
      Returns:
      a BatchResponse representing the initial state of the batch operation
    • retrieve

      public BatchResponse<Response<Embedding>> retrieve(String batchId)
      Description copied from interface: BatchEmbeddingModel
      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.

      Specified by:
      retrieve in interface BatchEmbeddingModel
      Parameters:
      batchId - the batch identifier obtained from BatchEmbeddingModel.submit(BatchRequest)
      Returns:
      a BatchResponse representing the current state of the embedding batch operation
    • cancel

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

      public BatchPage<Response<Embedding>> list(BatchPagination pagination)
      Description copied from interface: BatchEmbeddingModel
      Lists embedding batch jobs with optional pagination.
      Specified by:
      list in interface BatchEmbeddingModel
      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 embedding batch responses and pagination information
    • submit

      public BatchResponse<Response<Embedding>> submit(String displayName, List<TextSegment> requests)
      Creates and enqueues a batch of embedding requests for asynchronous processing.
      Parameters:
      displayName - a user-defined name for the batch
      requests - a list of text segments to be embedded in the batch
      Returns:
      a BatchResponse representing the initial state of the batch operation
    • submit

      public BatchResponse<Response<Embedding>> submit(String displayName, com.google.genai.types.File file)
      Creates a batch of embedding 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.