Skip to content

Commit ed42209

Browse files
committed
add url note, and remove optional from examples
1 parent f86955c commit ed42209

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/agent/tools/extract.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ export const createExtractTool = (
4343
USAGE GUIDELINES:
4444
- Keep schemas MINIMAL - only include fields essential for the task
4545
- IMPORANT: only use this if explicitly asked for structured output. In most scenarios, you should use the aria tree tool over this.
46-
46+
- If you need to extract a link, make sure the type defintion follows the format of z.string().url()
4747
EXAMPLES:
4848
1. Extract a single value:
4949
instruction: "extract the product price"
50-
schema: "z.object({ price: z.number().optional() })"
50+
schema: "z.object({ price: z.number()})"
5151
5252
2. Extract multiple fields:
5353
instruction: "extract product name and price"
54-
schema: "z.object({ name: z.string().optional(), price: z.number().optional() })"
54+
schema: "z.object({ name: z.string(), price: z.number() })"
5555
5656
3. Extract arrays:
5757
instruction: "extract all product names and prices"
58-
schema: "z.object({ products: z.array(z.object({ name: z.string().optional(), price: z.number().optional() })) })"`,
58+
schema: "z.object({ products: z.array(z.object({ name: z.string(), price: z.number() })) })"`,
5959
parameters: z.object({
6060
instruction: z
6161
.string()
@@ -65,7 +65,7 @@ export const createExtractTool = (
6565
schema: z
6666
.string()
6767
.describe(
68-
'Zod schema as a string (e.g., "z.object({ price: z.number().optional() })")',
68+
'Zod schema as a string (e.g., "z.object({ price: z.number() })")',
6969
),
7070
}),
7171
execute: async ({ instruction, schema }) => {

0 commit comments

Comments
 (0)