Updated on 2025-05-20 GMT+08:00

Configuring Prompts

Prompts are user inputs to the large model, which generates corresponding outputs based on these prompts. Configuring prompts can guide the model to understand users' specific needs and generate more accurate and high-quality outputs, ensuring the model's responses meet the application requirements in different scenarios. This section describes how to configure prompts for the intelligent analysis assistant to improve its Q&A quality.

Notes and Constraints

  • You must have developer or administrator permissions to configure and manage prompts.

Prerequisites

Configuring Prompts

  1. Log in to the DataArts Insight console.
  2. Click in the upper left corner of the management console to select a region. Then, select an enterprise project in the upper right corner.
  3. On the top menu of the console, click Project. On the displayed My Projects page, click the name of the desired project.
  4. In the navigation pane on the left, choose Q&A Management > Intelligent Analysis Assistants.
  5. Locate your desired assistant and click Edit in its Operation column. On the displayed page, click the Assistant Settings tab (Figure 1).
  6. Select the default prompt from the NL2SQL Prompt Template and Intelligent Insights Prompt Template drop-down lists.

    The prompts in the drop-down lists are those added in prompt management.

  7. Click Save.
    Figure 1 Prompt template

Managing Prompts

  1. On the top menu of the console, click Project. On the displayed My Projects page, click the name of the desired project.
  2. In the navigation pane on the left, choose Q&A Management > Prompt Management.
  3. Click Add Prompt. The page for adding a prompt is displayed.
  4. Set the parameters based on Table 1.
    Figure 2 Creating a prompt

    Table 1 Parameters for creating a prompt

    Parameter

    Description

    Task Type

    NL2SQL (natural language to SQL): converts user input in natural language to SQL queries, improving data query efficiency.

    INSIGHT: generates corresponding insights based on user queries and the resulting data.

    System Prompt

    Assigns an identity tag to the model, predefining its behavior and style to help the model respond more appropriately to questions or generate content based on this setting.

    Prompt

    A prompt is an input text that guides the model to understand the task requirements and generate specific outputs, helping the model respond more accurately to user needs.

    NOTE:

    To ensure the model's normal reasoning, the prompt must include "required" placeholders as detailed in Figure 2.

  5. Click Save in the upper right corner of the page. The prompt is created successfully.

    You can click Reset in the upper right corner of the page to revert to the last saved content.

    • Copying a prompt: On the prompt management page, click Copy. On the displayed page, click OK.
    • Editing a prompt: On the prompt management page, click Edit. On the displayed page, set parameters and click Save.
    • Deleting a prompt: On the prompt word management page, click Delete. On the displayed page, click OK.

Example Scenario

By creating a prompt for sales data of a product, you can customize the prompt information for the large model in that scenario. By selecting the appropriate placeholders, you can flexibly inject query-related information into the prompt, such as query-related data fields (schema). Specific prompts allow the intelligent analysis assistant to better understand your needs and provide more accurate analysis results.

  1. On the top menu of the console, click Project. On the displayed My Projects page, click the name of the desired project.
  2. In the navigation pane on the left, choose Q&A Management > Prompt Management.
  3. Click Add Prompt. The page for adding a prompt is displayed.
  4. Configure the prompt based on the actual situation. This example configures the prompt based on the data in Table 2.
    Example prompt template:
    
    schema
    {{schema}}
    {{date_info}}
    Requirements
    1. If grouping and aggregation are used, use group by.
    2. Prefer using schema fields and keep it concise.
    3. Strictly follow the field description information.
    4. The time field must be of date type.
    {{date_constraints}}
    Based on the above schema{{date_info_instruction}} and requirements, use MySQL syntax to solve the following problem:
    {{user_input}}
    {{time_instruction}}
    
    Example sales data prompt:
    schema
    [{'table_name': '`my_table`', 'table_description': '', 'columns': [['`product_type`', 'TEXT', 'product type'], ['`pay_time`', 'date', 'payment time, format: yyyy-mm-dd'], ['`sales`', 'double', 'sales']]}]
    Time information
    It is now January 2025, and today is 2025-01-02.
    Requirements
    1. If grouping and aggregation are used, use group by.
    2. Prefer using schema fields and keep it concise.
    3. Strictly follow the field description information.
    4. The time field must be of date type.
    When using the 'sales' field, use the following time field: pay_time.
    Based on the above schema, time information, and requirements, use MySQL syntax to solve the following problem:
    The time range for June 30, 2023, is ['2023-06-30 00:00:00', '2023-06-30 23:59:59'].
    Table 2 Example of sales data

    Field

    Type

    Description

    id

    int

    ID

    sale_price

    int

    Sales price

    sales

    int

    Sales amount

    pay_time

    int

    Payment time

    product_name

    string

    Product name

    product_type

    string

    Product type