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
| 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 structured data content of a message. A Content message contains a role field, which indicates the producer of the content, and a parts field, which contains the multi-part data of the message. (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) |
| 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 structured data content of a message. A Content message contains a role field, which indicates the producer of the content, and a parts field, which contains the multi-part data of the message. (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__tools,
data__systemInstruction,
data__encryptionSpec,
data__name,
data__expireTime,
data__ttl,
data__displayName,
data__toolConfig,
data__model,
data__contents,
projectsId,
locationsId
)
SELECT
'{{ tools }}',
'{{ systemInstruction }}',
'{{ encryptionSpec }}',
'{{ name }}',
'{{ expireTime }}',
'{{ ttl }}',
'{{ displayName }}',
'{{ toolConfig }}',
'{{ model }}',
'{{ contents }}',
'{{ 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: "{{ projectsId }}"
description: Required parameter for the cached_contents resource.
- name: locationsId
value: "{{ locationsId }}"
description: Required parameter for the cached_contents resource.
- name: tools
description: |
Optional. Input only. Immutable. A list of `Tools` the model may use to generate the next response
value:
- exaAiSearch:
apiKey: "{{ apiKey }}"
customConfigs: "{{ customConfigs }}"
computerUse:
excludedPredefinedFunctions:
- "{{ excludedPredefinedFunctions }}"
environment: "{{ environment }}"
enablePromptInjectionDetection: {{ enablePromptInjectionDetection }}
googleSearchRetrieval:
dynamicRetrievalConfig:
mode: "{{ mode }}"
dynamicThreshold: {{ dynamicThreshold }}
googleSearch:
excludeDomains:
- "{{ excludeDomains }}"
searchTypes:
imageSearch: "{{ imageSearch }}"
webSearch: "{{ webSearch }}"
blockingConfidence: "{{ blockingConfidence }}"
parallelAiSearch:
enableDataRetention: {{ enableDataRetention }}
enableZeroDataRetention: {{ enableZeroDataRetention }}
apiKey: "{{ apiKey }}"
customConfigs: "{{ customConfigs }}"
googleMaps:
enableWidget: {{ enableWidget }}
groundingTypes:
places: "{{ places }}"
routing: "{{ routing }}"
retrieval:
vertexAiSearch:
filter: "{{ filter }}"
dataStoreSpecs:
- dataStore: "{{ dataStore }}"
filter: "{{ filter }}"
datastore: "{{ datastore }}"
engine: "{{ engine }}"
maxResults: {{ maxResults }}
vertexRagStore:
ragRetrievalConfig:
topK: {{ topK }}
ranking:
llmRanker: "{{ llmRanker }}"
rankService: "{{ rankService }}"
filter:
vectorDistanceThreshold: {{ vectorDistanceThreshold }}
metadataFilter: "{{ metadataFilter }}"
vectorSimilarityThreshold: {{ vectorSimilarityThreshold }}
ragResources:
- ragCorpus: "{{ ragCorpus }}"
ragFileIds: "{{ ragFileIds }}"
similarityTopK: {{ similarityTopK }}
vectorDistanceThreshold: {{ vectorDistanceThreshold }}
externalApi:
apiSpec: "{{ apiSpec }}"
elasticSearchParams:
searchTemplate: "{{ searchTemplate }}"
numHits: {{ numHits }}
index: "{{ index }}"
authConfig:
googleServiceAccountConfig:
serviceAccount: "{{ serviceAccount }}"
apiKeyConfig:
name: "{{ name }}"
apiKeySecret: "{{ apiKeySecret }}"
apiKeyString: "{{ apiKeyString }}"
httpElementLocation: "{{ httpElementLocation }}"
oidcConfig:
idToken: "{{ idToken }}"
serviceAccount: "{{ serviceAccount }}"
oauthConfig:
accessToken: "{{ accessToken }}"
serviceAccount: "{{ serviceAccount }}"
authType: "{{ authType }}"
httpBasicAuthConfig:
credentialSecret: "{{ credentialSecret }}"
endpoint: "{{ endpoint }}"
apiAuth:
apiKeyConfig:
apiKeySecretVersion: "{{ apiKeySecretVersion }}"
apiKeyString: "{{ apiKeyString }}"
simpleSearchParams: "{{ simpleSearchParams }}"
disableAttribution: {{ disableAttribution }}
functionDeclarations: "{{ functionDeclarations }}"
urlContext: "{{ urlContext }}"
enterpriseWebSearch:
blockingConfidence: "{{ blockingConfidence }}"
excludeDomains:
- "{{ excludeDomains }}"
codeExecution: "{{ codeExecution }}"
- name: systemInstruction
description: |
The structured data content of a message. A Content message contains a `role` field, which indicates the producer of the content, and a `parts` field, which contains the multi-part data of the message.
value:
role: "{{ role }}"
parts:
- videoMetadata:
startOffset: "{{ startOffset }}"
endOffset: "{{ endOffset }}"
fps: {{ fps }}
thought: {{ thought }}
fileData:
fileUri: "{{ fileUri }}"
mimeType: "{{ mimeType }}"
displayName: "{{ displayName }}"
text: "{{ text }}"
executableCode:
language: "{{ language }}"
code: "{{ code }}"
id: "{{ id }}"
functionResponse:
name: "{{ name }}"
response: "{{ response }}"
parts:
- inlineData:
mimeType: "{{ mimeType }}"
displayName: "{{ displayName }}"
data: "{{ data }}"
fileData:
fileUri: "{{ fileUri }}"
mimeType: "{{ mimeType }}"
displayName: "{{ displayName }}"
id: "{{ id }}"
scheduling: "{{ scheduling }}"
codeExecutionResult:
id: "{{ id }}"
outcome: "{{ outcome }}"
output: "{{ output }}"
audioTranscription:
text: "{{ text }}"
speakerLabel: "{{ speakerLabel }}"
words:
- word: "{{ word }}"
startOffset: "{{ startOffset }}"
endOffset: "{{ endOffset }}"
inlineData:
mimeType: "{{ mimeType }}"
displayName: "{{ displayName }}"
data: "{{ data }}"
functionCall:
willContinue: {{ willContinue }}
args: "{{ args }}"
id: "{{ id }}"
partialArgs:
- jsonPath: "{{ jsonPath }}"
numberValue: {{ numberValue }}
boolValue: {{ boolValue }}
nullValue: "{{ nullValue }}"
stringValue: "{{ stringValue }}"
willContinue: {{ willContinue }}
name: "{{ name }}"
mediaResolution:
level: "{{ level }}"
thoughtSignature: "{{ thoughtSignature }}"
- name: encryptionSpec
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.
value:
kmsKeyName: "{{ kmsKeyName }}"
- name: name
value: "{{ name }}"
description: |
Immutable. Identifier. The server-generated resource name of the cached content Format: projects/{project}/locations/{location}/cachedContents/{cached_content}
- name: expireTime
value: "{{ expireTime }}"
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: "{{ ttl }}"
description: |
Input only. The TTL for this resource. The expiration time is computed: now + TTL.
- name: displayName
value: "{{ displayName }}"
description: |
Optional. Immutable. The user-generated meaningful display name of the cached content.
- name: toolConfig
description: |
Optional. Input only. Immutable. Tool config. This config is shared for all tools
value:
functionCallingConfig:
allowedFunctionNames:
- "{{ allowedFunctionNames }}"
mode: "{{ mode }}"
streamFunctionCallArguments: {{ streamFunctionCallArguments }}
retrievalConfig:
latLng:
longitude: {{ longitude }}
latitude: {{ latitude }}
languageCode: "{{ languageCode }}"
- name: model
value: "{{ model }}"
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: contents
description: |
Optional. Input only. Immutable. The content to cache
value:
- role: "{{ role }}"
parts: "{{ parts }}"
UPDATE examples
- patch
Updates cached content configurations
UPDATE google.aiplatform.cached_contents
SET
data__tools = '{{ tools }}',
data__systemInstruction = '{{ systemInstruction }}',
data__encryptionSpec = '{{ encryptionSpec }}',
data__name = '{{ name }}',
data__expireTime = '{{ expireTime }}',
data__ttl = '{{ ttl }}',
data__displayName = '{{ displayName }}',
data__toolConfig = '{{ toolConfig }}',
data__model = '{{ model }}',
data__contents = '{{ contents }}'
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
;