const aiResp = await env.AI.run(
"@cf/meta/llama-4-scout-17b-16e-instruct",
{
messages,
response_format: {
type: "json_schema",
json_schema: {
name: "DealEvaluation",
schema: {
type: "object",
properties: {
evaluation: {
type: "string",
description:
"Brief explanation why this is or isn’t a good deal",
},
goodDeal: {
type: "boolean",
description: "Whether this is a good deal",
},
},
required: ["evaluation", "goodDeal"],
},
},
},
}
);
const aiResp = await env.AI.run(
"@cf/meta/llama-4-scout-17b-16e-instruct",
{
messages,
response_format: {
type: "json_schema",
json_schema: {
name: "DealEvaluation",
schema: {
type: "object",
properties: {
evaluation: {
type: "string",
description:
"Brief explanation why this is or isn’t a good deal",
},
goodDeal: {
type: "boolean",
description: "Whether this is a good deal",
},
},
required: ["evaluation", "goodDeal"],
},
},
},
}
);