This is a FastAPI backend for the llama-prompt-ops frontend interface. It provides API endpoints for optimizing prompts using OpenAI's GPT models and the llama-prompt-ops library.
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Set up your environment variables:
- Copy
.env.exampleto.env(if available) - Add your OpenAI API key and OpenRouter API key to the
.envfile
- Copy
Start the FastAPI server with:
uvicorn main:app --reload --port 8000The API will be available at http://localhost:8000
Enhances a prompt using OpenAI's GPT model.
Request Body:
{
"prompt": "Your prompt text here"
}Response:
{
"optimizedPrompt": "Enhanced prompt text"
}Optimizes a prompt using the llama-prompt-ops library.
Request Body:
{
"prompt": "Your prompt text here",
"config": {
"taskModel": "Llama 3.3 70B",
"proposerModel": "Llama 3.1 8B",
"optimizer": "MiPro",
"dataset": "Q&A",
"metrics": "Exact Match",
"useLlamaTips": true
}
}Response:
{
"optimizedPrompt": "Optimized prompt text"
}This backend serves as a development interface for the llama-prompt-ops library, providing web API access to prompt optimization features. When this frontend is eventually integrated into the main llama-prompt-ops repository, this backend functionality will be incorporated into the library's core API structure.