CoolFace
Apppublic

vinayaknandi05/sql-optimization-openenv

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
openenv.yaml93 linesDownload Raw Back to root
1name: sql-optimization-openenv2version: "1.0.0"3description: >4  An OpenEnv environment where an AI agent learns to optimize SQL queries.5  The agent is given poorly-written SQL (SELECT *, N+1 subqueries, broken aggregations)6  and must rewrite them to be correct, performant, and follow best practices.7  Built on SQLite with a realistic HR/project schema.8 9author: sql-openenv10tags:11  - openenv12  - sql13  - optimization14  - real-world15  - code16 17observation_space:18  type: object19  properties:20    echoed_message:21      type: string22      description: Human-readable status message for the agent.23    task_description:24      type: string25      description: Full description of what the agent needs to accomplish.26    original_query:27      type: string28      description: The original (unoptimized) SQL query to fix.29    schema_info:30      type: string31      description: Full database schema as CREATE TABLE statements.32    last_query_result:33      type: string34      nullable: true35      description: JSON string of first 5 rows from last executed query.36    last_query_error:37      type: string38      nullable: true39      description: Error message if last query failed.40    step:41      type: integer42      description: Current step number.43    done:44      type: boolean45      description: Whether the episode has ended.46    score:47      type: number48      minimum: 0.049      maximum: 1.050      description: Current graded score for this task.51 52action_space:53  type: object54  properties:55    query:56      type: string57      description: The SQL query to submit as the optimized version.58    message:59      type: string60      description: Optional explanation of what was optimized.61  required:62    - query63 64reward_range: [-1.0, 1.0]65 66tasks:67  - id: task_easy68    name: "Fix SELECT * and Add WHERE clause"69    difficulty: easy70    max_steps: 1071    score_range: [0.0, 1.0]72 73  - id: task_medium74    name: "Optimize N+1 with JOIN"75    difficulty: medium76    max_steps: 1077    score_range: [0.0, 1.0]78 79  - id: task_hard80    name: "Complex Aggregation with Window Function or Subquery"81    difficulty: hard82    max_steps: 1083    score_range: [0.0, 1.0]84 85endpoints:86  reset: POST /reset87  step: POST /step88  state: GET /state89 90docker:91  base_image: python:3.11-slim92  port: 786093