cached_contents
Creates, updates, deletes, gets or lists a cached_contents
resource.
Overview
Name | cached_contents |
Type | Resource |
Id | google.aiplatform.cached_contents |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Immutable. Identifier. The server-generated resource name of the cached content Format: projects/{project}/locations/{location}/cachedContents/{cached_content} |
contents | array | Optional. Input only. Immutable. The content to cache |
createTime | string (google-datetime) | Output only. Creation time of the cache entry. |
displayName | string | Optional. Immutable. The user-generated meaningful display name of the cached content. |
encryptionSpec | object | 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. (id: GoogleCloudAiplatformV1EncryptionSpec) |
expireTime | string (google-datetime) | Timestamp of when this resource is considered expired. This is always provided on output, regardless of what was sent on input. |
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} |
systemInstruction | object | The 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) |
toolConfig | object | Optional. Input only. Immutable. Tool config. This config is shared for all tools (id: GoogleCloudAiplatformV1ToolConfig) |
tools | array | Optional. Input only. Immutable. A list of Tools the model may use to generate the next response |
ttl | string (google-duration) | Input only. The TTL for this resource. The expiration time is computed: now + TTL. |
updateTime | string (google-datetime) | Output only. When the cache entry was last updated in UTC time. |
usageMetadata | object | Output only. Metadata on the usage of the cached content. (id: GoogleCloudAiplatformV1CachedContentUsageMetadata) |
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Immutable. Identifier. The server-generated resource name of the cached content Format: projects/{project}/locations/{location}/cachedContents/{cached_content} |
contents | array | Optional. Input only. Immutable. The content to cache |
createTime | string (google-datetime) | Output only. Creation time of the cache entry. |
displayName | string | Optional. Immutable. The user-generated meaningful display name of the cached content. |
encryptionSpec | object | 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. (id: GoogleCloudAiplatformV1EncryptionSpec) |
expireTime | string (google-datetime) | Timestamp of when this resource is considered expired. This is always provided on output, regardless of what was sent on input. |
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} |
systemInstruction | object | The 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) |
toolConfig | object | Optional. Input only. Immutable. Tool config. This config is shared for all tools (id: GoogleCloudAiplatformV1ToolConfig) |
tools | array | Optional. Input only. Immutable. A list of Tools the model may use to generate the next response |
ttl | string (google-duration) | Input only. The TTL for this resource. The expiration time is computed: now + TTL. |
updateTime | string (google-datetime) | Output only. When the cache entry was last updated in UTC time. |
usageMetadata | object | Output only. Metadata on the usage of the cached content. (id: GoogleCloudAiplatformV1CachedContentUsageMetadata) |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | projectsId , locationsId , cachedContentsId | Gets cached content configurations | |
list | select | projectsId , locationsId | pageSize , pageToken | Lists cached contents in a project |
create | insert | projectsId , locationsId | Creates cached content, this call will initialize the cached content in the data storage, and users need to pay for the cache data storage. | |
patch | update | projectsId , locationsId , cachedContentsId | updateMask | Updates cached content configurations |
delete | delete | projectsId , locationsId , cachedContentsId | Deletes 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.
Name | Datatype | Description |
---|---|---|
cachedContentsId | string | |
locationsId | string | |
projectsId | string | |
pageSize | integer (int32) | |
pageToken | string | |
updateMask | string (google-fieldmask) |
SELECT
examples
- get
- list
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;
Lists cached contents in a project
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 pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}';
INSERT
examples
- create
- Manifest
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
;
# Description fields are for documentation purposes
- name: cached_contents
props:
- name: projectsId
value: string
description: Required parameter for the cached_contents resource.
- name: locationsId
value: string
description: Required parameter for the cached_contents resource.
- name: expireTime
value: string
description: >
Timestamp of when this resource is considered expired. This is *always* provided on output, regardless of what was sent on input.
- name: ttl
value: string
description: >
Input only. The TTL for this resource. The expiration time is computed: now + TTL.
- name: name
value: string
description: >
Immutable. Identifier. The server-generated resource name of the cached content Format: projects/{project}/locations/{location}/cachedContents/{cached_content}
- name: displayName
value: string
description: >
Optional. Immutable. The user-generated meaningful display name of the cached content.
- name: model
value: string
description: >
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}
- name: systemInstruction
value: object
description: >
The 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.
- name: contents
value: array
description: >
Optional. Input only. Immutable. The content to cache
- name: tools
value: array
description: >
Optional. Input only. Immutable. A list of `Tools` the model may use to generate the next response
- name: toolConfig
value: object
description: >
Optional. Input only. Immutable. Tool config. This config is shared for all tools
- name: encryptionSpec
value: object
description: >
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.
UPDATE
examples
- patch
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
- delete
Deletes cached content
DELETE FROM google.aiplatform.cached_contents
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND cachedContentsId = '{{ cachedContentsId }}' --required;