A full-stack prompt enhancement app for the Prompt Engineering course.
The user pastes a rough prompt, the backend checks whether key details are missing, and the UI asks short clarification questions when needed. The app then returns an improved prompt while keeping the original visible side-by-side.
- Prompt analysis with targeted clarification questions
- Optional LLM-backed enhancement through Anthropic, OpenAI, Gemini, OpenRouter, DeepSeek, xAI, Grok, ZAI, Ollama, and Groq
- Provider-specific API keys stored per provider in the browser
- Live model selection driven by the selected provider's API-accessible model list
- Side-by-side comparison of the original and enhanced prompt
- Explanation of improvements and assumptions
- Backend: Python, FastAPI, Pydantic Settings, Jinja2
- Frontend: React 19, TypeScript, Vite
- Suported LLM providers: Anthropic, OpenAI, Gemini, OpenRouter, DeepSeek, xAI, Grok, ZAI, Ollama, Groq
- Python 3.13+
uvbun
uv sync
cp .env.example .envSet one provider in .env with its matching API key when required. Users can also override the provider, model, and API key from the frontend. Ollama is available as the local provider and does not require an API key if it is running locally.
cd frontend
bun install
cp .env.example .env
cd ..Backend:
uv run python run.pyFrontend:
cd frontend
bun devOpen http://127.0.0.1:5173.
GET /api/v1/health— effective provider status, supported providers, and selected modelGET /api/v1/llm/models— live model catalog for the selected provider and effective API keyPOST /api/v1/sessions— create a prompt enhancement sessionPOST /api/v1/sessions/{session_id}/enhance— submit clarifying answers and get the enhanced prompt
The frontend sends X-LLM-Provider, X-LLM-Model, and X-LLM-API-Key headers so each request can use the current user-selected provider, model, and key.
- Enter a rough prompt.
- If the prompt is underspecified, answer any clarification questions you want.
- Generate the improved prompt.
- Copy the enhanced version into your preferred LLM.
backend/
config.py
llm_service.py
main.py
models.py
prompt_engine.py
prompts/
frontend/
src/
tests/
run.py
uv run pytest
uv run ruff check
cd frontend && bun run buildRun both the backend and frontend together from the project root:
./start.shThe script checks for the Python environment and frontend dependencies, starts the API on 127.0.0.1:8000, starts the Vite frontend on 127.0.0.1:5173, and stops both services when you press Ctrl+C.
The frontend uses Vite's /api/v1 proxy by default in development, which avoids host and CORS mismatches. If you deploy the frontend separately, set VITE_API_BASE_URL in frontend/.env.
