Class GcsArtifactService

java.lang.Object
com.google.adk.artifacts.GcsArtifactService
All Implemented Interfaces:
BaseArtifactService

public final class GcsArtifactService extends Object implements BaseArtifactService
An artifact service implementation using Google Cloud Storage (GCS).
  • Constructor Details

    • GcsArtifactService

      public GcsArtifactService(String bucketName, com.google.cloud.storage.Storage storageClient)
      Initializes the GcsArtifactService.
      Parameters:
      bucketName - The name of the GCS bucket to use.
      storageClient - The GCS storage client instance.
  • Method Details

    • saveArtifact

      public io.reactivex.rxjava3.core.Single<Integer> saveArtifact(String appName, String userId, String sessionId, String filename, com.google.genai.types.Part artifact)
      Description copied from interface: BaseArtifactService
      Saves an artifact.
      Specified by:
      saveArtifact in interface BaseArtifactService
      Parameters:
      appName - the app name
      userId - the user ID
      sessionId - the session ID
      filename - the filename
      artifact - the artifact
      Returns:
      the revision ID (version) of the saved artifact.
    • loadArtifact

      public io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Part> loadArtifact(String appName, String userId, String sessionId, String filename, Optional<Integer> version)
      Description copied from interface: BaseArtifactService
      Gets an artifact.
      Specified by:
      loadArtifact in interface BaseArtifactService
      Parameters:
      appName - the app name
      userId - the user ID
      sessionId - the session ID
      filename - the filename
      version - Optional version number. If null, loads the latest version.
      Returns:
      the artifact or empty if not found
    • listArtifactKeys

      public io.reactivex.rxjava3.core.Single<ListArtifactsResponse> listArtifactKeys(String appName, String userId, String sessionId)
      Description copied from interface: BaseArtifactService
      Lists all the artifact filenames within a session.
      Specified by:
      listArtifactKeys in interface BaseArtifactService
      Parameters:
      appName - the app name
      userId - the user ID
      sessionId - the session ID
      Returns:
      the list artifact response containing filenames
    • deleteArtifact

      public io.reactivex.rxjava3.core.Completable deleteArtifact(String appName, String userId, String sessionId, String filename)
      Description copied from interface: BaseArtifactService
      Deletes an artifact.
      Specified by:
      deleteArtifact in interface BaseArtifactService
      Parameters:
      appName - the app name
      userId - the user ID
      sessionId - the session ID
      filename - the filename
    • listVersions

      public io.reactivex.rxjava3.core.Single<com.google.common.collect.ImmutableList<Integer>> listVersions(String appName, String userId, String sessionId, String filename)
      Description copied from interface: BaseArtifactService
      Lists all the versions (as revision IDs) of an artifact.
      Specified by:
      listVersions in interface BaseArtifactService
      Parameters:
      appName - the app name
      userId - the user ID
      sessionId - the session ID
      filename - the artifact filename
      Returns:
      A list of integer version numbers.