Skip to content

Commit a1b62d0

Browse files
Michael IrvineMichael Irvine
authored andcommitted
docs(ai): adds value search section
1 parent 2b4bc9e commit a1b62d0

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

docs/pages/product/apis-integrations/ai-api.mdx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,44 @@ to give the AI context on possible values in a categorical dimension:
179179
- completed
180180
```
181181
182+
### Value search
183+
184+
By default, the AI API has no ability to see the contents of your data (for privacy reasons).
185+
However, this makes it difficult for the AI API to generate correct filters for some queries.
186+
187+
Imagine you have a categorical `order_status` dimension with the possible values "shipped",
188+
"processing", and "completed". Without value search, asking "how many complete orders did
189+
we have today" might get you a query filtering on `order_status = 'Complete'` instead of
190+
the correct `order_status = 'completed'`.
191+
192+
To solve this, the AI API can perform "value searches" where it introspects the values in
193+
selected categorical dimensions before running a query. Value search is opt-in and dimensions
194+
must be enabled for it individually. Currently, the AI API performs value search by running
195+
Cube queries using the `contains` filter operator against one or more chosen dimensions.
196+
The LLM will select dimensions from among those you have based on the question asked and
197+
generate possible values dynamically.
198+
199+
<InfoBox>
200+
When running value search queries, the AI API passes through the security context used
201+
for the AI API request, so security is maintained and only dimensions the end user has
202+
access to are able to be searched.
203+
</InfoBox>
204+
205+
To enable value search on a dimension, set the `searchable` field to true under the `ai`
206+
meta tag, as shown below:
207+
```yaml
208+
- name: order_status
209+
sql: order_status
210+
type: string
211+
meta:
212+
ai:
213+
searchable: true
214+
```
215+
216+
Note that enabling Value Search may lead to slightly longer AI API response times when it
217+
is used but should result in significantly more accurate queries in many situations. Value
218+
Search can only be used on string dimensions.
219+
182220
### Other LLM providers
183221

184222
<InfoBox>

docs/pages/product/workspace/ai-assistant.mdx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,44 @@ to give the AI context on possible values in a categorical dimension:
9797
- completed
9898
```
9999
100+
### Value search
101+
102+
By default, the AI Assistant has no ability to see the contents of your data (for privacy reasons).
103+
However, this makes it difficult for the AI Assistant to generate correct filters for some queries.
104+
105+
Imagine you have a categorical `order_status` dimension with the possible values "shipped",
106+
"processing", and "completed". Without value search, asking "how many complete orders did
107+
we have today" might get you a query filtering on `order_status = 'Complete'` instead of
108+
the correct `order_status = 'completed'`.
109+
110+
To solve this, the AI Assistant can perform "value searches" where it introspects the values in
111+
selected categorical dimensions before running a query. Value search is opt-in and dimensions
112+
must be enabled for it individually. Currently, the AI Assistant performs value search by running
113+
Cube queries using the `contains` filter operator against one or more chosen dimensions.
114+
The LLM will select dimensions from among those you have based on the question asked and
115+
generate possible values dynamically.
116+
117+
<InfoBox>
118+
When running value search queries, the AI Assistant passes through the security context used
119+
for the AI Assistant request, so security is maintained and only dimensions the end user has
120+
access to are able to be searched.
121+
</InfoBox>
122+
123+
To enable value search on a dimension, set the `searchable` field to true under the `ai`
124+
meta tag, as shown below:
125+
```yaml
126+
- name: order_status
127+
sql: order_status
128+
type: string
129+
meta:
130+
ai:
131+
searchable: true
132+
```
133+
134+
Note that enabling Value Search may lead to slightly longer AI Assistant response times when it
135+
is used but should result in significantly more accurate queries in many situations. Value
136+
Search can only be used on string dimensions.
137+
100138
### Other LLM providers
101139

102140
See the [AI API's documentation][ref-ai-api-providers] for information on how to "bring your own" LLM.

0 commit comments

Comments
 (0)