A sophisticated tool that takes vague user requests and synthesizes optimal system/assistant prompts to get better responses from Large Language Models (LLMs).
- Multi-Provider Support: Works with OpenAI, Anthropic (Claude), and Google Gemini APIs
- Intelligent Prompt Synthesis: Uses advanced prompt engineering techniques including:
- System prompt optimization
- Few-shot prompting
- Chain-of-thought reasoning
- Automatic Optimization: Analyzes vague requests and creates structured, effective prompts
- CLI Interface: Easy-to-use command-line tool
- Clone this repository:
git clone https://github.com/Claire56/PromptOptimiser.git
cd PromptOptimiser- Install dependencies:
pip install -r requirements.txt- Set up environment variables. Create a
.envfile in the root directory:
# For OpenAI
OPENAI_API_KEY=your_openai_api_key_here
# For Anthropic
ANTHROPIC_API_KEY=your_anthropic_api_key_here
# For Google Gemini
GOOGLE_API_KEY=your_google_api_key_here
# Default provider (openai, anthropic, or gemini)
DEFAULT_PROVIDER=openaipython prompt_optimizer.py "help me write a blog post"python prompt_optimizer.py "analyze this data" --provider anthropicpython prompt_optimizer.py "your vague request" --provider openai --model gpt-4 --temperature 0.7- Input Analysis: Takes your vague user request
- Prompt Synthesis: Uses an LLM to analyze the request and create an optimal system prompt with:
- Clear role definition
- Specific instructions
- Output format guidelines
- Context and constraints
- Response Generation: Uses the optimized prompt to generate a high-quality response
- Output: Returns both the optimized prompt and the final response
Input:
"help me write something about AI"
Optimized System Prompt:
You are an expert technical writer specializing in artificial intelligence.
Your task is to create engaging, informative content about AI topics.
Guidelines:
- Write in a clear, accessible style suitable for a general audience
- Include relevant examples and use cases
- Structure content with clear headings and sections
- Provide actionable insights
Output format: Well-structured article with introduction, main content, and conclusion.
Final Response: A well-structured article about AI based on the optimized prompt.
- OpenAI: GPT-3.5, GPT-4, GPT-4 Turbo
- Anthropic: Claude 3 Opus, Claude 3 Sonnet, Claude 3 Haiku
- Google: Gemini Pro, Gemini Pro Vision
PromptOptimiser/
├── prompt_optimizer.py # Main CLI interface
├── optimizer/
│ ├── __init__.py
│ ├── core.py # Core optimization logic
│ └── providers.py # LLM provider integrations
├── requirements.txt
├── README.md
└── .env # Environment variables (create this)
MIT License