Find your template, checklist or other download to help you in you tasks.
Find your way to be trained or even get certified in TMAP.
Start typing keywords to search the site. Press enter to submit.
The CRAFTING AI prompts framework [Egelmeers 2023] is designed to empower users in effectively utilizing various large language models (LLMs) or diffusion models like ChatGPT, Microsoft Copilot, Claude and Gemini for diverse writing and engagement tasks while ensuring ethical and responsible use. It consists of three essential phases: CRAFT, ING, and AI.
In the Crafting Phase, we will focus on writing the prompt. To create an effective prompt, we need to consider a few key factors. First, define your goal: what do you want to achieve? It’s important to remember not to include any confidential or personal data. Also, it helps to build reference points in your prompt so you can navigate back and forth during your conversation.
Before you start crafting prompts and using Generative AI, it’s a good idea to first validate whether the use case you’re trying to solve is actually suitable and valuable to tackle with Generative AI. We’ve seen a lot of organizations think about use cases and then see Generative AI as “the holy grail”, just like we’ve seen before with applications. “We can build an app for that” changed to “Generative AI can help us with that”. However, not all use cases are valuable to solve with Generative AI, and you may encounter limitations within this technology. Keep that in mind.
When crafting prompts it’s important to consider the below components. Each component will help you bring the right information to the model to get the right output.
When we have a clear objective, it is important to describe the context in which we are operating. For instance, when discussing test cases, it is essential to specify the feature being tested. Additionally, if there are relevant documents or files, they should be clearly identified or referenced to ensure the model is enhanced with accurate data. Providing precise context for our work is crucial. The more explicit you are, the better the output will be. Furthermore, it may be necessary to include additional context as needed. For example, when discussing events not yet included in the training data, this information should be added to your prompt to ensure the model has the appropriate context.
A good practice, especially if you’re having difficulty outlining the context yourself, is to start by describing the task and then ask the model to generate clarifying questions. By answering those questions, you can incrementally build up the context window with relevant information, helping the model better understand your subject.
Register refers to the desired writing style, tone, language (such as English, Dutch, German, or French), and language proficiency level (A2, B1, C2) for the model’s output.Creating a register tailored to different tasks can be beneficial. For instance, if an organization creates social media content, developing a writing style guide can help ensure consistency in communication across the team. Similarly, this approach can be applied to coding by outlining the programming languages used and establishing coding style guides for uniformity.It is important to recognize that cultural differences may influence model outputs. The majority of these tools are primarily trained on US-based data, potentially resulting in a tone that reflects American norms. For instance, requests for an enthusiastic tone may yield responses characteristic of “US-style” enthusiasm, which may differ from the standards you intend to adopt.
Another great way to share or find your register is by using examples (such as by using shot prompting). For instance, if you’ve already written similar content that you want the model to output, you can give it your previously created content as an example. Please be aware that using this may also bring along other elements from your content. If you’re using metaphors in your content, it might continue using similar, or even the same ones, in all your newly created content. A more sophisticated approach involves asking the model to determine your register based on previous outputs and progressively improve it to utilize it as your register component.
Acting Role or Persona is all about the identity you assign to the model. Tools such as ChatGPT have system prompts that give them a defined role or identity. For instance, if you ask ChatGPT who it is, it might respond with “ChatGPT created by OpenAI.” This identity is part of its system prompt. By assigning specific roles, you can guide the model towards a particular task effectively. For example, if you want to write tests, you can set the model to act as an experienced tester. The more specific the role, the better the output will be.
Creating personas is another useful application of the Acting Role component. You can ask the model to generate a basic persona and then enhance it according to your needs. This persona can be used for various use cases. For instance, create a persona of your team as a Product Owner to validate user stories based on the team’s priorities. This approach can help eliminate many discussions during the refinement process and streamline decision-making.
Acting roles are important to narrow the output. Models are trained on a lot of data, and by specifying a role, you’re narrowing the data towards a specific part of the training data that is relevant for your specific task. This precision can significantly enhance the relevance and quality of the output, ensuring that it aligns closely with the desired outcomes. Also, as most system prompts for agents describe the tools’ identity, this can also be the starting point of creating agents.
Again, cultural difference can play a huge role in the output when using acting roles. Keep that strictly in mind when using them. Basic instructions (such as: “act as an experienced LinkedIn expert”) may result in typical use cases or behavior, including very enthusiastic posts with numerous emoticons. Being more specific about the role will yield better outcomes. For instance, it is important to include specific details about your objectives and the guidelines to follow in the acting role to achieve more accurate results (such as starting the post with a compelling hook that evokes emotion and adding a clear call to action that achieves the desired outcome based on your audience). The objective is to refine the available data to meet the requirements of your team, rather than concentrating on a particular task (which will be addressed in the task component).
The Format component defines how the model should structure its output. Most use cases benefit from a clearly defined format, whether that’s a table, a bulleted list, a specific layout, or a reusable template. The more specific you are, the more reliably the model can generate consistent and usable results.
For example, you might define a simple content template with variables like:
This tells the model to output a hook, then a line break, then a description, and finally a call to action, always in that order.
When your output involves calculations, it’s important to remember that LLMs are not built for precise numeric reasoning, they’re prediction machines, not calculators. That’s why, in these cases, it’s better to include programming logic in your format instructions.
“Write a Python script that calculates the total cost, then output the result.”
This approach plays to the model’s strengths in generating code while ensuring accurate and trustworthy numerical results. Always be explicit about the programming language and the desired output format.
Ultimately, it is important to define a clear objective for the model. The assigned task should be tailored to the specific model and use case, with appropriate levels of detail. For instance, reasoning models, those capable of supplementing the context window by decomposing tasks and applying logical processes, may require less detailed instructions than models lacking reasoning capabilities. Nevertheless, it is essential to consider that even these models can infer or generate components not explicitly outlined in the prompt, potentially resulting in unintended outputs.
Make sure to limit the prompt to one task per prompt for the maximum outcome. Small, focused tasks enhance a model’s overall performance. When coding, it is important to create a step-by-step guide to lead the model through the task for the best outcome. We’ll discuss this in the coding section.
If there are any restrictions relevant to the task, specify them clearly. For instance, if there are topics, styles, or perspectives that should be avoided or emphasized, make sure to exclude things that might not be of interest. However, keep these restrictions limited, and primarily focus on guiding the model on what it should do.
Finally, a single word can make a significant difference. One of the key challenges is selecting the word that most accurately conveys what you’re trying to achieve. A helpful practice is to ask the model itself for suggestions, this can often guide you toward more precise or impactful wording.
The Validation Phase is crucial as it ensures the integrity, relevance, and confidentiality of the prompt. During this phase, we first evaluate the prompt itself to ensure it matches our initial discussions in the Crafting Phase.
This includes checking whether the prompt is interactive (I: Interactive) and contains appropriate reference points. For example, when generating a table, by starting each row with a “unique ID”, we can easily refer to a specific row when required by just pointing to the ID.
Additionally, it is necessary to ensure that no confidential or personal data (N: Non-Disclosure) is present in the prompt to protect privacy and uphold trust, especially in an open environment. If needed, confidential data should be replaced with placeholders (such as {{placeholder}}), which can be updated with actual data later. Also, when working within a secure environment set up by your organization, double-check that you’re actually operating within that environment. We’ve seen several cases where employees unintentionally used personal accounts instead of company-managed ones, missing out on proper data protection measures.
Furthermore, we confirm that the prompt is goal-driven (G: Goal-Driven) and aligns with the objectives set at the beginning of the process. This alignment is essential for achieving the desired outcomes when the prompt is processed by the model. Once the prompt meets these criteria, it can be sent to the model for processing.
Once the model produces an output, it is essential to validate the results to ensure they meet established requirements and objectives. This includes confirming that outputs are accurate and free from confabulations. The validation of references is particularly critical for areas such as legal or technical subjects. Numerous cases demonstrate the risks associated with insufficient validation, where fabricated information has been accepted as factual.
Now that the prompt and the output are validated, we can move to the Enhancement Phase. During this phase there are two options:
We have achieved our objective, and the results align with our expectations. In this scenario, our aim is to adapt our strategies (A: Adapt) and determine if it is possible to utilize any elements (such as the register) from the Crafting Phase for other prompts. By storing prompts as components in a library, they can be used across the organization. For instance, if there are team-wide agreements on how code should be written, such guidelines can be stored in a “Register” component. This allows others within the organization to utilize the same register in their prompts.
If the output does not meet our expectations, is not at the quality level we require, or does not achieve our goal, we will return to the Crafting Phase and continue refining (I: Improve) our prompts. It is not necessary to use every element of the framework from the Crafting Phase again; instead, we should utilize only those elements that will enhance the output and help us reach our objective. The previous input and output remain part of the context window (each chat constitutes one context window). If the output significantly diverges from our expectations, or if we approach the limits of the context window size, it may be advisable to start a new chat, thereby creating a new context window to manage our context window correctly. If specific parts of the output are valuable, we can ask for a summary, or get the right context from the output manually, to bring that to the new context window.This is an iterative process: we continue to refine, adapt, and improve until we achieve our goal.
.
An example of what the prompt can look like:
If you prefer using a template or employing them as components(so you can store them also as components instead of full prompts)using markdown is also viable and will yield the same results:
Besides the options mentioned above, using an XML structure is another approach. It clearly defines when a component starts (<component>) and ends (</component>), making this structure straightforward for both users and models. For instance, if there are questions within your component, they will not be triggered as tasks. This can also be referenced throughout a prompt by stating: “Act like <acting role>”, as an example.This method is considered a suitable and systematic way to promptaccording to the framework. It also works best when using components, as each component (such as <register>) can be saved as a stand-alone element and reused across other prompts.
You can use this by starting your prompt with a variation of the initial basic prompt, to refer to the components defined here.For example: ‘Act as <acting role> to perform <task>, in <format>, using <register>, and applying this <context>.’However, when the XML is structured correctly, this explicit phrasing is not required, the XML itself is sufficient for the model to understand the intended behavior.
Note: The order of the components isn’t fixed. Structure your prompt in a way that feels natural and easy to follow. That’s also why, in some of the examples, we haven’t strictly followed the same component order.
Overview