Numbers Station AI logoNSQL 350M

A three hundred and fifty million parameter large language model for generating SQL queries.

Deploy NSQL 350M behind an API endpoint in seconds.

Deploy model

Example usage

This code example shows how to invoke the model using the requests library in Python. The model has a couple of key inputs:

  1. schema: The SQL schema for each table

  2. query: Input text sent to the model

The output of the model is a JSON object which has a key called result that contains the generated text.

Input
1import requests
2import os
3
4# Replace the empty string with your model id below
5model_id = ""
6baseten_api_key = os.environ["BASETEN_API_KEY"]
7
8schema = """CREATE TABLE stadium (
9    stadium_id number,
10    location text,
11    name text,
12    capacity number,
13    highest number,
14    lowest number,
15    average number
16)
17
18CREATE TABLE singer (
19    singer_id number,
20    name text,
21    country text,
22    song_name text,
23    song_release_year text,
24    age number,
25    is_male others
26)
27
28CREATE TABLE concert (
29    concert_id number,
30    concert_name text,
31    theme text,
32    stadium_id text,
33    year text
34)
35
36CREATE TABLE singer_in_concert (
37    concert_id number,
38    singer_id text
39)"""
40
41data = {
42    "schema": schema,
43    "query": "What is the maximum, the average, and the minimum capacity of stadiums?"
44}
45
46# Call model endpoint
47res = requests.post(
48    f"https://model-{model_id}.api.baseten.co/production/predict",
49    headers={"Authorization": f"Api-Key {baseten_api_key}"},
50    json=data
51)
52
53# Print the output of the model
54print(res.json())
JSON output
1{
2    "result": "SELECT MAX(capacity), AVG(capacity), MIN(capacity) FROM stadium;"
3}

Deploy any model in just a few commands

Avoid getting tangled in complex deployment processes. Deploy best-in-class open-source models and take advantage of optimized serving for your own models.

$

truss init -- example stable-diffusion-2-1-base ./my-sd-truss

$

cd ./my-sd-truss

$

export BASETEN_API_KEY=MdNmOCXc.YBtEZD0WFOYKso2A6NEQkRqTe

$

truss push

INFO

Serializing Stable Diffusion 2.1 truss.

INFO

Making contact with Baseten πŸ‘‹ πŸ‘½

INFO

πŸš€ Uploading model to Baseten πŸš€

Upload progress: 0% | | 0.00G/2.39G