How anto5699/autoqa-prompt-optimizer works
AutoQA Prompt Optimizer turns labeled contact-center conversation CSVs and user-written evaluation rules into iteratively improved prompts, measured against an accuracy target. Users upload data, describe rules, answer clarifications, monitor optimization, and export evaluation CSVs, prompt CSVs, or a PDF report. The backend parses and audits labels, runs a LangGraph optimization loop, and serves session state and reports to the Angular workflow. The graph preserves documented audit and export capabilities; unsampled node and page implementations are represented only where the README or source index supports them.
Main entry points: graph.py Agent graph · session.service.ts Session service · sessions.py Session routes · results.component.ts Results view
Components 26
User workflow
- Upload CSV
frontend/src/app/pages/upload/upload.component.ts - Rule descriptions
frontend/src/app/pages/descriptions/descriptions.component.ts - Clarification UI
frontend/src/app/pages/clarification/clarification.component.ts - Progress view
frontend/src/app/pages/progress/progress.component.ts - Results view
frontend/src/app/pages/results/results.component.ts - PDF report
frontend/src/app/pages/results/print-report.component.ts - Session service
frontend/src/app/core/services/session.service.ts
Session API
- Session routes
backend/api/routes/sessions.py - Progress stream
backend/api/routes/stream.py - Session store
backend/utils/session_store.py
Input and setup
- CSV parser
backend/utils/csv_parser.py - Rule tracking setup
backend/agents/nodes/csv_ingestion.py - Ground-truth pre-audit
backend/agents/nodes/pre_flight_gt_audit.py - Ambiguity detection
backend/agents/nodes/ambiguity_detection.py - Baseline prompts
backend/agents/nodes/baseline_prompt_generator.py
Optimization loop
- Agent graph
backend/agents/graph.py - Optimization state
backend/agents/state.py - Conversation evaluator
backend/agents/nodes/evaluator.py - Failure analysis
backend/agents/nodes/rca_analyzer.py - Label alignment audit
backend/agents/nodes/gt_alignment_audit.py - Mid-loop clarification
backend/agents/nodes/mid_loop_clarification.py - Prompt optimizer
backend/agents/nodes/prompt_optimizer.py
Evaluation and results
- Benchmarking
backend/agents/nodes/benchmarking.py - Report finalization
backend/agents/nodes/finalize.py
Other components
- User
- OpenAI API
Connections 39
- User → Upload CSV: uploads data
README.md - User → Rule descriptions: defines rules
README.md - User → Clarification UI: answers questions
README.md - User → Progress view: monitors run
README.md - User → Results view: views results
README.md - Upload CSV → Session service: starts session
- Rule descriptions → Session service: submits rules
- Clarification UI → Session service: submits answers
- Progress view → Session service: checks status
- Results view → Session service: requests report
- Results view → PDF report: opens print view
frontend/src/app/app.routes.ts - Session service → Session routes: HTTP requests
frontend/src/app/core/services/session.service.ts - Session routes → CSV parser: parses upload
backend/api/routes/sessions.py - Session routes → Session store: stores session
backend/api/routes/sessions.py - Session routes → Agent graph: starts or resumes
backend/api/routes/sessions.py - Progress stream → Agent graph: streams progress
backend/api/routes/stream.py - Progress stream → Session store: reads session
backend/api/routes/stream.py - Agent graph → Rule tracking setup: dispatches setup
backend/agents/graph.py - Agent graph → Ground-truth pre-audit: dispatches audit
backend/agents/graph.py - Agent graph → Ambiguity detection: dispatches detection
backend/agents/graph.py - Agent graph → Baseline prompts: dispatches generation
backend/agents/graph.py - Agent graph → Conversation evaluator: dispatches evaluation
backend/agents/graph.py - Agent graph → Benchmarking: dispatches scoring
backend/agents/graph.py - Agent graph → Failure analysis: dispatches analysis
backend/agents/graph.py - Agent graph → Label alignment audit: dispatches audit
backend/agents/graph.py - Agent graph → Mid-loop clarification: dispatches questions
backend/agents/graph.py - Agent graph → Prompt optimizer: dispatches rewrite
backend/agents/graph.py - Agent graph → Report finalization: dispatches finalization
backend/agents/graph.py - Benchmarking → Failure analysis: routes below target
backend/agents/graph.py - Failure analysis → Label alignment audit: routes when stalled
backend/agents/graph.py - Failure analysis → Mid-loop clarification: routes otherwise
backend/agents/graph.py - Label alignment audit → Mid-loop clarification: continues questions
backend/agents/graph.py - Mid-loop clarification → Prompt optimizer: continues rewrite
backend/agents/graph.py - Prompt optimizer → Conversation evaluator: reevaluates prompts
backend/agents/graph.py - Benchmarking → Report finalization: routes at completion
backend/agents/graph.py - Rule tracking setup → Session store: updates progress
backend/agents/nodes/csv_ingestion.py - Conversation evaluator → OpenAI API: evaluates conversations
README.md - Prompt optimizer → OpenAI API: optimizes prompts
README.md - Report finalization → Results view: provides report
README.md