v1

latestOpenAPI 3.1.02026-07-1730321418.0 KB
SQL

Text-to-SQL Context (NSQL)

Return the same context block that /v1/nsql injects into the configured NSQL model.

The response is a markdown/plain-text block or JSON object containing the in-scope datasets, schemas, Spice-specific SQL functions, registered user-defined functions, relevant JSON/Spark compatibility functions, and optional sample data.

get/v1/nsql/context

Query parameters

modelstring

The name of the model whose dataset allowlist should be used. If omitted, Spice defaults to the only compatible LLM model configured in the Spicepod.

include_samplingboolean

Whether distinct-value samples are included in the context block. Also accepts sample_data_enabled for compatibility with /v1/nsql request bodies. Default: false.

sampling_limitinteger

Maximum number of rows per distinct-value sample. Default: 3, maximum: 100.

include_examplesboolean

Whether example rows are included in the context block. Defaults to include_sampling when omitted, matching /v1/nsql sample_data_enabled behavior.

examples_limitinteger

Maximum number of example rows per dataset. Default: 3, maximum: 100.

datasetsstring[]

Names of datasets to include in the context block. If omitted, all datasets visible to the selected model are included.

Headers

Acceptstring required

The format of the response, one of 'text/markdown' (default), 'text/plain', or 'application/json'.

Response

NSQL context block

contextstring required

The rendered NSQL context block injected into /v1/nsql model requests.

instructionsstring[] required

High-level SQL generation instructions.