Skip to content

Commit e3f1910

Browse files
Michael IrvineMichael Irvine
authored andcommitted
docs: update AI API models and providers
1 parent 1203291 commit e3f1910

File tree

1 file changed

+137
-43
lines changed

1 file changed

+137
-43
lines changed

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

Lines changed: 137 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Specifically, you can send the AI API a message (or conversation of messages) an
1313

1414
See [AI API reference][ref-ref-ai-api] for the list of supported API endpoints.
1515

16-
<YouTubeVideo url="https://www.youtube.com/embed/Qpg4RxqndnE"/>
16+
<YouTubeVideo url="https://www.youtube.com/embed/Qpg4RxqndnE" />
1717

1818
## Configuration
1919

@@ -146,7 +146,8 @@ When using `"runQuery": true`, you might sometimes receive a query result contai
146146
## Advanced Usage
147147

148148
<InfoBox>
149-
The advanced features discussed here are available on Cube version 1.1.7 and above.
149+
The advanced features discussed here are available on Cube version 1.1.7 and
150+
above.
150151
</InfoBox>
151152

152153
### Custom prompts
@@ -159,28 +160,30 @@ for example if it should usually prefer a particular view.
159160
To use a custom prompt, set the `CUBE_CLOUD_AI_API_PROMPT` environment variable in your deployment.
160161

161162
<InfoBox>
162-
Custom prompts add to, rather than overwrite, the AI API's existing prompting, so you
163-
do not need to re-write instructions around how to generate the query itself.
163+
Custom prompts add to, rather than overwrite, the AI API's existing prompting,
164+
so you do not need to re-write instructions around how to generate the query
165+
itself.
164166
</InfoBox>
165167

166168
### Meta tags
167169

168-
The AI API can read [meta tags](/reference/data-model/view#meta) on your dimensions, measures,
170+
The AI API can read [meta tags](/reference/data-model/view#meta) on your dimensions, measures,
169171
segments, and views.
170172

171-
Use the `ai` meta tag to give context that is specific to AI and goes beyond what is
173+
Use the `ai` meta tag to give context that is specific to AI and goes beyond what is
172174
included in the description. This can have any keys that you want. For example, you can use it
173175
to give the AI context on possible values in a categorical dimension:
176+
174177
```yaml
175-
- name: status
176-
sql: status
177-
type: string
178-
meta:
179-
ai:
180-
values:
181-
- shipped
182-
- processing
183-
- completed
178+
- name: status
179+
sql: status
180+
type: string
181+
meta:
182+
ai:
183+
values:
184+
- shipped
185+
- processing
186+
- completed
184187
```
185188
186189
### Value search
@@ -201,20 +204,21 @@ The LLM will select dimensions from among those you have based on the question a
201204
generate possible values dynamically.
202205

203206
<InfoBox>
204-
When running value search queries, the AI API passes through the security context used
205-
for the AI API request, so security is maintained and only dimensions the end user has
206-
access to are able to be searched.
207+
When running value search queries, the AI API passes through the security
208+
context used for the AI API request, so security is maintained and only
209+
dimensions the end user has access to are able to be searched.
207210
</InfoBox>
208211

209212
To enable value search on a dimension, set the `searchable` field to true under the `ai`
210213
meta tag, as shown below:
214+
211215
```yaml
212-
- name: order_status
213-
sql: order_status
214-
type: string
215-
meta:
216-
ai:
217-
searchable: true
216+
- name: order_status
217+
sql: order_status
218+
type: string
219+
meta:
220+
ai:
221+
searchable: true
218222
```
219223

220224
Note that enabling Value Search may lead to slightly longer AI API response times when it
@@ -224,42 +228,132 @@ Search can only be used on string dimensions.
224228
### Other LLM providers
225229

226230
<InfoBox>
227-
These environment variables also apply to the [AI Assistant](/product/workspace/ai-assistant),
228-
if it is enabled on your deployment.
231+
These environment variables also apply to the [AI
232+
Assistant](/product/workspace/ai-assistant), if it is enabled on your
233+
deployment.
229234
</InfoBox>
230235

231236
If desired, you may "bring your own" LLM model by providing a model and API credentials
232237
for a supported model provider. Do this by setting environment variables in your Cube
233-
deployment. See below for required variables by provider (required unless noted):
238+
deployment.
239+
240+
- `CUBE_CLOUD_AI_COMPLETION_MODEL` - The AI model name to use (varies based on provider). For example `gpt-4o`.
241+
- `CUBE_CLOUD_AI_COMPLETION_PROVIDER` - The provider. Must be one of the following:
242+
- `amazon-bedrock`
243+
- `anthropic`
244+
- `azure`
245+
- `cohere`
246+
- `deepseek`
247+
- `fireworks`
248+
- `google-generative-ai`
249+
- `google-vertex-ai`
250+
- `google-vertex-ai-anthropic`
251+
- `groq`
252+
- `mistral`
253+
- `openai`
254+
- `openai-compatible` (any provider with an OpenAI-compatible API; support may vary)
255+
- `together-ai`
256+
- `x-ai`
257+
258+
See below for required variables by provider (required unless noted):
234259

235260
#### AWS Bedrock
236261

237262
<WarningBox>
238-
The AI API currently supports only Anthropic Claude models on AWS Bedrock. Other
239-
models may work but are not fully supported.
263+
The AI API currently supports only Anthropic Claude models on AWS Bedrock.
264+
Other models may work but are not fully supported.
240265
</WarningBox>
241266

242-
- `CUBE_BEDROCK_MODEL_ID` - A supported [AWS Bedrock chat model](https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html), for example `anthropic.claude-3-5-sonnet-20241022-v2:0`
243-
- `CUBE_BEDROCK_ACCESS_KEY` - An access key for an IAM user with `InvokeModelWithResponseStream` permissions on the desired region/model.
244-
- `CUBE_BEDROCK_ACCESS_SECRET` - The corresponding access secret
245-
- `CUBE_BEDROCK_REGION_ID` - A supported AWS Bedrock region, for example `us-west-2`
267+
- `CUBE_CLOUD_AI_AWS_ACCESS_KEY_ID` - An access key for an IAM user with `InvokeModelWithResponseStream` permissions on the desired region/model.
268+
- `CUBE_CLOUD_AI_AWS_SECRET_ACCESS_KEY` - The corresponding access secret
269+
- `CUBE_CLOUD_AI_AWS_REGION` - A supported AWS Bedrock region, for example `us-west-2`
270+
- `CUBE_CLOUD_AI_AWS_SESSION_TOKEN` - The session token (optional)
271+
272+
#### Anthropic
273+
274+
- `CUBE_CLOUD_AI_ANTHROPIC_API_KEY`
275+
- `CUBE_CLOUD_AI_ANTHROPIC_BASE_URL` - uses a different URL prefix for API calls, such as if you are using behind a proxy (optional)
276+
277+
#### Microsoft Azure OpenAI
278+
279+
- `CUBE_CLOUD_AI_AZURE_RESOURCE_NAME`
280+
- `CUBE_CLOUD_AI_AZURE_API_KEY`
281+
- `CUBE_CLOUD_AI_AZURE_API_VERSION` (optional)
282+
- `CUBE_CLOUD_AI_AZURE_BASE_URL` (optional)
283+
284+
#### Cohere
285+
286+
- `CUBE_CLOUD_AI_COHERE_API_KEY`
287+
- `CUBE_CLOUD_AI_COHERE_BASE_URL` - uses a different URL prefix for API calls, such as if you are using behind a proxy (optional)
288+
289+
#### DeepSeek
290+
291+
- `CUBE_CLOUD_AI_DEEPSEEK_API_KEY`
292+
- `CUBE_CLOUD_AI_DEEPSEEK_BASE_URL` - uses a different URL prefix for API calls, such as if you are using behind a proxy (optional)
293+
294+
#### Fireworks
295+
296+
- `CUBE_CLOUD_AI_FIREWORKS_API_KEY`
297+
- `CUBE_CLOUD_AI_FIREWORKS_BASE_URL` - uses a different URL prefix for API calls, such as if you are using behind a proxy (optional)
298+
299+
#### Google Generative AI
300+
301+
- `CUBE_CLOUD_AI_GOOGLE_GENERATIVE_AI_API_KEY`
302+
- `CUBE_CLOUD_AI_GOOGLE_GENERATIVE_AI_BASE_URL` - uses a different URL prefix for API calls, such as if you are using behind a proxy (optional)
246303

247-
#### GCP Vertex
304+
#### GCP Vertex AI
248305

249306
<WarningBox>
250-
The AI API currently supports only Anthropic Claude models on GCP Vertex. Other
251-
models may work but are not fully supported.
307+
See <Btn>Google Vertex AI (Anthropic)</Btn> below if using Anthropic models
252308
</WarningBox>
253309

254-
- `CUBE_VERTEX_MODEL_ID` - A supported GCP Vertex chat model, for example `claude-3-5-sonnet@20240620`
255-
- `CUBE_VERTEX_PROJECT_ID` - The GCP project the model is deployed in
256-
- `CUBE_VERTEX_REGION` - The GCP region the model is deployed in, for example `us-east5`
257-
- `CUBE_VERTEX_CREDENTIALS` - The private key for a service account with permissions to run the chosen model
310+
- `CUBE_CLOUD_AI_GOOGLE_VERTEX_PROJECT`
311+
- `CUBE_CLOUD_AI_GOOGLE_VERTEX_LOCATION`
312+
- `CUBE_CLOUD_AI_GOOGLE_VERTEX_CREDENTIALS`
313+
- `CUBE_CLOUD_AI_GOOGLE_VERTEX_PUBLISHER` - defaults to `google`; change if using another publisher (optional)
314+
315+
#### GCP Vertex AI (Anthropic)
316+
317+
- `CUBE_CLOUD_AI_GOOGLE_VERTEX_ANTHROPIC_PROJECT`
318+
- `CUBE_CLOUD_AI_GOOGLE_VERTEX_ANTHROPIC_LOCATION`
319+
- `CUBE_CLOUD_AI_GOOGLE_VERTEX_ANTHROPIC_CREDENTIALS`
320+
- `CUBE_CLOUD_AI_GOOGLE_VERTEX_ANTHROPIC_PUBLISHER` - defaults to `anthropic`; change if using another publisher (optional)
321+
322+
#### Groq
323+
324+
- `CUBE_CLOUD_AI_GROQ_API_KEY`
325+
- `CUBE_CLOUD_AI_GROQ_BASE_URL` - uses a different URL prefix for API calls, such as if you are using behind a proxy (optional)
326+
327+
#### Mistral
328+
329+
- `CUBE_CLOUD_AI_MISTRAL_API_KEY`
330+
- `CUBE_CLOUD_AI_MISTRAL_BASE_URL` - uses a different URL prefix for API calls, such as if you are using behind a proxy (optional)
258331

259332
#### OpenAI
260333

261-
- `OPENAI_MODEL` - An OpenAI chat model ID, for example `gpt-4o`
262-
- `OPENAI_API_KEY` - An OpenAI API key (we recommend creating a service account for the AI API)
334+
- `CUBE_CLOUD_AI_OPENAI_API_KEY`
335+
- `CUBE_CLOUD_AI_OPENAI_ORGANIZATION` - (optional)
336+
- `CUBE_CLOUD_AI_OPENAI_PROJECT` - (optional)
337+
- `CUBE_CLOUD_AI_OPENAI_BASE_URL` - uses a different URL prefix for API calls, such as if you are using behind a proxy (optional)
338+
339+
#### OpenAI Compatible Providers
340+
341+
<InfoBox>
342+
Use this provider if your provider is not listed on this page but provides an
343+
OpenAI compatible endpoint. Not all providers/models are supported.
344+
</InfoBox>
345+
346+
- `CUBE_CLOUD_AI_OPENAI_COMPATIBLE_API_KEY`
347+
- `CUBE_CLOUD_AI_OPENAI_COMPATIBLE_BASE_URL`
348+
349+
#### Together AI
350+
351+
- `CUBE_CLOUD_AI_TOGETHER_API_KEY`
352+
- `CUBE_CLOUD_AI_TOGETHER_BASE_URL` - uses a different URL prefix for API calls, such as if you are using behind a proxy (optional)
353+
354+
#### xAI (Grok)
263355

356+
- `CUBE_CLOUD_AI_X_AI_API_KEY`
357+
- `CUBE_CLOUD_AI_X_AI_BASE_URL` - uses a different URL prefix for API calls, such as if you are using behind a proxy (optional)
264358

265-
[ref-ref-ai-api]: /product/apis-integrations/ai-api/reference
359+
[ref-ref-ai-api]: /product/apis-integrations/ai-api/reference

0 commit comments

Comments
 (0)