ritvik360/nl2sql-bench
0
1"""2nl2sql-bench/server/app.py3============================4FastAPI application entry point for the NL2SQL-Bench OpenEnv server.5 6create_fastapi_app() auto-creates all required OpenEnv endpoints:7 POST /reset — start a new episode8 POST /step — submit an action9 GET /state — retrieve episode state10 GET /health — health check11 GET /web — interactive web UI (if ENABLE_WEB_INTERFACE=true)12 GET /docs — Swagger UI13"""14 15import sys16from pathlib import Path17from openenv.core.env_server import create_fastapi_app18from environment import NL2SQLEnvironment19 20# Ensure models can be imported from the parent directory21_HERE = Path(__file__).parent22sys.path.insert(0, str(_HERE.parent))23 24from models import NL2SQLAction, NL2SQLObservation25 26# Pass the explicitly required action and observation classes27app = create_fastapi_app(28 NL2SQLEnvironment,29 action_cls=NL2SQLAction,30 observation_cls=NL2SQLObservation31)