This workspace provides a minimum viable pipeline to evaluate prompt variants against human ratings on smart home accessibility dimensions.
outputs/llm_ratings.csv: LLM scores and reasons by model/provider/prompt/product/dimensionoutputs/metrics_table.csv: Model+prompt correlations, rank correlations, accuracy, and kappaoutputs/summary_report.md: Ranked summary with validation flags and scatter plotsoutputs/logs.json: Warnings, errors, token usage, and estimated API cost
- Products CSV with columns:
product_namedescriptioncategory- optional
product_id(auto-generated if missing)
- Human ratings CSV with columns:
product_id,rater_id,physical_score,cognitive_score,reason
- Prompt variants JSON list:
- each item must include
nameandtemplate
- each item must include
- Config JSON (
config.jsonby default)
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cat << 'EOF' > .env
OPENAI_API_KEY="your_openai_key"
GOOGLE_API_KEY="your_google_key"
ANTHROPIC_API_KEY="your_anthropic_key"
EOFFor the transformer script fallback path:
export GROQ_API_KEY="your_groq_key"python mvp.py --products sample/products.csv --prompts prompts.jsonOptional:
python mvp.py --products sample/products.csv --human sample/human_ratings.csv --prompts prompts.json --config config.json --output-dir outputsIf your source CSV has columns name,product_url,manual_url, run:
python transform_products.py --input input.csv --output output.csv --config transform_config.jsonThe script writes:
output.csvwith columnsproduct_name,description,categoryoutputs/transform_log.jsonwith per-row status/errors
Tips:
- Ollama is used as primary extractor (
ollama_modelintransform_config.json). - Groq is used automatically as fallback if Ollama fails.
- Start with a 5-row sample and use
--verbosefor debugging.
- The runner uses LiteLLM as a unified gateway across providers.
- Retries are enabled for LLM calls (
retry_attemptsin config). - Invalid JSON or out-of-range model scores are logged and skipped.
- Low-agreement prompts are flagged when avg correlation < 0.4.
- Kappa uses a generalized Fleiss-style formulation over rating count matrices.
- Currently, human rating comparison is non-functional. There for future compatibility.