Skip to content

Commit dc1c367

Browse files
committed
👌 IMPROVE: example
1 parent 809596a commit dc1c367

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

examples/nodejs/pipes/pipe.structured.outputs.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,27 @@ async function createMathTutorPipe() {
3232
response_format: {
3333
type: 'json_schema',
3434
json_schema: {
35-
name: 'math_response',
36-
schema: MathResponseSchema.shape, // Use Zod schema shape
35+
name: 'math_reasoning',
36+
schema: {
37+
type: 'object',
38+
properties: {
39+
steps: {
40+
type: 'array',
41+
items: {
42+
type: 'object',
43+
properties: {
44+
explanation: {type: 'string'},
45+
output: {type: 'string'},
46+
},
47+
required: ['explanation', 'output'],
48+
additionalProperties: false,
49+
},
50+
},
51+
final_answer: {type: 'string'},
52+
},
53+
required: ['steps', 'final_answer'],
54+
additionalProperties: false,
55+
},
3756
strict: true,
3857
},
3958
},
@@ -62,8 +81,8 @@ async function main() {
6281
}
6382

6483
// Run this only once to create the pipe. Uncomment if it's your first time setting it up.
65-
// await createMathTutorPipe();
66-
await runMathTutorPipe('How can I solve 8x - 7 = -23?');
84+
await createMathTutorPipe();
85+
await runMathTutorPipe('How can I solve 8x + 22 = -23?');
6786
}
6887

6988
main();

0 commit comments

Comments
 (0)