From a1b62d0c07767c2a3fa34d7f5f8339f41f702897 Mon Sep 17 00:00:00 2001 From: Michael Irvine Date: Thu, 5 Dec 2024 17:03:17 -0500 Subject: [PATCH 1/2] docs(ai): adds value search section --- .../product/apis-integrations/ai-api.mdx | 38 +++++++++++++++++++ docs/pages/product/workspace/ai-assistant.mdx | 38 +++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/docs/pages/product/apis-integrations/ai-api.mdx b/docs/pages/product/apis-integrations/ai-api.mdx index 91783b86ad7cc..c7b945d5cde77 100644 --- a/docs/pages/product/apis-integrations/ai-api.mdx +++ b/docs/pages/product/apis-integrations/ai-api.mdx @@ -179,6 +179,44 @@ to give the AI context on possible values in a categorical dimension: - completed ``` +### Value search + +By default, the AI API has no ability to see the contents of your data (for privacy reasons). +However, this makes it difficult for the AI API to generate correct filters for some queries. + +Imagine you have a categorical `order_status` dimension with the possible values "shipped", +"processing", and "completed". Without value search, asking "how many complete orders did +we have today" might get you a query filtering on `order_status = 'Complete'` instead of +the correct `order_status = 'completed'`. + +To solve this, the AI API can perform "value searches" where it introspects the values in +selected categorical dimensions before running a query. Value search is opt-in and dimensions +must be enabled for it individually. Currently, the AI API performs value search by running +Cube queries using the `contains` filter operator against one or more chosen dimensions. +The LLM will select dimensions from among those you have based on the question asked and +generate possible values dynamically. + + + When running value search queries, the AI API passes through the security context used + for the AI API request, so security is maintained and only dimensions the end user has + access to are able to be searched. + + +To enable value search on a dimension, set the `searchable` field to true under the `ai` +meta tag, as shown below: +```yaml + - name: order_status + sql: order_status + type: string + meta: + ai: + searchable: true +``` + +Note that enabling Value Search may lead to slightly longer AI API response times when it +is used but should result in significantly more accurate queries in many situations. Value +Search can only be used on string dimensions. + ### Other LLM providers diff --git a/docs/pages/product/workspace/ai-assistant.mdx b/docs/pages/product/workspace/ai-assistant.mdx index c673364952c2a..5d48d32e0a160 100644 --- a/docs/pages/product/workspace/ai-assistant.mdx +++ b/docs/pages/product/workspace/ai-assistant.mdx @@ -97,6 +97,44 @@ to give the AI context on possible values in a categorical dimension: - completed ``` +### Value search + +By default, the AI Assistant has no ability to see the contents of your data (for privacy reasons). +However, this makes it difficult for the AI Assistant to generate correct filters for some queries. + +Imagine you have a categorical `order_status` dimension with the possible values "shipped", +"processing", and "completed". Without value search, asking "how many complete orders did +we have today" might get you a query filtering on `order_status = 'Complete'` instead of +the correct `order_status = 'completed'`. + +To solve this, the AI Assistant can perform "value searches" where it introspects the values in +selected categorical dimensions before running a query. Value search is opt-in and dimensions +must be enabled for it individually. Currently, the AI Assistant performs value search by running +Cube queries using the `contains` filter operator against one or more chosen dimensions. +The LLM will select dimensions from among those you have based on the question asked and +generate possible values dynamically. + + + When running value search queries, the AI Assistant passes through the security context used + for the AI Assistant request, so security is maintained and only dimensions the end user has + access to are able to be searched. + + +To enable value search on a dimension, set the `searchable` field to true under the `ai` +meta tag, as shown below: +```yaml + - name: order_status + sql: order_status + type: string + meta: + ai: + searchable: true +``` + +Note that enabling Value Search may lead to slightly longer AI Assistant response times when it +is used but should result in significantly more accurate queries in many situations. Value +Search can only be used on string dimensions. + ### Other LLM providers See the [AI API's documentation][ref-ai-api-providers] for information on how to "bring your own" LLM. From aeca064b168f57d445736c49d88a620ee7dee511 Mon Sep 17 00:00:00 2001 From: Michael Irvine Date: Tue, 10 Dec 2024 09:23:44 -0500 Subject: [PATCH 2/2] deduplicates value search --- docs/pages/product/workspace/ai-assistant.mdx | 38 ++----------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/docs/pages/product/workspace/ai-assistant.mdx b/docs/pages/product/workspace/ai-assistant.mdx index 5d48d32e0a160..06b9ed81635a3 100644 --- a/docs/pages/product/workspace/ai-assistant.mdx +++ b/docs/pages/product/workspace/ai-assistant.mdx @@ -99,41 +99,8 @@ to give the AI context on possible values in a categorical dimension: ### Value search -By default, the AI Assistant has no ability to see the contents of your data (for privacy reasons). -However, this makes it difficult for the AI Assistant to generate correct filters for some queries. - -Imagine you have a categorical `order_status` dimension with the possible values "shipped", -"processing", and "completed". Without value search, asking "how many complete orders did -we have today" might get you a query filtering on `order_status = 'Complete'` instead of -the correct `order_status = 'completed'`. - -To solve this, the AI Assistant can perform "value searches" where it introspects the values in -selected categorical dimensions before running a query. Value search is opt-in and dimensions -must be enabled for it individually. Currently, the AI Assistant performs value search by running -Cube queries using the `contains` filter operator against one or more chosen dimensions. -The LLM will select dimensions from among those you have based on the question asked and -generate possible values dynamically. - - - When running value search queries, the AI Assistant passes through the security context used - for the AI Assistant request, so security is maintained and only dimensions the end user has - access to are able to be searched. - - -To enable value search on a dimension, set the `searchable` field to true under the `ai` -meta tag, as shown below: -```yaml - - name: order_status - sql: order_status - type: string - meta: - ai: - searchable: true -``` - -Note that enabling Value Search may lead to slightly longer AI Assistant response times when it -is used but should result in significantly more accurate queries in many situations. Value -Search can only be used on string dimensions. +Value Search can be enabled for AI Assistant in the same way as for the AI API. See the +[AI API's documentation][ref-ai-api-value-search] for details and instructions. ### Other LLM providers @@ -165,3 +132,4 @@ See the [AI API's documentation][ref-ai-api-providers] for information on how to [ref-playground]: /product/workspace/playground [ref-catalog-downstream]: /product/workspace/semantic-catalog#connecting-downstream-tools [ref-ai-api-providers]: /product/apis-integrations/ai-api#other-llm-providers +[ref-ai-api-value-search]: /product/apis-integrations/ai-api#value-search \ No newline at end of file