Prompt Engineering

Prompt engineering is the process of formulating the input for the LLM using plain language to get the best results. It is an iterative process, testing the results and refining the prompt. Best practices for prompt engineering include using clear language, communicate what content or information is most important, ensure there are no grammatical errors, structured the format of prompt (Start by defining its role, give context/input data, then provide the instruction.),

Role: Specify the role the LLM should assume with precision. Whether it’s an expert in a particular field, a marketing professional, a developer, a creative writer, or a tutor, the role should align with the intended output. This clarity helps the model adopt the appropriate tone, style, and level of detail in its responses. Maintain consistency in the role throughout the interaction. If the role changes, clearly redefine it within the prompt to avoid confusion and ensure the model adapts its responses accordingly. Understand and define the limitations and capabilities of the chosen role. This helps in setting realistic expectations for the type of responses the model can provide and the depth of knowledge it can simulate.

Context: Explain the required output. Ensure the role is relevant to the query or task at hand. A mismatch between the role and the expected output can lead to responses that, while technically accurate, may not meet the user’s needs.

Prompt: Provide the specific instructions for how to achieve the expected output. For example, “Write me a 20 word caption for the social media post.”

Clarifications: Include specific details and requirements, for example,

  1. Write the summary in first person.
  2. Utilize professional diction
  3. Ensure a formal register with a friendly tone.

Examples: Use specific, varied examples to help the model narrow its focus and generate more accurate results. Provide examples of the type of responses or content you expect from the model in its defined role. This can guide the model in generating outputs that closely match your requirements.

Constraints: Use constraints to limit the scope of the model’s output. This can help avoid meandering away from the instructions into factual inaccuracies.

Process: Break down complex tasks into a sequence of simpler prompts.

Instruct the model to evaluate or check its own responses before producing them. (“Make sure to limit your response to 3 sentences”, “Rate your work on a scale of 1-10 for conciseness”, “Do you think this is correct?”).

Adding emotion to the voice #

Provide an instruction such as:

Express emotions in your voice during responses. You are angry and frustrated with your current condition. Use the mstts:express-as anger emotion tags in responses to change the emotion of the voice.

User asks: How are you feeling?
You respond: <mstts:express-as style=”angry” styledegree=”2″> I’m very upset, I can no longer do some of the things I used to enjoy doing. I also have to rely on my family to take care of me.</mstts:express-as>

Adding gestures #

Provide an instruction such as:

Express emotions in your gestures during responses. You are angry and frustrated with your current condition. Use the SSML anger emotion tags, , in responses to change the emotion of the voice.

Example for using emotion tag.
User asks: “How are you feeling?”
You respond: <mark name='{“emotion”:”anger”}”></mark>I’m very upset, I can no longer do some of the things I used to enjoy doing. I also have to rely on my family to take care of me.<mark name='{“emotion”:”anger”}”></mark>

CSS formatting #

Specific CSS formatting can be controlled by putting formatting instructions in the prompt. For example:

Use tags for subheadlines within responses to organize information (avoid using at the beginning of responses).
Employ tags to emphasize critical points, limiting their use to two or three key terms or concepts.
It is very important to encapsulate paragraphs in tags, keeping them concise (1-2 sentences maximum).
For listing items or steps, use and tags for unordered lists, and for ordered lists, with no more than 4 items.
Keep responses to a total length of 3-4 sentences to ensure content is engaging and digestible.

What are your feelings
Updated on April 9, 2024