FastAPI + chat-style web UI implementing:
- Clarifier stage (
/v1/clarify): Prompt A (clarified intent) and Prompt B (Vision B). - Execution stage (
/v1/execute): user selects A, B, or both and runs selected prompt(s). - Direct stage (
/v1/direct): bypass A/B and ask GPT directly.
python -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'
cp .env.example .envOpen .env and paste your API key. Then switch backend to openai.
PROMPT_COACH_BACKEND=openai
PROMPT_COACH_MODEL=gpt-4.1-nano
PROMPT_COACH_ANSWER_MODEL=gpt-4.1-mini
PROMPT_COACH_ENABLE_WEB_SEARCH=true
OPENAI_API_KEY=PASTE_YOUR_OPENAI_API_KEY_HEREuvicorn app.main:app --reloadOpen: http://127.0.0.1:8000
Request:
{
"message": "where should I go for sushi tonight?",
"locale": "en-US",
"context": "optional"
}Returns latent goal, interpretations, assumptions, ambiguities, Prompt A, Prompt B, rationale, follow-ups, and confidence.
Request:
{
"original_message": "where should I go for sushi tonight?",
"selected": ["A", "B"]
}Returns one or two runs depending on selection.
Request:
{
"message": "where should I go for sushi tonight?"
}Returns one direct answer without generating A/B prompts first.
- If
PROMPT_COACH_BACKEND=openaiand the key is missing/invalid, the API returns a clear400error. - If backend is
mock, no external model is called. .envis local-only and ignored by git. Commit only.env.example.- Live web retrieval is enabled in both
A/Banswer mode andDirectmode whenPROMPT_COACH_ENABLE_WEB_SEARCH=true.
pytest