Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions docs/pages/product/apis-integrations/ai-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<InfoBox>
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.
</InfoBox>

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

<InfoBox>
Expand Down
6 changes: 6 additions & 0 deletions docs/pages/product/workspace/ai-assistant.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ to give the AI context on possible values in a categorical dimension:
- completed
```

### Value search

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

See the [AI API's documentation][ref-ai-api-providers] for information on how to "bring your own" LLM.
Expand Down Expand Up @@ -127,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
Loading