Skip to content

Commit f6e8bb5

Browse files
committed
docs: Update NSQL API for optional model field, sample_data default, and tools auto mode
Source: spiceai/spiceai#10715
1 parent f38d35f commit f6e8bb5

3 files changed

Lines changed: 15 additions & 8 deletions

File tree

website/docs/api/HTTP/post-nsql.api.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ When `stream` is true, the response is streamed as Server-Sent Events (SSE).
5959

6060
<RequestSchema
6161
title={"Body"}
62-
body={{"description":"Request body to generate an NSQL query","content":{"application/json":{"schema":{"type":"object","required":["query"],"properties":{"datasets":{"type":["array","null"],"items":{"type":"string"},"description":"Names of datasets to sample from when constructing model context; this is a sampling hint and does not restrict which tables queries can target. If omitted, all datasets are used."},"model":{"type":"string","description":"The name of the model to use for SQL generation. Default: \"nql\""},"query":{"type":"string","description":"The natural language query to be converted into SQL"},"sample_data_enabled":{"type":"boolean","description":"Whether sample data is included in the context for SQL generation. Default: true"},"stream":{"type":"boolean","description":"If true, streams the response instead of waiting for completion"}},"title":"Request"},"example":{"query":"Get the top 5 customers by total sales","model":"nql","stream":false,"sample_data_enabled":true,"datasets":["sales_data"]}}},"required":true}}
62+
body={{"description":"Request body to generate an NSQL query","content":{"application/json":{"schema":{"type":"object","required":["query"],"properties":{"datasets":{"type":["array","null"],"items":{"type":"string"},"description":"Names of datasets to sample from when constructing model context; this is a sampling hint and does not restrict which tables queries can target. If omitted, all datasets are used."},"model":{"type":"string","description":"The name of the model to use for SQL generation. If omitted, Spice defaults to the only compatible LLM model configured in the Spicepod."},"query":{"type":"string","description":"The natural language query to be converted into SQL"},"sample_data_enabled":{"type":"boolean","description":"Whether sample data is included in the context for SQL generation. Default: false"},"stream":{"type":"boolean","description":"If true, streams the response instead of waiting for completion"},"prompt_cache_key":{"type":["string","null"],"description":"Stable prompt-cache key forwarded to the configured NSQL model for provider-specific cache handling."}},"title":"Request"},"example":{"query":"Get the top 5 customers by total sales","stream":false,"sample_data_enabled":false,"datasets":["sales_data"],"prompt_cache_key":"sales-dashboard"}}},"required":true}}
6363
>
6464

6565
</RequestSchema>

website/docs/features/large-language-models/tools.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The `tools` parameter on a model controls how tools are provided to the LLM:
2121

2222
| Value | Description |
2323
| --- | --- |
24-
| `auto` | Automatically choose between direct tools and searchable registry discovery. When the number of available tools exceeds 20 and an embedding model is available, `auto` switches to registry-based discovery; otherwise it uses direct tools. |
24+
| `auto` | Automatically choose between direct tools and searchable registry discovery, excluding data sampling tools. When the number of available tools exceeds 20 and an embedding model is available, `auto` switches to registry-based discovery; otherwise it uses direct tools. |
2525
| `all` | Provide all built-in and Spicepod-configured tools directly to the LLM. |
2626
| `search_registry` | Use searchable registry discovery. The LLM receives `tool_search` and `tool_invoke` meta-tools instead of individual tool definitions. Requires an embedding model (see `tool_embedding_model`). |
2727
| `<tool1>, <tool2>, ...` | Provide only the named tools directly. |

website/public/openapi.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -984,12 +984,12 @@
984984
},
985985
"example": {
986986
"query": "Get the top 5 customers by total sales",
987-
"model": "nql",
988987
"stream": false,
989-
"sample_data_enabled": true,
988+
"sample_data_enabled": false,
990989
"datasets": [
991990
"sales_data"
992-
]
991+
],
992+
"prompt_cache_key": "sales-dashboard"
993993
}
994994
}
995995
},
@@ -1739,7 +1739,7 @@
17391739
"Tools"
17401740
],
17411741
"summary": "Run Tool",
1742-
"description": "The request body and JSON response formats match the tool’s specification.",
1742+
"description": "The request body and JSON response formats match the tool\u2019s specification.",
17431743
"operationId": "post",
17441744
"parameters": [
17451745
{
@@ -4808,19 +4808,26 @@
48084808
},
48094809
"model": {
48104810
"type": "string",
4811-
"description": "The name of the model to use for SQL generation. Default: \"nql\""
4811+
"description": "The name of the model to use for SQL generation. If omitted, Spice defaults to the only compatible LLM model configured in the Spicepod."
48124812
},
48134813
"query": {
48144814
"type": "string",
48154815
"description": "The natural language query to be converted into SQL"
48164816
},
48174817
"sample_data_enabled": {
48184818
"type": "boolean",
4819-
"description": "Whether sample data is included in the context for SQL generation. Default: true"
4819+
"description": "Whether sample data is included in the context for SQL generation. Default: false"
48204820
},
48214821
"stream": {
48224822
"type": "boolean",
48234823
"description": "If true, streams the response instead of waiting for completion"
4824+
},
4825+
"prompt_cache_key": {
4826+
"type": [
4827+
"string",
4828+
"null"
4829+
],
4830+
"description": "Stable prompt-cache key forwarded to the configured NSQL model for provider-specific cache handling."
48244831
}
48254832
}
48264833
},

0 commit comments

Comments
 (0)