File size: 947 Bytes
a39d8ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
nl2sql-bench/server/app.py
============================
FastAPI application entry point for the NL2SQL-Bench OpenEnv server.

create_fastapi_app() auto-creates all required OpenEnv endpoints:
  POST /reset   β€” start a new episode
  POST /step    β€” submit an action
  GET  /state   β€” retrieve episode state
  GET  /health  β€” health check
  GET  /web     β€” interactive web UI (if ENABLE_WEB_INTERFACE=true)
  GET  /docs    β€” Swagger UI
"""

import sys
from pathlib import Path
from openenv.core.env_server import create_fastapi_app
from environment import NL2SQLEnvironment

# Ensure models can be imported from the parent directory
_HERE = Path(__file__).parent
sys.path.insert(0, str(_HERE.parent))

from models import NL2SQLAction, NL2SQLObservation

# Pass the explicitly required action and observation classes
app = create_fastapi_app(
    NL2SQLEnvironment,
    action_cls=NL2SQLAction,
    observation_cls=NL2SQLObservation
)