Lesson 4

Extending Text with Precision: Changing Specific Details


Welcome to this next lesson in Prompt Engineering for Precise Text Modification, where we focus on the intriguing task of extending text while deliberately altering specific elements, or "X." This task demonstrates the power and flexibility of Large Language Models (LLMs) in processing and generating content. Not only does the content follow the original narrative or message, but it also incorporates precise changes as dictated by the user. This lesson aims to equip you with strategies for achieving nuanced modifications without derailing the intended direction or purpose of the text.

Understanding the Task of Extending While Changing X

Extending text involves adding content to an existing piece of text to make it longer or more detailed. The critical twist here is the deliberate change of certain specifics — dubbed as "X." This change could relate to various elements such as the tone, a character's emotion in a story, specific details in a description, or factual information, among others. The challenge and skill lie in making these changes seamlessly, preserving the integrity and coherence of the original text, while integrating the desired new direction or elements.

Let's explore how we can precisely instruct an LLM to perform this task.

Step-by-Step Prompt Design
  • Identifying "X" - first, clearly identify the "X" or specific element you want to change. Being explicit about this in your prompt helps the LLM understand the extent and nature of the modification required.
  • Setting the Extension Parameters - define how much you want to extend the text and in what manner next. This could involve specifying the word count, the direction of the narrative, or the addition of new themes or information.
  • Providing Context - including the original text or a snippet of it within the prompt is crucial. It provides the LLM with a base from which to work, and helps ensure that the extension is coherent with the original text.
  • Crafting Your Prompt - combine all of the above elements into a structured prompt that is clear and concise. Use the MPF (Markdown Prompts Framework) for clarity and structure.
Example Prompt:
1__ASK__ 2Extend the given text by adding new content, ensuring to change specific details as directed. 3 4__CONSTRAINTS__ 5- Change the following elements when extending: 6 1. The time of day (from night to dawn). 7 2. The main character's emotion (from fear to determination). 8- The extension should add a narrative shift that reflects these changes, with at least 200 words. 9- Keep the genre and the primary story arc consistent with the original. 10- Introduce at least one new character who plays a pivotal role in the story progression. 11 12__CONTEXT__ 13- The original text is from a thriller novel where the protagonist, after evading capture all night in a dense urban environment, finds a momentary refuge. 14____ 15Given Text: 16With the cover of darkness surrounding him, Alex hid in the shadow of an abandoned storefront, the sounds of his pursuers' footsteps fading into the distance. Fear gripped him tightly, knowing that discovery meant certain capture. The night, his only ally, offered scant comfort. 17----

Once again the key is in the __CONSTRAINTS__ section where we clearly outline what we expect from the model output.

On To Practice

Successfully extending text while changing specific elements requires a balance between creativity and precision in prompt design. It showcases the potential of LLMs to work within detailed parameters to generate content that is both new and seamlessly integrated with the original text. Whether it's creative writing, academic research, or content creation, mastering this technique opens up vast possibilities for text manipulation and enhancement. Practice with different types of extensions and modifications to refine your skills and discover the full breadth of what you can achieve with prompt engineering.

Enjoy this lesson? Now it's time to practice with Cosmo!

Practice is how you turn knowledge into actual skills.