Skip to main content

examples

Creates, updates, deletes, gets or lists an examples resource.

Overview​

Nameexamples
TypeResource
Iddatabricks_workspace.knowledgeassistants.examples

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringFull resource name: knowledge-assistants/{knowledge_assistant_id}/examples/{example_id}
example_idstringThe universally unique identifier (UUID) of the example.
create_timestring (date-time)Timestamp when this example was created.
guidelinesarrayGuidelines for answering the question. Optional — examples may be created with just a question; the front-end form does not require guidelines.
questionstringThe example question.
update_timestring (date-time)Timestamp when this example was last updated.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectknowledge_assistant_id, example_id, deployment_name, workspace_domainGets an example from a Knowledge Assistant.
listselectknowledge_assistant_id, deployment_name, workspace_domainpage_size, page_tokenLists examples under a Knowledge Assistant.
createinsertknowledge_assistant_id, deployment_name, workspace_domain, questionCreates an example for a Knowledge Assistant.
updateupdateknowledge_assistant_id, example_id, update_mask, deployment_name, workspace_domain, questionUpdates an example in a Knowledge Assistant.
deletedeleteknowledge_assistant_id, example_id, deployment_name, workspace_domainDeletes an example from a Knowledge Assistant.

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
deployment_namestringThe Databricks workspace deployment name: the host prefix of the workspace URL (dbc-abcd0123-a1bc on AWS, adb-1234567890123456.7 on Azure, 1234567890123456.7 on GCP). Set DATABRICKS_DEPLOYMENT_NAME to default it for the session. (default: dbc-abcd0123-a1bc, x-stackQL-envVar: DATABRICKS_DEPLOYMENT_NAME)
example_idstringThe example_id segment of the name resource name (knowledge-assistants/{knowledge_assistant_id}/examples/{example_id}). The resource name of the example to delete. Format: knowledge-assistants/{knowledge_assistant_id}/examples/{example_id}
knowledge_assistant_idstringThe knowledge_assistant_id segment of the name resource name (knowledge-assistants/{knowledge_assistant_id}/examples/{example_id}). The resource name of the example to delete. Format: knowledge-assistants/{knowledge_assistant_id}/examples/{example_id}
update_maskobjectComma-delimited list of fields to update on the example. Allowed values: question, guidelines. Examples: - question - question,guidelines
workspace_domainstringThe Databricks workspace domain suffix for the cloud. Selected by DATABRICKS_CLOUD (aws, azure or gcp; default aws). (default: cloud.databricks.com, x-stackQL-envVarSelector: {"envVar":"DATABRICKS_CLOUD","default":"aws","values":{"aws":"cloud.databricks.com","azure":"azuredatabricks.net","gcp":"gcp.databricks.com"}})
page_sizeintegerThe maximum number of examples to return. If unspecified, at most 100 examples will be returned. The maximum value is 100; values above 100 will be coerced to 100.
page_tokenstringA page token, received from a previous ListExamples call. Provide this to retrieve the subsequent page. If unspecified, the first page will be returned.

SELECT examples​

Gets an example from a Knowledge Assistant.

SELECT
name,
example_id,
create_time,
guidelines,
question,
update_time
FROM databricks_workspace.knowledgeassistants.examples
WHERE knowledge_assistant_id = '{{ knowledge_assistant_id }}' -- required
AND example_id = '{{ example_id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
AND workspace_domain = '{{ workspace_domain }}' -- required
;

INSERT examples​

Creates an example for a Knowledge Assistant.

INSERT INTO databricks_workspace.knowledgeassistants.examples (
question,
create_time,
example_id,
guidelines,
name,
update_time,
knowledge_assistant_id,
deployment_name,
workspace_domain
)
SELECT
'{{ question }}' /* required */,
'{{ create_time }}',
'{{ example_id }}',
'{{ guidelines }}',
'{{ name }}',
'{{ update_time }}',
'{{ knowledge_assistant_id }}',
'{{ deployment_name }}',
'{{ workspace_domain }}'
RETURNING
name,
example_id,
create_time,
guidelines,
question,
update_time
;

UPDATE examples​

Updates an example in a Knowledge Assistant.

UPDATE databricks_workspace.knowledgeassistants.examples
SET
question = '{{ question }}',
create_time = '{{ create_time }}',
example_id = '{{ example_id }}',
guidelines = '{{ guidelines }}',
name = '{{ name }}',
update_time = '{{ update_time }}'
WHERE
knowledge_assistant_id = '{{ knowledge_assistant_id }}' --required
AND example_id = '{{ example_id }}' --required
AND update_mask = '{{ update_mask }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND workspace_domain = '{{ workspace_domain }}' --required
AND question = '{{ question }}' --required
RETURNING
name,
example_id,
create_time,
guidelines,
question,
update_time;

DELETE examples​

Deletes an example from a Knowledge Assistant.

DELETE FROM databricks_workspace.knowledgeassistants.examples
WHERE knowledge_assistant_id = '{{ knowledge_assistant_id }}' --required
AND example_id = '{{ example_id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND workspace_domain = '{{ workspace_domain }}' --required
;