Skip to main content

cached_contents

Creates, updates, deletes, gets or lists a cached_contents resource.

Overview

Namecached_contents
TypeResource
Idgoogle.aiplatform.cached_contents

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringImmutable. Identifier. The server-generated resource name of the cached content Format: projects/{project}/locations/{location}/cachedContents/{cached_content}
contentsarrayOptional. Input only. Immutable. The content to cache
createTimestring (google-datetime)Output only. Creation time of the cache entry.
displayNamestringOptional. Immutable. The user-generated meaningful display name of the cached content.
encryptionSpecobjectInput 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. (id: GoogleCloudAiplatformV1EncryptionSpec)
expireTimestring (google-datetime)Timestamp of when this resource is considered expired. This is always provided on output, regardless of what was sent on input.
modelstringImmutable. 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}
systemInstructionobjectThe base structured datatype containing multi-part content of a message. A Content includes a role field designating the producer of the Content and a parts field containing multi-part data that contains the content of the message turn. (id: GoogleCloudAiplatformV1Content)
toolConfigobjectOptional. Input only. Immutable. Tool config. This config is shared for all tools (id: GoogleCloudAiplatformV1ToolConfig)
toolsarrayOptional. Input only. Immutable. A list of Tools the model may use to generate the next response
ttlstring (google-duration)Input only. The TTL for this resource. The expiration time is computed: now + TTL.
updateTimestring (google-datetime)Output only. When the cache entry was last updated in UTC time.
usageMetadataobjectOutput only. Metadata on the usage of the cached content. (id: GoogleCloudAiplatformV1CachedContentUsageMetadata)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, cachedContentsIdGets cached content configurations
listselectprojectsId, locationsIdpageSize, pageTokenLists cached contents in a project
createinsertprojectsId, locationsIdCreates cached content, this call will initialize the cached content in the data storage, and users need to pay for the cache data storage.
patchupdateprojectsId, locationsId, cachedContentsIdupdateMaskUpdates cached content configurations
deletedeleteprojectsId, locationsId, cachedContentsIdDeletes cached content

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
cachedContentsIdstring
locationsIdstring
projectsIdstring
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples

Gets cached content configurations

SELECT
name,
contents,
createTime,
displayName,
encryptionSpec,
expireTime,
model,
systemInstruction,
toolConfig,
tools,
ttl,
updateTime,
usageMetadata
FROM google.aiplatform.cached_contents
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND cachedContentsId = '{{ cachedContentsId }}' -- required;

INSERT examples

Creates cached content, this call will initialize the cached content in the data storage, and users need to pay for the cache data storage.

INSERT INTO google.aiplatform.cached_contents (
data__expireTime,
data__ttl,
data__name,
data__displayName,
data__model,
data__systemInstruction,
data__contents,
data__tools,
data__toolConfig,
data__encryptionSpec,
projectsId,
locationsId
)
SELECT
'{{ expireTime }}',
'{{ ttl }}',
'{{ name }}',
'{{ displayName }}',
'{{ model }}',
'{{ systemInstruction }}',
'{{ contents }}',
'{{ tools }}',
'{{ toolConfig }}',
'{{ encryptionSpec }}',
'{{ projectsId }}',
'{{ locationsId }}'
RETURNING
name,
contents,
createTime,
displayName,
encryptionSpec,
expireTime,
model,
systemInstruction,
toolConfig,
tools,
ttl,
updateTime,
usageMetadata
;

UPDATE examples

Updates cached content configurations

UPDATE google.aiplatform.cached_contents
SET
data__expireTime = '{{ expireTime }}',
data__ttl = '{{ ttl }}',
data__name = '{{ name }}',
data__displayName = '{{ displayName }}',
data__model = '{{ model }}',
data__systemInstruction = '{{ systemInstruction }}',
data__contents = '{{ contents }}',
data__tools = '{{ tools }}',
data__toolConfig = '{{ toolConfig }}',
data__encryptionSpec = '{{ encryptionSpec }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND cachedContentsId = '{{ cachedContentsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
contents,
createTime,
displayName,
encryptionSpec,
expireTime,
model,
systemInstruction,
toolConfig,
tools,
ttl,
updateTime,
usageMetadata;

DELETE examples

Deletes cached content

DELETE FROM google.aiplatform.cached_contents
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND cachedContentsId = '{{ cachedContentsId }}' --required;