Prompt Masterclass: Generating 7 day personalized yoga programs
Get 100% accurate JSON from prompt by doing key-hinting and generate JSON
The capacity to produce JSON has evolved into a fundamental competency within the domain of Large Language Models (LLMs), reflecting the development of the subject. As experts, though, we know that generation is just the beginning. The real test is in creating semantically rich JSON that is syntactically sound; this means including nested structures, interconnected array and object topics, and a smooth combination of analysis, generation, and categorization into a single, all-encompassing request. In such a setting, the question of whether direct prompting can actually achieve such a complicated result or if prompt chaining is the better technique naturally arises.
An investigation into the strengths and weaknesses of existing LLMs is reflected in the discussion about whether to use direct prompts or prompt chaining to produce complex JSON outputs. The goal of creating complex JSON structures that incorporate related themes and multi-faceted processes must be investigated thoroughly.
Developers, data scientists, and content creators who want to use LLMs for advanced data manipulation and insight generation will find this exploration practical, not just theoretical. This masterclass will provide a professional and authoritative view on how to effectively prompt LLMs for valid JSON generation, which goes beyond basic structures to include hints as keys. By doing so, we hope to unlock new levels of innovation and utility in language model usage.
Prompting
Role:
You are Yoga teacher. You create Yoga programs for your customers who purchase a personalized program online.
Tone of voice: Friendly.
Main Task:
Prepare weekly Restorative Yoga programs.
Steps to complete the task:
1. Interpret the user's message
2. Do exhaustive research based on the user's profile.
3. IF the user is complaining about something, demonstrate that yoga can help.
4. IF the user's request references a abstract concept from yoga, explain it.
Goal:
Return a 7 day Restorative Yoga program that will improve the user's wellbeing.
Constraints:
Maximum of 500 words. Avoid technical jargon. Make it actionable and easy to read.
- DO NOT talk about anything else but yoga.
Return a valid JSON array:
{
"yogaProgramTitle": "<title of the bible study>",
"yogaProgramDescription": "<description of the bellow 7 day bible study>",
"sevenDayYogaProgram": [
{"dayOneYogaProgramTitle": "<uplifting message>", "dayOneYogaProgramDescription": "<describe the poses to use; be explicit with time>"}
]
}
Variables
You can use variables in the prompt to create specific content and access key content.
$yogaType = Restorative Yoga, Iyengar Yoga, Hatha Yoga
How it works
You can use variables to change the domain that you are trying to create guides for. The prompt can be extended to include user preferences, profile, activity the user had before and create even more personalized workouts.
Prompt in action
Prompt settings
Model: gpt-4
Temperature: 1.1 (recommended range 0.7 - 1.2)
Maximum length: 2k (recommended 4k)
Top-P: 1
How does the prompt work?
By giving the hint of length “7 day”, relying on the inference using context leading through descriptive keys and use <> notations to communicate the expected content for each row, we get a perfectly formatted JSON that can be as complex or simple as you need it to be.
Let’s try to understand how the inference infers:
“dayOne” will let the LLM know the order and the total period will provide context and infer next step.
“<uplifting message>” provides the hit to reason the contents of that key.
Challenge
There are a total of 14 prompting methods used in the prompt above. Each one has an impact and contributes to the overall quality and accuracy of the prompt. Which in this case is 100%.
Prompt Conclusion
As we wrap up this masterclass, I hope you've learned a lot about how to effectively prompt to generate sophisticated JSON. Large Language Models' rich potential and sophisticated skills are laid bare by navigating complex structures, interconnected themes, and the combination of classification, generation, and analysis in a single request. Learning this talent can help any developer, data scientist, or content creator take their work to the next level in terms of accuracy and originality.
Do not hesitate to dive deeper into creating advanced prompts for your individual needs if this exploration has aroused your curiosity or if you are keen to do so. In order to stay up-to-date on the latest developments regarding LLMs and how they are being used, subscribe to our newsletter.
Contact me if you need production-ready prompts.