Generate SQL filter from natural language using AI
curl --request POST \
--url https://api.ionworks.com/cell_measurements/filter-steps/generate \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"measurement_id": "<string>",
"current_sql": "<string>"
}
'import requests
url = "https://api.ionworks.com/cell_measurements/filter-steps/generate"
payload = {
"prompt": "<string>",
"measurement_id": "<string>",
"current_sql": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({prompt: '<string>', measurement_id: '<string>', current_sql: '<string>'})
};
fetch('https://api.ionworks.com/cell_measurements/filter-steps/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ionworks.com/cell_measurements/filter-steps/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => '<string>',
'measurement_id' => '<string>',
'current_sql' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ionworks.com/cell_measurements/filter-steps/generate"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"measurement_id\": \"<string>\",\n \"current_sql\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ionworks.com/cell_measurements/filter-steps/generate")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"measurement_id\": \"<string>\",\n \"current_sql\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ionworks.com/cell_measurements/filter-steps/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"measurement_id\": \"<string>\",\n \"current_sql\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"sql_where_clause": "<string>",
"match_mode": "<string>",
"explanation": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Generate SQL filter from natural language using AI
Generate a SQL WHERE clause from a natural language description using AI.
This endpoint uses a language model to convert natural language descriptions like “steps lasting more than an hour” into SQL WHERE clauses like “duration_s >= 3600”.
The AI also determines whether to use “step” or “cycle” match mode based on the user’s intent.
The generated SQL is validated against the specified measurement to ensure it is syntactically correct. If validation fails, the AI will retry.
Returns:
- sql_where_clause: The generated SQL WHERE clause
- match_mode: “step” or “cycle”
- explanation: Brief explanation of what the filter does
Generate SQL filter from natural language using AI
curl --request POST \
--url https://api.ionworks.com/cell_measurements/filter-steps/generate \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"measurement_id": "<string>",
"current_sql": "<string>"
}
'import requests
url = "https://api.ionworks.com/cell_measurements/filter-steps/generate"
payload = {
"prompt": "<string>",
"measurement_id": "<string>",
"current_sql": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({prompt: '<string>', measurement_id: '<string>', current_sql: '<string>'})
};
fetch('https://api.ionworks.com/cell_measurements/filter-steps/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ionworks.com/cell_measurements/filter-steps/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => '<string>',
'measurement_id' => '<string>',
'current_sql' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ionworks.com/cell_measurements/filter-steps/generate"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"measurement_id\": \"<string>\",\n \"current_sql\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ionworks.com/cell_measurements/filter-steps/generate")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"measurement_id\": \"<string>\",\n \"current_sql\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ionworks.com/cell_measurements/filter-steps/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"measurement_id\": \"<string>\",\n \"current_sql\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"sql_where_clause": "<string>",
"match_mode": "<string>",
"explanation": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Body
application/json
Was this page helpful?