CachesFutures

public abstract class CachesFutures


A Java-friendly wrapper for the Caches class, providing ListenableFuture for asynchronous operations.

Summary

Public methods

abstract @NonNull ListenableFuture<@NonNull CachedContext>

Creates a cached context that can be used in future GenerateContentRequests.

abstract @NonNull ListenableFuture<@NonNull Boolean>

Deletes the cached context with the given name.

static final @NonNull CachesFutures
from(@NonNull GenerativeModel generativeModel)
abstract @NonNull ListenableFuture<CachedContext>

Returns the cached context with the given name.

abstract @NonNull ListenableFuture<@NonNull List<@NonNull CachedContext>>

Queries the cached contexts created by create.

Public methods

create

public abstract @NonNull ListenableFuture<@NonNull CachedContextcreate(@NonNull CreateCachedContextRequest request)

Creates a cached context that can be used in future GenerateContentRequests.

delete

public abstract @NonNull ListenableFuture<@NonNull Booleandelete(@NonNull String name)

Deletes the cached context with the given name.

from

public static final @NonNull CachesFutures from(@NonNull GenerativeModel generativeModel)
Parameters
@NonNull GenerativeModel generativeModel

the GenerativeModel instance that contains the Caches instance.

Returns
@NonNull CachesFutures

a CachesFutures created from the provided GenerativeModel instance.

get

public abstract @NonNull ListenableFuture<CachedContextget(@NonNull String name)

Returns the cached context with the given name.

list

public abstract @NonNull ListenableFuture<@NonNull List<@NonNull CachedContext>> list()

Queries the cached contexts created by create.