-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstructured-output.js
More file actions
34 lines (32 loc) · 904 Bytes
/
Copy pathstructured-output.js
File metadata and controls
34 lines (32 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
export const meta = {
name: "structured-output",
description: "Collect a validated JSON Schema verdict from an agent",
phases: [{ title: "Assess", detail: "Return one validated verdict" }],
}
const VERDICT_SCHEMA = {
type: "object",
additionalProperties: false,
required: ["isSafe", "findings"],
properties: {
isSafe: { type: "boolean" },
findings: {
type: "array",
items: {
type: "object",
additionalProperties: false,
required: ["title", "severity"],
properties: {
title: { type: "string", minLength: 1 },
severity: { type: "string", enum: ["low", "medium", "high"] },
},
},
},
},
}
phase("Assess")
const verdict = await agent("Assess the current git diff and return a structured safety verdict.", {
label: "safety-verdict",
phase: "Assess",
schema: VERDICT_SCHEMA,
})
return { verdict }