Spaces:
Running
Running
| """ | |
| 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 | |
| ) |