Skip to content

Repository files navigation

Prompt optimalizáló (meta-prompt tool)

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.

Features

  • 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

Tech Stack

  • Backend: Python, FastAPI, Pydantic Settings, Jinja2
  • Frontend: React 19, TypeScript, Vite
  • Suported LLM providers: Anthropic, OpenAI, Gemini, OpenRouter, DeepSeek, xAI, Grok, ZAI, Ollama, Groq

Screenshot of the frontend

Quick Start

Prerequisites

  • Python 3.13+
  • uv
  • bun

Backend setup

uv sync
cp .env.example .env

Set 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.

Frontend setup

cd frontend
bun install
cp .env.example .env
cd ..

Run the app

Backend:

uv run python run.py

Frontend:

cd frontend
bun dev

Open http://127.0.0.1:5173.

API

  • GET /api/v1/health — effective provider status, supported providers, and selected model
  • GET /api/v1/llm/models — live model catalog for the selected provider and effective API key
  • POST /api/v1/sessions — create a prompt enhancement session
  • POST /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.

Example flow

  1. Enter a rough prompt.
  2. If the prompt is underspecified, answer any clarification questions you want.
  3. Generate the improved prompt.
  4. Copy the enhanced version into your preferred LLM.

Project structure

backend/
  config.py
  llm_service.py
  main.py
  models.py
  prompt_engine.py
  prompts/
frontend/
  src/
tests/
run.py

Development

uv run pytest
uv run ruff check
cd frontend && bun run build

Start Script

Run both the backend and frontend together from the project root:

./start.sh

The 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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages