CachesFutures

abstract class CachesFutures


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

Summary

Public companion functions

CachesFutures
from(generativeModel: GenerativeModel)

Public functions

abstract ListenableFuture<CachedContext>

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

abstract ListenableFuture<Boolean>
delete(name: String)

Deletes the cached context with the given name.

abstract ListenableFuture<CachedContext?>
get(name: String)

Returns the cached context with the given name.

abstract ListenableFuture<List<CachedContext>>

Queries the cached contexts created by create.

Public companion functions

from

fun from(generativeModel: GenerativeModel): CachesFutures
Parameters
generativeModel: GenerativeModel

the GenerativeModel instance that contains the Caches instance.

Returns
CachesFutures

a CachesFutures created from the provided GenerativeModel instance.

Public functions

create

abstract fun create(request: CreateCachedContextRequest): ListenableFuture<CachedContext>

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

delete

abstract fun delete(name: String): ListenableFuture<Boolean>

Deletes the cached context with the given name.

get

abstract fun get(name: String): ListenableFuture<CachedContext?>

Returns the cached context with the given name.

list

abstract fun list(): ListenableFuture<List<CachedContext>>

Queries the cached contexts created by create.