主要内容

Write Effective Prompts for Simulink Copilot

A prompt is the text that you submit to a generative AI tool as a request to perform a task. Typically, a prompt is a question or statement that you write using natural language. In Simulink® Copilot, you submit prompts in the Ask Simulink Copilot text box in the Copilot Chat panel.

Writing an effective prompt is a prerequisite for getting an effective response from an AI tool. The process of crafting effective prompts and guiding an AI tool to generate an effective response and output is called prompt engineering. To maximize the effectiveness of Simulink Copilot, write clear and detailed prompts with precise instructions and necessary context. You might need to iterate through several prompts and responses to generate the expected output.

Consider the following best practices while writing prompts.

Be Specific

When you write a prompt, clearly specify what you want Simulink Copilot to do. Clarify vague prompts by providing detailed instructions or requirements.

For example, this prompt is vague:

How can I store design data in models?

Instead, ask Copilot to explain how to store data in a model specifying your requirements:

How can I store design data in models so that they can be shared with referenced models?

Describe Your Requirements

Provide ample descriptions of your requirements. For example, describe whether you want a high-level overview of a model or a detailed explanation of the algorithm or functionality. Describe if you want an explanation of a specific model element or a functionality.

Provide Context

Provide context in your prompt for Copilot to better understand your area of interest and requirements. For example, if you ask about the difference between curly and straight brackets, you might get a response from the MATLAB® perspective. If you want a response from the Stateflow® perspective, you need to provide the context in your prompt. For example:

What’s the difference between curly and straight brackets in the context of a Stateflow transition?

Iterate and Rewrite Prompts as Needed

If the generated response is not what you expect, rewrite your prompt by adding details and context and submit a new request.

Specify Presentation of Response

Describe in prompts how you want Copilot to present its responses. For example, you can ask Copilot to present its response as a detailed overview, a brief explanation, or a bulleted list.

  • Explain this model in 2 to 3 sentences.

  • List model functionalities in a bulleted list format.

Give Feedback and Describe Mistakes

Chat with Copilot as though it is a colleague helping you with a project. When you get a response, follow up with a prompt providing feedback to Copilot on its response. Tell Copilot which parts of the response helped you and which parts did not. If Copilot made a mistake, describe it in a follow-up prompt.

Also, send feedback on the generated responses to MathWorks® by clicking the or buttons at the very end of every response. MathWorks will use your feedback to improve future responses.

Clear Chat History

Before you start a conversation on a new topic, clear the chat history. Simulink Copilot uses the conversation history for context and can generate inaccurate responses if it connects your conversation with unrelated past topics. To get the best responses from Copilot, create separate conversations for separate topics. First, save any response valuable to you from the current conversation using these options:

  • To copy the entire chat history to the clipboard, use the button at the upper-right corner of the Copilot Chat panel.

  • To copy a specific response to the clipboard, use the button at the end of every response.

Then, to clear the chat history, click the Clear Chat button at the upper-right corner of the panel.

Try Example Prompts

Copilot provides example prompts at the start of a chat session. Try the example prompts to get started with Copilot and explore its capabilities. Here are some example prompts:

  • What are your capabilities?

  • What is happening in this model?

  • What engineering concept is implemented in this model?

Try Follow-Up Prompts

In its responses, Copilot generates follow-up prompts based on its understanding of your interests. Try the follow-up prompts to explore your area of interest.

See Also

Topics