Skip to main content
Prompt

Prompt template overview

Prompt templates let you separate the fixed structure of a prompt from its dynamic variables, creating reusable templates for unified management, optimization, and efficient prompt generation.

This topic is applicable only to the Singapore region.

Workflow

  1. Create a template: Create and save a template in the Model Studio console or by using an API to obtain a unique template ID.
  2. Retrieve the template: Use the API and the template ID to retrieve the template content.
  3. Generate a prompt: Fill in the template variables with your business data to generate the final prompt.
  4. Use the template: Send the generated prompt to the target model to get results.

Template types

Prompt templates fall into two categories: built-in prompt templates and custom prompt templates.

Dimension

Built-in

Custom

Source

Provided by Model Studio to cover a wide range of business scenarios.

Users create them in the console or by using an API.

Effectiveness

Pre-optimized to ensure stable performance.

Effectiveness depends on the quality of your design and testing.

Usability

Ready to use without additional development. You can call them directly from the console or by using an API.

May require multiple iterations of refinement. You must be familiar with prompt design principles and optimization methods, such as providing clear instructions, few-shot examples, and format constraints. Basic development and technical skills are also required.

Common scenarios

  • General-purpose scenarios, such as creative copywriting and office assistance.

  • Users with limited experience in prompt design.

  • Complex or specific business scenarios, such as financial risk assessment or medical consulting.

  • Scenarios with strict output format requirements, such as JSON or lists.

Editable

No.

Yes. You can modify templates based on your needs.

Built-in prompt templates

1. View templates

On the Prompts page, you can view and use the built-in prompt templates that Model Studio provides for different scenarios. Each prompt template is shown on a card that displays a content preview and its template ID. The card includes buttons for View Details, Copy prompt, and more actions (...).
image

2. View and manage templates

View: Click View Details on a template card to view its name, content, variables, ID, and other information. Manage:
  • Click Copy Prompt to copy the template content.
  • Click ... > Create Application. The template content is automatically populated in the prompt editor for the Agent Application. You can use the content as-is or modify it based on your business scenario. The populated prompt contains the custom variables ${number} and ${content} for generating content in the Xiaohongshu style.
    image
  • Click ... > Copy Template to create a custom prompt template on the Prompts page. The new template is named "Built-in Prompt Template Name_Copy_Timestamp". The copied template card displays a preview of the template content and the template ID (click the icon on the right to copy it). The bottom of the card provides buttons for Edit, Copy prompt, and more actions.
    image

Custom prompt templates

1. Create a template

You can create custom prompt templates in the console or by using an API.
  • Console
  • API
  • Modify a built-in prompt template On a built-in prompt template card, click ... > Copy Template to create a copy named "Built-in Prompt Template Name_Copy_Timestamp".
  • Create a template based on your business needs On the Prompts page, click Create Prompt. After you complete the configuration, click Save to create the template. On the prompt template management page, you can find existing templates by using the type filters (All, Text Generation, and Image Generation) or the search bar. Click + Create Prompt in the upper-right corner to create a new prompt template. Created templates are displayed as cards that show the template title, a content preview, and the template ID, with options to Edit and Copy prompt.

2. View and manage templates

View: After you create a custom prompt template, you can view it on the Prompts page. Manage:
  • Click Modify on a template card to change its content.
  • Click Copy Prompt to copy the template content.
  • Click ... > Create Application. The template content is automatically populated in the prompt editor for the Agent Application. You can use the content as-is or modify it based on your business scenario.
  • Click ... > Copy Template to create a copy on the current page named "Custom Prompt Template Name_Copy_Timestamp".
  • Click ... > Delete to delete the template.

Use prompt templates

  • Console
  • API
  • SDK
  1. Click Use Prompt > Create Application on a built-in or custom prompt template card. The template content automatically populates the prompt field of the Agent Application. Template variables, such as ${name}, are visible in the prompt input box. A character counter in the lower-right corner shows the current count, with a maximum of 6,144 characters.
    image
  2. Set a model for the application and enter a question to test the prompt. On the left side of the model debugging page, select a model, such as Qwen-Plus-Latest 128K, and write system instructions in the prompt area. On the right side, enter a test question in the user input area and click Run. The model's response and token statistics for the input and output are displayed below.

Error codes

If a call fails and an error message is returned, see error codes to resolve the issue.

FAQ

Q: What is the difference between calling theGetPromptTemplateAPI and concatenating strings directly in your code? A: Using the GetPromptTemplate API to manage prompts offers the following advantages:
  • Separate logic from content: You can update and optimize prompt content in the Model Studio console without modifying or redeploying your application code.
  • Centralized management and collaboration: Storing all prompts in a central location makes it easy for teams, such as prompt engineers and developers, to collaborate, manage versions, and reuse templates.
  • Consistency: Ensures the same prompt version and structure are used across different parts of your application or between different services, which avoids inconsistencies caused by manual maintenance.