Skip to content

GadgetExample

Defined in: gadgets/types.ts:20

Example of gadget usage to help LLMs understand proper invocation.

Examples are rendered alongside the schema in getInstruction() to provide concrete usage patterns for the LLM.

const calculator = createGadget({
schema: z.object({ a: z.number(), b: z.number() }),
examples: [
{ params: { a: 5, b: 3 }, output: "8", comment: "Addition example" }
],
// ...
});

TParams = Record<string, unknown>

Inferred parameter type from Zod schema (defaults to Record<string, unknown>)

optional comment: string

Defined in: gadgets/types.ts:28

Optional description explaining what this example demonstrates


optional output: string

Defined in: gadgets/types.ts:25

Optional expected output/result string


params: TParams

Defined in: gadgets/types.ts:22

Example parameter values (typed to match schema)