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