> ## Documentation Index
> Fetch the complete documentation index at: https://domoinc-openapi-sync-dataflows.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Domo AI Playground

export const InlineImage = ({src, alt = '', height = '1.6em'}) => {
  return <img noZoom src={src} alt={alt} style={{
    display: 'inline',
    verticalAlign: 'start',
    height: height,
    margin: '0'
  }} />;
};

### Intro

The Domo AI Playground capability allows you to leverage large language models (LLMs) to use various generative AI services within the Domo platform. These services include Text-to-SQL, Text Generation, Text-to-Beast Mode, and Text Summarization.

The AI Services Playground allows you to test AI services and generate code snippets for use in other coding tools like Jupyter Notebooks.

***

### Required Grants

To use AI Playground, users must have the following grant added to their custom role. Domo admins have the grant enabled by default. To learn more about grants, see [Managing Custom Roles](/s/article/360043438973).

<Warning>
  **Use AI Services —** Allows a user to access AI services for use in Domo apps, Domo Bricks, Jupyter Workspaces, and Workflows. This grant should be given to any user who needs to use AI services but does not need to manage them.
</Warning>

### Available Services

The available AI services are described below. You can use these services in Jupyter Workspaces, Domo apps, Domo Bricks, and Workflows.

# Text-to-SQL

Text-to-SQL allows you to use natural language to prompt the system to output SQL to use on your selected DataSet. This service accepts text and DataSet metadata, such as the schema, as input and generates SQL. Templates are available if you need assistance.

In the example below, sample store revenue data is selected. The specified prompt is `What were my average sales in Idaho?`

After you select **Run**, the SQL query is provided in the **Output** field.

<Frame>
  <img alt="run prompt.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wPcX.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=768bfb90805114d35e691beb7f87690e" style={{width: 900, height: 351}} width="1600" height="624" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wPcX.jpg" />
</Frame>

Now you can copy the SQL formula into the MySQL Editor or into Magic ETL to transform the data.

You can also expand the **Code Snippet** field to view the code snippet used to find the requested SQL formula. Copy the code to use it in Jupyter (in either Python or R) or in a Domo App (in either JavaScript or cURL).

<Frame>
  <img alt="expand code snippet.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wPcc.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=0d1cf89d2ef00f8a21709a70d4632c77" style={{width: 901, height: 351}} width="1602" height="624" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wPcc.jpg" />
</Frame>

# Text Generation

Text Generation allows you to enter a natural language prompt and receive a natural language response output. There are templates available to help you generate an appropriate prompt. Multiple iterations of the prompt may be necessary to achieve the desired result.

Text Generation is powered by a Large Language Model (LLM). The checkbox labeled **Use Default Model** is automatically selected. (The current default model is ChatGPT.) If other models have been made available in your instance, you can select a different LLM. Different models likely result in slightly different outputs, and you may find that you like one model's performance over others for a specific use case.

<Frame>
  <img alt="text generation services.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wQ9W.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=b8e62b6e5430473338e18dfd04d8ffc3" style={{width: 908, height: 456}} width="1600" height="804" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wQ9W.jpg" />
</Frame>

In the example below, we are using a marketing-type text prompt, and the system has output a statement that could be used in a future marketing campaign.

<Frame>
  <img alt="text generation prompt.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wQ9v.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=7bd673ac93f577da2618058b096dab0f" style={{width: 904, height: 400}} width="1600" height="708" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wQ9v.jpg" />
</Frame>

You can also expand the **Code Snippet** field to view the code snippet used to find the requested Text Generation. Copy the code to use it in Jupyter (in either Python or R) or in a Domo App (in either JavaScript or cURL).

<Frame>
  <img alt="text generation prompt code.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wQ9l.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=17fa5112c6c09518a0263c7c0b5f69ee" style={{width: 901, height: 264}} width="1600" height="469" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wQ9l.jpg" />
</Frame>

# Text-to-Beast Mode

Text-to-Beast Mode allows you to use natural language to prompt the system to output a Beast Mode calculation to use on your selected configured data. There are templates available to help you generate an appropriate prompt.

In the example below, sample store revenue data is selected. The prompt is `What was the best revenue quarter in my data?` After you select **Run**, the output Beast Mode is provided in the **Output** field.

<Frame>
  <img alt="beast mode service prompt.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wQAF.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=c87711d022040aea3d77342f77a9856c" style={{width: 901, height: 396}} width="1600" height="703" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wQAF.jpg" />
</Frame>

Now you can copy the Beast Mode into Analyzer or a Magic ETL DataFlow to transform the data.

You can also expand the **Code Snippet** field to view the requested Beast Mode calculation. Copy the code to use it in Jupyter (in either Python or R) or in a Domo App (in either JavaScript or cURL). Learn more about [Beast Mode](https://domo-support.domo.com/s/topic/0TO5w000000ZanAGAS/beast-mode?language=en_US).

<Frame>
  <img alt="beast mode snippet.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wQAK.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=7d5eaae124e89097a7b3e194a5747e93" style={{width: 900, height: 253}} width="1600" height="450" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wQAK.jpg" />
</Frame>

# Text Summarization

Text Summarization allows you to input a text prompt and receive a summary output in natural language. The prompt template defines the type of prompt needed to get the best results. Multiple iterations of the prompt may be necessary to achieve the final result. You can use the **Configuration** and **Chunking** tabs in the right panel of the **Playground** page to define the output style.

Text Summarization is powered by a Large Language Model (LLM). The checkbox labeled **Use Default Model** is automatically selected. (The current default model is ChatGPT.) If other models have been made available in your instance, you can select a different LLM. Different models likely result in slightly different outputs, and you may find that you like one model's performance over others for a specific use case.

<Frame>
  <img alt="summarization service.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wQ6Y.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=733dc31e60aabcec236dbe60bdd31e9e" style={{width: 900, height: 400}} width="1600" height="711" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wQ6Y.jpg" />
</Frame>

In the example below, we have asked the Text Summarization service for a two-paragraph summary of the novel "The Baron in the Trees" by Italo Calvino. We have also defined the output style of paragraph, a maximum of 120 words, and a minimum of 100 words.

<Frame>
  <img alt="summary output style.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wQB3.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=d4f550889876595c5ca3b4be941739f0" style={{width: 901, height: 362}} width="1600" height="643" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wQB3.jpg" />
</Frame>

You can expand the **Code Snippet** field to view the requested text summarization. Copy the code to use it in Jupyter (in either Python or R) or in a Domo App (in either JavaScript or cURL).

<Frame>
  <img alt="summary snippet.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wQBN.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=af25f24aaefbac1dbcaaf53159ea5058" style={{width: 899, height: 272}} width="1600" height="484" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wQBN.jpg" />
</Frame>

### Access Playground

Access Playground from the navigation header by selecting **More** > **Domo AI** to display the AI landing page.

In the left sidebar, select <InlineImage src="/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EMVq000004BHJN.jpg" /> **Playground**.
The AI Playground page displays.

<Frame>
  <img alt="playground page.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wPcS.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=de17ea409bec243f369e70676ed78974" style={{width: 904, height: 309}} width="1600" height="547" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006wPcS.jpg" />
</Frame>

### Use Playground

In Playground, you can test the available AI services using the [p](#prompt_template) [rompt template](#prompt_template) and [generate code snippets](#code_snippets).

# Prompt Template

The content of the **Prompt Template** field is what is sent to the service. The content of the **Prompt** field is what is passed as {input} in the template.

To edit and test the prompt template, expand **Prompt Template**.

<Frame>
  <img alt="prompt template callout.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EMVq000004BHrF.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=66ffd835095d959a04723a30206408e1" style={{width: 899, height: 554}} width="2940" height="1812" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EMVq000004BHrF.jpg" />
</Frame>

You can edit the prompt template, add a data source in the **Configuration** tab if the [service](#available_services) requires it, and select **Run** to test the prompt template and validate the output. If no output is returned, make changes to the prompt template and re-run.

In the example below, the prompt, `Why is the sky blue?` is passed as {input} in the prompt template. In the **Output** field, you can view the results.

<Frame>
  <img alt="Screenshot 2023-08-31 at 11.18.11 AM.png" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vl04.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=7594510e7a9fa6dc823a1a1968b0d93e" style={{width: 726, height: 471}} width="2092" height="1372" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vl04.jpg" />
</Frame>

You can also select **+ New Parameter** in the **Prompt Template** and add parameters to be passed.

<Frame>
  <img alt="new parameter.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vl1C.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=09fe7810ea85fa3e2a0fa2a6c4ba795e" style={{width: 676, height: 310}} width="2072" height="950" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vl1C.jpg" />
</Frame>

In the example below, a new {color} parameter with a value of `blue` has been added to the prompt template. The prompt is now updated to `Why is the sky`, and the parameter {color} is added after the {input} in the prompt template. When the prompt template is passed, the output is the same as the earlier example, but would change if you changed the value of the {color} parameter to `green`.

<Frame>
  <img alt="sky blue.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vl0E.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=9623312e2acbc7b3aba6dea8d473f939" style={{width: 727, height: 316}} width="3150" height="1370" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vl0E.jpg" />
</Frame>

You can also make specifications for the output. In the example below, the same prompt template is passed with a specification for the response to be 10 words or fewer.

<Frame>
  <img alt="Screenshot 2023-08-31 at 11.31.12 AM.png" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vl0d.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=467b4e8568ad1b39ca435bdb74771011" style={{width: 738, height: 512}} width="2070" height="1434" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vl0d.jpg" />
</Frame>

##### Reset Prompt and Prompt Template

You can always select **Reset** for either the **Prompt** or **Prompt Template** to return to the defaults.

<Frame>
  <img alt="reset.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vkzQ.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=b031532833af82b03203386471b1dd63" style={{width: 726, height: 471}} width="2104" height="1370" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vkzQ.jpg" />
</Frame>

# Code Snippets

In Playground, code snippets are available for the following tools and languages:

* Jupyter—Python
* Jupyter—R
* DomoApp—Javascript
* cURL

To generate a code snippet in Playground, select a service to test from the **Service** dropdown, enter a specific prompt to use, and select a DataSet to run the prompt against.

<Frame>
  <img alt="playground callouts.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vkSq.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=81b8fb9a22dff3cd1d0e38d5df8e51dc" style={{width: 696, height: 351}} width="2646" height="1338" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vkSq.jpg" />
</Frame>

#### Generate Code Snippets for Jupyter Notebooks

Follow these steps in Playground to generate a Text-to-SQL service code snippet for use in Jupyter Notebooks:

1. On the **Playground** page, select Text-to-SQL in the **Service** dropdown.

2. In the **Prompt** field, enter the prompt you want the service to run.

3. Under the **Configuration** tab, select a DataSet to run the prompt against.

4. Select **Run**.

   <Frame>
     <img alt="run prompt.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vkTK.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=2328bf368a0ef1a2c5d275073b5c44df" style={{width: 675, height: 349}} width="2978" height="1542" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vkTK.jpg" />
   </Frame>

5. In the **Output** field, see the output of your prompt.

   <Frame>
     <img alt="view output.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vkTe.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=67e26abe7a084c2f75bb8a6e1afda772" style={{width: 677, height: 334}} width="2876" height="1422" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vkTe.jpg" />
   </Frame>

6. Expand the **Code Snippet** section to view the relevant Jupyter Python code.

   <Frame>
     <img src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vkTj.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=099756a8291da4b13b22f65b8cedeb1d" width="2876" height="1528" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vkTj.jpg" />
   </Frame>

   <Frame>
     <img src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vkTt.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=b630e7f36303144b58caf8f947044228" width="2870" height="1440" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vkTt.jpg" />
   </Frame>

7. (Optional) Under **Code Snippet**, use the dropdown to change the language of the code snippet or select **Copy Code** to copy the code to your machine's clipboard.

   <Frame>
     <img alt="change language.jpg" src="https://mintcdn.com/domoinc-openapi-sync-dataflows/NZY_77jeKitg9n1Q/images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vjgN.jpg?fit=max&auto=format&n=NZY_77jeKitg9n1Q&q=85&s=4e3543aa5fd364d20053ed090fb26987" style={{width: 272, height: 228}} width="828" height="694" data-path="images/kb/ka05w0000012Bh8-00N5w00000Ri7BU-0EM5w000006vjgN.jpg" />
   </Frame>
