Spaces:
Running
Running
File size: 3,973 Bytes
06216a5 ee14394 06216a5 ee14394 06216a5 ec41d2b b073409 ec41d2b ee14394 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
---
title: Prompt Engineer
emoji: π οΈ
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.9.1
app_file: app.py
pinned: false
thumbnail: >-
https://cdn-uploads.huggingface.co/production/uploads/64785512256b62e2198f065b/d_rcNoscoZiPVgM6TGJgs.png
---
# Prompt Engineer Agent

## Overview
This project is an **AI-powered Prompt Engineering Tool** designed to automatically enhance and optimize prompts for large language models (LLMs). Using advanced prompt engineering principles and OpenAI's GPT-4, the tool transforms basic prompts into comprehensive, well-structured instructions that yield better results.
## Key Features
- **Automated Prompt Enhancement:** Transforms basic prompts into detailed, optimized versions
- **Multi-step Analysis:** Analyzes input, expands instructions, decomposes tasks, and adds reasoning
- **OpenAI Integration:** Leverages GPT-4o for intelligent prompt engineering
- **Gradio Interface:** Provides an intuitive web interface for easy interaction
- **Evaluation System:** Includes built-in criteria for assessing prompt quality
- **Reference Suggestions:** Recommends relevant sources to enhance prompt effectiveness
## Repo Structure
```
βββ .gitignore # Files and directories to be ignored by Git
βββ LICENSE # License information for the project
βββ README.md # Project documentation (this file)
βββ agent.py # Core prompt engineering logic
βββ app.py # Gradio web interface implementation
βββ requirements.txt # Python dependencies
```
## How It Works
The tool enhances prompts through several steps:
1. **Input Analysis:** Determines key information and requirements
2. **Instruction Expansion:** Adds clarity and detail to basic prompts
3. **Task Decomposition:** Breaks down complex tasks into manageable subtasks
4. **Reasoning Addition:** Incorporates chain-of-thought and self-review instructions
5. **Reference Integration:** Suggests relevant sources and explains their use
6. **Quality Evaluation:** Assesses and adjusts the final prompt based on specific criteria
## Getting Started
### Prerequisites
- Python 3.8+
- OpenAI API key
### Installation
1. Clone the repository:
```bash
git clone https://github.com/justmalhar/prompt-engineer.git
cd prompt-engineer-agent
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Set up your OpenAI API key in the Gradio UI:
- Create a .env file in the project root
- Add your API key: `OPENAI_API_KEY=your-api-key`
### Usage
Run the Gradio interface:
```bash
python app.py
```
The web interface will be available at http://localhost:7860 or generated Gradio.live URL
## Features in Detail
### Prompt Analysis
- Identifies main topics and requirements
- Determines optimal output format
- Suggests enhancement strategies
### Instruction Enhancement
- Adds relevant details and clarifications
- Suggests appropriate AI personas
- Includes guiding examples
- Optimizes output length
### Task Management
- Breaks down complex prompts into subtasks
- Creates specific instructions per subtask
- Defines success criteria
### Quality Control
- Implements self-review mechanisms
- Includes evaluation criteria
- Performs automatic adjustments
## Dependencies
- gradio
- openai
- python-dotenv
- fastapi
- uvicorn
- And more (see requirements.txt)
## Credits
This project is inspired by and adapted from [Advanced-Prompt-Generator](https://github.com/Thunderhead-exe/Advanced-Prompt-Generator) by Thunderhead-exe.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---
## Stay Connected
- **Twitter/X**: [@justmalhar](https://twitter.com/justmalhar) π
- **LinkedIn**: [Malhar Ujawane](https://linkedin.com/in/justmalhar) π»
Made with β€οΈ and AI by [@justmalhar](https://twitter.com/justmalhar) |