generative-ai-python

google.generativeai.caching.CachedContent

Cached content resource.

`name` The resource name referring to the cached content.
`create_time`
`display_name`
`expire_time`
`model`
`name`
`update_time`
`usage_metadata`

Methods

create

View source

Creates CachedContent resource.

Args
`model` The name of the `model` to use for cached content creation. Any `CachedContent` resource can be only used with the `model` it was created for.
`display_name` The user-generated meaningful display name of the cached content. `display_name` must be no more than 128 unicode characters.
`system_instruction` Developer set system instruction.
`contents` Contents to cache.
`tools` A list of `Tools` the model may use to generate response.
`tool_config` Config to apply to all tools.
`ttl` TTL for cached resource (in seconds). Defaults to 1 hour. `ttl` and `expire_time` are exclusive arguments.
`expire_time` Expiration time for cached resource. `ttl` and `expire_time` are exclusive arguments.
Returns
`CachedContent` resource with specified name.

delete

View source

Deletes CachedContent resource.

get

View source

Fetches required CachedContent resource.

Args
`name` The resource name referring to the cached content.
Returns
`CachedContent` resource with specified `name`.

list

View source

Lists CachedContent objects associated with the project.

Args
`page_size` The maximum number of permissions to return (per page). The service may return fewer `CachedContent` objects.
Returns
A paginated list of `CachedContent` objects.

update

View source

Updates requested CachedContent resource.

Args
`ttl` TTL for cached resource (in seconds). Defaults to 1 hour. `ttl` and `expire_time` are exclusive arguments.
`expire_time` Expiration time for cached resource. `ttl` and `expire_time` are exclusive arguments.