contexts
Creates, updates, deletes, gets or lists a contexts
resource.
Overview
Name | contexts |
Type | Resource |
Id | google.aiplatform.contexts |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Immutable. The resource name of the Context. |
createTime | string (google-datetime) | Output only. Timestamp when this Context was created. |
description | string | Description of the Context |
displayName | string | User provided display name of the Context. May be up to 128 Unicode characters. |
etag | string | An eTag used to perform consistent read-modify-write updates. If not set, a blind "overwrite" update happens. |
labels | object | The labels with user-defined metadata to organize your Contexts. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. No more than 64 user labels can be associated with one Context (System labels are excluded). |
metadata | object | Properties of the Context. Top level metadata keys' heading and trailing spaces will be trimmed. The size of this field should not exceed 200KB. |
parentContexts | array | Output only. A list of resource names of Contexts that are parents of this Context. A Context may have at most 10 parent_contexts. |
schemaTitle | string | The title of the schema describing the metadata. Schema title and version is expected to be registered in earlier Create Schema calls. And both are used together as unique identifiers to identify schemas within the local metadata store. |
schemaVersion | string | The version of the schema in schema_name to use. Schema title and version is expected to be registered in earlier Create Schema calls. And both are used together as unique identifiers to identify schemas within the local metadata store. |
updateTime | string (google-datetime) | Output only. Timestamp when this Context was last updated. |
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Immutable. The resource name of the Context. |
createTime | string (google-datetime) | Output only. Timestamp when this Context was created. |
description | string | Description of the Context |
displayName | string | User provided display name of the Context. May be up to 128 Unicode characters. |
etag | string | An eTag used to perform consistent read-modify-write updates. If not set, a blind "overwrite" update happens. |
labels | object | The labels with user-defined metadata to organize your Contexts. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. No more than 64 user labels can be associated with one Context (System labels are excluded). |
metadata | object | Properties of the Context. Top level metadata keys' heading and trailing spaces will be trimmed. The size of this field should not exceed 200KB. |
parentContexts | array | Output only. A list of resource names of Contexts that are parents of this Context. A Context may have at most 10 parent_contexts. |
schemaTitle | string | The title of the schema describing the metadata. Schema title and version is expected to be registered in earlier Create Schema calls. And both are used together as unique identifiers to identify schemas within the local metadata store. |
schemaVersion | string | The version of the schema in schema_name to use. Schema title and version is expected to be registered in earlier Create Schema calls. And both are used together as unique identifiers to identify schemas within the local metadata store. |
updateTime | string (google-datetime) | Output only. Timestamp when this Context was last updated. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | projectsId , locationsId , metadataStoresId , contextsId | Retrieves a specific Context. | |
list | select | projectsId , locationsId , metadataStoresId | pageSize , pageToken , filter , orderBy | Lists Contexts on the MetadataStore. |
create | insert | projectsId , locationsId , metadataStoresId | contextId | Creates a Context associated with a MetadataStore. |
patch | update | projectsId , locationsId , metadataStoresId , contextsId | updateMask , allowMissing | Updates a stored Context. |
delete | delete | projectsId , locationsId , metadataStoresId , contextsId | force , etag | Deletes a stored Context. |
retrieve_contexts | exec | projectsId , locationsId | Retrieves relevant contexts for a query. | |
purge | exec | projectsId , locationsId , metadataStoresId | Purges Contexts. | |
add_context_artifacts_and_executions | exec | projectsId , locationsId , metadataStoresId , contextsId | Adds a set of Artifacts and Executions to a Context. If any of the Artifacts or Executions have already been added to a Context, they are simply skipped. | |
add_context_children | exec | projectsId , locationsId , metadataStoresId , contextsId | Adds a set of Contexts as children to a parent Context. If any of the child Contexts have already been added to the parent Context, they are simply skipped. If this call would create a cycle or cause any Context to have more than 10 parents, the request will fail with an INVALID_ARGUMENT error. | |
remove_context_children | exec | projectsId , locationsId , metadataStoresId , contextsId | Remove a set of children contexts from a parent Context. If any of the child Contexts were NOT added to the parent Context, they are simply skipped. |
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 |
---|---|---|
contextsId | string | |
locationsId | string | |
metadataStoresId | string | |
projectsId | string | |
allowMissing | boolean | |
contextId | string | |
etag | string | |
filter | string | |
force | boolean | |
orderBy | string | |
pageSize | integer (int32) | |
pageToken | string | |
updateMask | string (google-fieldmask) |
SELECT
examples
- get
- list
Retrieves a specific Context.
SELECT
name,
createTime,
description,
displayName,
etag,
labels,
metadata,
parentContexts,
schemaTitle,
schemaVersion,
updateTime
FROM google.aiplatform.contexts
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND metadataStoresId = '{{ metadataStoresId }}' -- required
AND contextsId = '{{ contextsId }}' -- required;
Lists Contexts on the MetadataStore.
SELECT
name,
createTime,
description,
displayName,
etag,
labels,
metadata,
parentContexts,
schemaTitle,
schemaVersion,
updateTime
FROM google.aiplatform.contexts
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND metadataStoresId = '{{ metadataStoresId }}' -- required
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}'
AND filter = '{{ filter }}'
AND orderBy = '{{ orderBy }}';
INSERT
examples
- create
- Manifest
Creates a Context associated with a MetadataStore.
INSERT INTO google.aiplatform.contexts (
data__name,
data__displayName,
data__etag,
data__labels,
data__schemaTitle,
data__schemaVersion,
data__metadata,
data__description,
projectsId,
locationsId,
metadataStoresId,
contextId
)
SELECT
'{{ name }}',
'{{ displayName }}',
'{{ etag }}',
'{{ labels }}',
'{{ schemaTitle }}',
'{{ schemaVersion }}',
'{{ metadata }}',
'{{ description }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ metadataStoresId }}',
'{{ contextId }}'
RETURNING
name,
createTime,
description,
displayName,
etag,
labels,
metadata,
parentContexts,
schemaTitle,
schemaVersion,
updateTime
;
# Description fields are for documentation purposes
- name: contexts
props:
- name: projectsId
value: string
description: Required parameter for the contexts resource.
- name: locationsId
value: string
description: Required parameter for the contexts resource.
- name: metadataStoresId
value: string
description: Required parameter for the contexts resource.
- name: name
value: string
description: >
Immutable. The resource name of the Context.
- name: displayName
value: string
description: >
User provided display name of the Context. May be up to 128 Unicode characters.
- name: etag
value: string
description: >
An eTag used to perform consistent read-modify-write updates. If not set, a blind "overwrite" update happens.
- name: labels
value: object
description: >
The labels with user-defined metadata to organize your Contexts. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. No more than 64 user labels can be associated with one Context (System labels are excluded).
- name: schemaTitle
value: string
description: >
The title of the schema describing the metadata. Schema title and version is expected to be registered in earlier Create Schema calls. And both are used together as unique identifiers to identify schemas within the local metadata store.
- name: schemaVersion
value: string
description: >
The version of the schema in schema_name to use. Schema title and version is expected to be registered in earlier Create Schema calls. And both are used together as unique identifiers to identify schemas within the local metadata store.
- name: metadata
value: object
description: >
Properties of the Context. Top level metadata keys' heading and trailing spaces will be trimmed. The size of this field should not exceed 200KB.
- name: description
value: string
description: >
Description of the Context
- name: contextId
value: string
UPDATE
examples
- patch
Updates a stored Context.
UPDATE google.aiplatform.contexts
SET
data__name = '{{ name }}',
data__displayName = '{{ displayName }}',
data__etag = '{{ etag }}',
data__labels = '{{ labels }}',
data__schemaTitle = '{{ schemaTitle }}',
data__schemaVersion = '{{ schemaVersion }}',
data__metadata = '{{ metadata }}',
data__description = '{{ description }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND metadataStoresId = '{{ metadataStoresId }}' --required
AND contextsId = '{{ contextsId }}' --required
AND updateMask = '{{ updateMask}}'
AND allowMissing = {{ allowMissing}}
RETURNING
name,
createTime,
description,
displayName,
etag,
labels,
metadata,
parentContexts,
schemaTitle,
schemaVersion,
updateTime;
DELETE
examples
- delete
Deletes a stored Context.
DELETE FROM google.aiplatform.contexts
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND metadataStoresId = '{{ metadataStoresId }}' --required
AND contextsId = '{{ contextsId }}' --required
AND force = '{{ force }}'
AND etag = '{{ etag }}';
Lifecycle Methods
- retrieve_contexts
- purge
- add_context_artifacts_and_executions
- add_context_children
- remove_context_children
Retrieves relevant contexts for a query.
EXEC google.aiplatform.contexts.retrieve_contexts
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required
@@json=
'{
"vertexRagStore": "{{ vertexRagStore }}",
"query": "{{ query }}"
}';
Purges Contexts.
EXEC google.aiplatform.contexts.purge
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@metadataStoresId='{{ metadataStoresId }}' --required
@@json=
'{
"filter": "{{ filter }}",
"force": {{ force }}
}';
Adds a set of Artifacts and Executions to a Context. If any of the Artifacts or Executions have already been added to a Context, they are simply skipped.
EXEC google.aiplatform.contexts.add_context_artifacts_and_executions
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@metadataStoresId='{{ metadataStoresId }}' --required,
@contextsId='{{ contextsId }}' --required
@@json=
'{
"artifacts": "{{ artifacts }}",
"executions": "{{ executions }}"
}';
Adds a set of Contexts as children to a parent Context. If any of the child Contexts have already been added to the parent Context, they are simply skipped. If this call would create a cycle or cause any Context to have more than 10 parents, the request will fail with an INVALID_ARGUMENT error.
EXEC google.aiplatform.contexts.add_context_children
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@metadataStoresId='{{ metadataStoresId }}' --required,
@contextsId='{{ contextsId }}' --required
@@json=
'{
"childContexts": "{{ childContexts }}"
}';
Remove a set of children contexts from a parent Context. If any of the child Contexts were NOT added to the parent Context, they are simply skipped.
EXEC google.aiplatform.contexts.remove_context_children
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@metadataStoresId='{{ metadataStoresId }}' --required,
@contextsId='{{ contextsId }}' --required
@@json=
'{
"childContexts": "{{ childContexts }}"
}';