Spaces:
Paused
Paused
Commit History
-
Remove build artifact uploaded by mistake (gitignored *.egg-info/)
Verified signatureab92c58 -
Sync from GitHub: serving-only image deps, app_port, discoverability tags, buildable package
Verified signature60dfa24
-
fix: use valid HF Space colorTo value (blue not cyan)
Abhinav Singhe08fd70 -
feat(v2): execution-grounded rewards via DuckDB -- the key differentiatorβ
Abhinav SinghTHE CORE INNOVATION: optimized SQL queries are ACTUALLY EXECUTED against a real in-memory DuckDB database. Reward is computed from measured performance, not keyword heuristics. New files: executor.py β DuckDB engine with 4 synthetic tables (users 10k, orders 500k, products 1k, events 1M). Runs both the original and optimized query 3x each, returns median timing, result correctness, and EXPLAIN plan. leaderboard.py β In-memory best-score tracker per task, surfaced via the new /leaderboard endpoint. test_env.py β Integration test confirming real speedup (3-4x on Task 1 measured on local machine). Updated reward function (graders.py): Real Execution Speedup 35% (was: not measured at all) Result Correctness 20% (NEW: both queries must return same data) Issue Detection 25% (was: 60% keyword-only) Approval Correctness 8% Summary Quality 7% β¦c15d346
-
chore(infra): add Dockerfile, dependencies, and build configβ
Abhinav SinghDockerfile: - Base: python:3.11-slim (matches HF Spaces docker runtime) - Installs gcc for native extension builds - Copies requirements.txt first for Docker layer caching - EXPOSE 7860 (required by HuggingFace Spaces) - HEALTHCHECK via urllib (no extra deps needed) - CMD: uvicorn server.app:app --host 0.0.0.0 --port 7860 requirements.txt: fastapi, uvicorn[standard], pydantic, openai, pyyaml, requests, openenv-core (pinned versions for reproducibility) pyproject.toml: - [project.scripts] server = 'server.app:main' (required by openenv validate) - openenv-core>=0.2.0 as runtime dependency uv.lock: generated by uv lock, required by openenv validate check7800a62 -
feat(inference): add OpenEnv-compliant inference scriptβ
Abhinav Singhinference.py runs the agent loop against all 3 tasks in sequence. Strict stdout format (as required by hackathon spec): [START] task=<id> env=sql-optim-env model=<MODEL_NAME> [STEP] step=<n> action=suggestions=<n>,score=<f> reward=<f> done=<bool> error=<msg|null> [END] success=<bool> steps=<n> score=<f> rewards=<r1,...,rn> Agent strategy: - SYSTEM prompt instructs model to output strict JSON with suggestions, optimized_query, summary, estimated_improvement, approved fields - USER prompt includes schema_info, sql_query, dialect, step context, and issues_found_so_far from previous steps - parse_action() strips markdown fences and falls back gracefully on parse error - Episode success threshold: max reward >= 0.5 - Configurable via: API_BASE_URL, MODEL_NAME, HF_TOKEN env vars7d21a80 -
feat(server): add FastAPI server with all OpenEnv endpointsβ
Abhinav Singhserver/app.py β uvicorn FastAPI app on port 7860: POST /reset β start new episode, accepts optional {task_id} body, defaults to task_1_basic_antipatterns POST /step β submit Action, returns StepResult with Observation+Reward GET /state β current EnvironmentState (non-destructive) GET /tasks β list all tasks with descriptions and action schema POST /grader β grade an action against active task without advancing POST /baseline β runs inference.py subprocess and returns stdout GET / β health check returning env name and available tasks CORS middleware enabled for all origins (required for HF Space)e8bc352 -
feat(core): add grader and SQLOptimEnv environment classβ
Abhinav Singhgraders.py β 6-component composite reward function: 1. Issue Detection 60% keyword-match against ground truth issues 2. Optimized Query 15% length + anti-pattern removal heuristics 3. Approval Correct 10% bool match vs. approved_expected 4. Summary Quality 8% progressive scoring on summary length 5. Improvement Est. 4% keyword-match on estimated_improvement field 6. Severity Labels 3% checks severity values are present Minimum reward of 0.02 for any non-empty submission (partial signal) env.py β SQLOptimEnv class: - reset(task_id): validates task, initialises episode state, returns Observation - step(action): grades action, tracks issues_found_so_far, returns StepResult - state(): returns EnvironmentState snapshot without advancing episode - Episode terminates on max_steps OR reward >= 0.95 (early exit)7841be7 -
feat(data): add Pydantic models and task definitionsβ
Abhinav Singhmodels.py: - Observation: task metadata + sql_query + schema_info + dialect - Action: suggestions list + optimized_query + summary + estimated_improvement + approved flag - Reward: score (0-1), per-criterion breakdown dict, feedback str - StepResult and EnvironmentState for REST API responses tasks.py: - task_1_basic_antipatterns (easy, 3 steps): SELECT *, non-SARGable CAST/YEAR() predicates blocking index usage on a 5M-row orders table - task_2_join_optimization (medium, 4 steps): 3 correlated subqueries causing N+1 pattern across users/orders/products (10M+ row tables), missing index on filter column, unindexed ORDER BY - task_3_advanced_optimization (hard, 5 steps): JSONB arrow expression killing index, CTE over-materialization, window function sort cost, implicit ::text cast preventing index use, autovacuum bloat risk, HAVING without pre-filter on 500M-row events table - get_task_list() for /tasks endpoint with full action schemac540c55 -
feat: add OpenEnv spec, README, and gitignoreβ
Abhinav Singh- openenv.yaml: full OpenEnv-compliant spec with observation/action space definitions, 3 tasks (easy->medium->hard), reward schema, and deployment config targeting HuggingFace Spaces on port 7860 - README.md: HF Space header (sdk: docker), full environment description, action/observation space docs, task breakdown, reward table, API endpoints, baseline scores, and setup instructions - .gitignore: standard Python ignores (__pycache__, .env, venv, dist)cc0da5c -
initial commit
Verified signature026bc6e