Skip to content

API Overview

NL2SQL exposes two API surfaces: a Python Core API for in-process use and a REST API for remote clients. Use the links below for the full technical references.

Core API (Python)

  • Location: Core package (nl2sql)
  • Interface: the NL2SQL class: run_query and stream_query at the top level, everything else in a namespace (engine.datasources, engine.index, engine.llm, engine.policies, engine.curated, engine.results, engine.feedback, engine.traces, engine.storage, engine.evals), plus engine.about()
  • Use Case: Embedded/SDK use in Python applications
  • Reference: Core API index and per-namespace references:
  • Core API index
  • Query API (run_query, stream_query, engine.results)
  • Datasource API (engine.datasources)
  • Indexing API (engine.index)
  • LLM API (engine.llm)
  • Policies API (engine.policies)

REST API (FastAPI)

Supporting contracts

  • GraphState (nl2sql.pipeline.state.GraphState)
  • ExecutorRequest / ExecutorResponse (nl2sql.execution.contracts)
  • ResultFrame (nl2sql_sdk.contracts)

Source references

  • Runtime: packages/nl2sql/src/nl2sql/runtime.py
  • Running the graph: packages/nl2sql/src/nl2sql/pipeline/runtime.py
  • Public API: packages/nl2sql/src/nl2sql/public_api.py, with the namespaces in packages/nl2sql/src/nl2sql/api/
  • API Package: packages/api/src/nl2sql_api/