BetterPrompt is an experimental tool designed to demonstrate how refining a vague prompt into a clear, structured format can drastically improve the quality of responses generated by large language models (LLMs), such as LLama.
By simulating multi-step reasoning and automatic prompt enhancement, BetterPrompt shows how to unlock richer, more relevant, and more actionable AI outputs — with minimal user effort.
Many users struggle to get the most out of LLMs simply because their prompts are too vague. BetterPrompt takes a basic user prompt and applies several steps:
- Generates an initial answer using the original input
- Creates a "Perfect Prompt" with a detailed structure (goal, format, context, warnings)
- Rewrites the perfect prompt into a natural form and improves it further
- Sends the final version to the LLM for an enhanced answer
- Optionally compares both answers
"voglio avere un alimentazione bilanciata" (Italian Prompt)
Ottima scelta!
Avere un'alimentazione bilanciata è fondamentale per mantenere una buona salute fisica e mentale. Ecco alcuni consigli...
- Varietà di alimenti
- Porzioni adeguate
- Idratazione
- Limita i cibi processati
- Cena equilibrata
- Non saltare i pasti
- Pianifica i pasti
- Consulta un nutrizionista
✅ Good general advice — but vague and generic. Not structured, not actionable.
Create a personalized dietary plan aimed at achieving a balanced, healthy lifestyle. Include detailed portion sizes, meal planning strategies for 7 days, nutritional guidelines, and practical advice for sustainable eating habits. The response should be in Italian and address hydration, food group balance, and eating behaviors.
Piano Alimentare Personalizzato
Introduzione:
Una dieta equilibrata è fondamentale per il benessere generale...Piano Consigliato:
- Frutta e verdura: 5 porzioni
- Proteine: 2-3 porzioni
- Carboidrati complessi: 3-4 porzioni
- Grassi sani: 2-3 porzioni
Piano Pasti di 7 Giorni:
Lunedì: omelette, pollo con avocado, pesce al forno...
Martedì: yogurt con frutta, sandwich, pollo grigliato...Consigli Utili:
- Bevi acqua
- Mangia lentamente
- Evita schermi durante i pasti
- Preferisci cibi stagionali
✅ Highly structured, specific, practical, and deeply useful.
| Feature | Initial Response | Final Response |
|---|---|---|
| Personalization | ❌ No | ✅ Yes |
| Structure / Formatting | ✅ Rich | |
| Day-by-Day Meal Plan | ❌ No | ✅ Yes |
| Practical Tips | ✅ Some | ✅ Comprehensive |
| Language / Context Awareness | ✅ Yes | ✅ Yes |
Result: BetterPrompt enables users to obtain higher-value responses from AI with zero prompt-writing experience.
The full implementation is written in Python and leverages Groq (via API) and OpenAI tools. A CLI interface and interactive terminal-based prompt debugger are currently in development.
Developed with ❤️ by Biagio Lernetti
GitHub: @blaze534new
This project is licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0) license.
You are free to:
- Share — copy and redistribute the material in any medium or format
- Adapt — remix, transform, and build upon the material
Under the following terms:
- Attribution — You must give appropriate credit to Biagio Lernetti
- ❌ No requirement to open-source or share modifications
- ❌ No requirement to distribute under same license
Read more here: https://creativecommons.org/licenses/by/4.0
This project uses the Groq API with the LLaMA3-70B-8192 model to process and generate the improved prompts and responses.
To use this project, you will need to create an API key for Groq.
- Visit the Groq API website to sign up and obtain your API key.
- After obtaining the API key, save it in a
.envfile in the root directory of this project with the following format: GROQ_API_KEY=your-api-key-here For an example, check the.env.examplefile in the GitHub repository.
Now, you are ready to run the project! Simply set up your environment and execute the Python script to see how BetterPrompt can enhance the quality of AI-generated responses.