import { OpenRouterCore } from "@openrouter/sdk/core.js";
import { alphaDecisionsCreate } from "@openrouter/sdk/funcs/alphaDecisionsCreate.js";
// Use `OpenRouterCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const openRouter = new OpenRouterCore({
httpReferer: "<value>",
appTitle: "<value>",
appCategories: "<value>",
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
});
async function run() {
const res = await alphaDecisionsCreate(openRouter, {
decisionsRequest: {
model: "typesafe/jev-1.13",
questions: {
"is_bug": {
criteria: {
false: "The customer is asking a question or requesting a feature.",
true: "The customer describes broken or unexpected product behavior.",
},
instructions: "Is the customer reporting a software defect?",
type: "noul",
},
"team": {
criteria: {
"account": "Login, permissions, or profile issues.",
"frontend": "Rendering, layout, or browser compatibility issues.",
"payments": "Checkout, billing, or payment processing issues.",
},
instructions: "Which team should own this ticket?",
type: "choice",
},
"urgency": {
criteria: [
"Can wait for the next release",
"Should be fixed this week",
"Blocking revenue right now",
],
instructions: "How urgent is this ticket?",
type: "score",
},
},
state: {
"customer_tier": "enterprise",
"ticket": "My checkout page shows a blank screen after I click Pay. I have tried two browsers.",
},
},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("alphaDecisionsCreate failed:", res.error);
}
}
run();