Writing Prompts
A prompt is a piece of text that is used to guide an AI model to generate a specific output. A prompt should contain key information about the target task or domain, such as the theme, style, and format.
When writing a prompt, you can set variables in it. Specifically, use placeholders {{}} in a prompt as an indication of dynamic information. In this way, the model can generate varying results based on different situations, enhancing its flexibility and adaptability. For example, the prompt can be set to "You are a travel assistant. You need to introduce the local customs of a travel place to travelers. Please introduce the local customs of {{location}}." When evaluating the prompt outcomes, you can replace the values of {{location}} in batches to obtain the model answer, improving the evaluation efficiency.
When writing a prompt, you can adjust the setting of LLM parameters such as Temperature, Top P, and Max Tokens to control how the LLM generates text. They can affect the quality and diversity of the model's generated results.
- Log in to ModelArts Studio and access a workspace.
- In the navigation pane, choose Agent Dev. On the displayed page, choose Prompt Engineering > Prompt dev.
- In the prompt engineering project list, locate the desired project and click writing in the Operation column.
Figure 1 Prompt Engineering
- Enter the prompt text in the prompt writing area. You can insert multiple variables into the prompt. The variables must be identified by placeholders {{}}.
Figure 2 Writing prompts
- Click Confirm. The platform automatically identifies the inserted variables. The variables recognized in the prompt are displayed in the Variable Definition area.
You can modify the variable name, for example, add remarks for the model to better understand the function of the variable.Figure 3 Variable Definition
The Variable Definition area displays the variables defined in the entire project, including variables associated with the candidate prompts. For details about the operations related to candidate prompts, see Setting Candidate Prompts.
A maximum of 20 variables can be defined in a prompt engineering project.
- In the Model area, click Settings to set the desired model and its parameters.
Figure 4 Model Settings
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot