Jump to content

Prompt engineering: Difference between revisions

Line 14: Line 14:
Give the coding model a high-level task description. To improve the quality of the generated code, it's recommended to start the prompt with a broad description of the task at hand. For example, if you want to generate Python code to plot data from a standard [[dataset]], you can provide a prompt like this:  
Give the coding model a high-level task description. To improve the quality of the generated code, it's recommended to start the prompt with a broad description of the task at hand. For example, if you want to generate Python code to plot data from a standard [[dataset]], you can provide a prompt like this:  


<code># Load iris data from scikit-learn datasets and plot the training data.</div>
<code># Load iris data from scikit-learn datasets and plot the training data.</code>


However, sometimes the generated code may not be optimal, in which case you can provide more specific instructions such as importing libraries before using them. By combining a high-level task description with detailed user instructions, you can create a more effective prompt for coding model to generate code.
However, sometimes the generated code may not be optimal, in which case you can provide more specific instructions such as importing libraries before using them. By combining a high-level task description with detailed user instructions, you can create a more effective prompt for coding model to generate code.
370

edits