Resource: CachedContent
A resource used in LLM queries for users to explicitly specify what to cache and how to cache.
name
string
Immutable. Identifier. The server-generated resource name of the cached content Format: projects/{project}/locations/{location}/cachedContents/{cachedContent}
displayName
string
Optional. Immutable. The user-generated meaningful display name of the cached content.
model
string
Immutable. The name of the Model
to use for cached content. Currently, only the published Gemini base models are supported, in form of projects/{PROJECT}/locations/{LOCATION}/publishers/google/models/{MODEL}
Optional. Input only. Immutable. Developer set system instruction. Currently, text only
Optional. Input only. Immutable. The content to cache
Optional. Input only. Immutable. A list of Tools
the model may use to generate the next response
Optional. Input only. Immutable. Tool config. This config is shared for all tools
Output only. Creation time of the cache entry.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
Output only. When the cache entry was last updated in UTC time.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
Output only. metadata on the usage of the cached content.
Input only. Immutable. Customer-managed encryption key spec for a CachedContent
. If set, this CachedContent
and all its sub-resources will be secured by this key.
expiration
Union type
expiration
can be only one of the following:timestamp of when this resource is considered expired. This is always provided on output, regardless of what was sent on input.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
Input only. The TTL for this resource. The expiration time is computed: now + TTL.
A duration in seconds with up to nine fractional digits, ending with 's
'. Example: "3.5s"
.
JSON representation |
---|
{ "name": string, "displayName": string, "model": string, "systemInstruction": { object ( |
ToolConfig
Tool config. This config is shared for all tools provided in the request.
Optional. Function calling config.
Optional. Retrieval config.
JSON representation |
---|
{ "functionCallingConfig": { object ( |
FunctionCallingConfig
Function calling config.
Optional. Function calling mode.
allowedFunctionNames[]
string
Optional. Function names to call. Only set when the Mode is ANY. Function names should match [FunctionDeclaration.name]. With mode set to ANY, model will predict a function call from the set of function names provided.
JSON representation |
---|
{
"mode": enum ( |
Mode
Function calling mode.
Enums | |
---|---|
MODE_UNSPECIFIED |
Unspecified function calling mode. This value should not be used. |
AUTO |
Default model behavior, model decides to predict either function calls or natural language response. |
ANY |
Model is constrained to always predicting function calls only. If "allowedFunctionNames" are set, the predicted function calls will be limited to any one of "allowedFunctionNames", else the predicted function calls will be any one of the provided "functionDeclarations". |
NONE |
Model will not predict any function calls. Model behavior is same as when not passing any function declarations. |
VALIDATED |
Model is constrained to predict either function calls or natural language response. If "allowedFunctionNames" are set, the predicted function calls will be limited to any one of "allowedFunctionNames", else the predicted function calls will be any one of the provided "functionDeclarations". |
RetrievalConfig
UsageMetadata
metadata on the usage of the cached content.
totalTokenCount
integer
Total number of tokens that the cached content consumes.
textCount
integer
Number of text characters.
imageCount
integer
Number of images.
videoDurationSeconds
integer
Duration of video in seconds.
audioDurationSeconds
integer
Duration of audio in seconds.
JSON representation |
---|
{ "totalTokenCount": integer, "textCount": integer, "imageCount": integer, "videoDurationSeconds": integer, "audioDurationSeconds": integer } |
Methods |
|
---|---|
|
Creates cached content, this call will initialize the cached content in the data storage, and users need to pay for the cache data storage. |
|
Deletes cached content |
|
Gets cached content configurations |
|
Lists cached contents in a project |
|
Updates cached content configurations |