import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.router.classify.create({
fallbacks: [
{
model: "openai/gpt-5.6-luna",
},
],
identity: {
displayName: "Sample customer",
id: "customer-demo",
},
model: "openai/gpt-6-luna",
questions: {
"positive": {
criteria: {
false: "The customer is unhappy.",
true: "The customer is happy.",
},
instructions: "Is the sentiment positive?",
type: "noul",
},
"rating": {
criteria: [
"Negative",
"Neutral",
"Positive",
],
instructions: "Rate sentiment.",
type: "score",
},
"sentiment": {
criteria: {
"negative": "Negative sentiment",
"neutral": "Neutral sentiment",
"positive": "Positive sentiment",
},
instructions: "Classify sentiment.",
type: "choice",
},
},
retry: {
count: 2,
onCodes: [
429,
502,
503,
504,
],
},
state: "The customer says: I love this product. It is wonderful!",
timeout: {
callTimeout: 2000,
},
});
console.log(result);
}
run();