Public
Edited
Feb 17
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
res = {
const response = await fetch(
"https://openrouter.ai/api/v1/chat/completions",
{
method: "POST",
headers: {
Authorization:
`Bearer ${API_KEY}`,
// "HTTP-Referer": "<YOUR_SITE_URL>", // Optional. Site URL for rankings on openrouter.ai.
// "X-Title": "<YOUR_SITE_NAME>", // Optional. Site title for rankings on openrouter.ai.
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "deepseek/deepseek-r1-distill-llama-70b:free",
messages: [
{
role: "user",
content:
`This is the schema of table named cars
"name": { "type": "string" },
"economy_mpg": { "type": "number" },
"cylinders": { "type": "integer" },
"displacement_cc": { "type": "integer" },
"power_hp": { "type": "integer" },
"weight_lb": { "type": "integer" },
"zero_to_sixty_s": { "type": "number" },
"year": { "type": "integer" }
}. write an sql to find the car name 'AMC Concord' and calculate average weight. just give me sql statment after the dotted new line in json {sql_query:"select * from table"}. please dont provide/return any thinking steps
`
}
]
})
}
);
const data = await response.json();
return data;
}
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more