Spaces:
Running
Running
| // Tools lifted verbatim from the official Cactus `needle playground`. | |
| // These three are the playground's defaults β keeping them identical lets visitors | |
| // recognize the demo as a browser version of the same tool. | |
| const setTimerTool = { | |
| name: 'set_timer', | |
| description: 'Set a timer for the specified duration or end time.', | |
| parameters: { | |
| time_human: { | |
| type: 'string', | |
| description: | |
| "The duration or target end time in human readable format e.g. '1 hour and 30 minutes', '45 minutes', 'for 1:50pm', 'at 13:30'.", | |
| required: true, | |
| }, | |
| }, | |
| }; | |
| const sendEmailTool = { | |
| name: 'send_email', | |
| description: 'Send an email to a recipient.', | |
| parameters: { | |
| to: { type: 'string', description: "The recipient's email address.", required: true }, | |
| subject: { type: 'string', description: 'The email subject line.', required: true }, | |
| body: { type: 'string', description: 'The email body text.', required: true }, | |
| }, | |
| }; | |
| const createNoteTool = { | |
| name: 'create_note', | |
| description: 'Create a new note with the given text.', | |
| parameters: { | |
| text: { type: 'string', description: 'The text content of the note.', required: true }, | |
| }, | |
| }; | |
| export const DEFAULT_TOOLS = [setTimerTool, sendEmailTool, createNoteTool]; | |
| export interface Example { | |
| label: string; // shown on the chip | |
| query: string; // populates the Query input | |
| tools?: unknown[]; // defaults to DEFAULT_TOOLS | |
| } | |
| // USER CONTRIBUTION POINT #3 β preset queries (Task 13) | |
| // Each preset should be a query whose ideal output is a clear function call | |
| // on one of the three default tools. Visitors click a chip and immediately | |
| // see Needle produce convincing JSON. | |
| // | |
| // Current selection (each targets a different tool): | |
| // 1. "set a 5 min timer" β set_timer (the official playground's example) | |
| // 2. "email alice@example.com that the meeting moved to 3pm" β send_email | |
| // 3. "remind me to buy milk on the way home" β create_note | |
| export const EXAMPLES: Example[] = [ | |
| { label: 'Set a timer', query: 'set a 5 min timer' }, | |
| { label: 'Send email', query: 'email alice@example.com that the meeting moved to 3pm' }, | |
| { label: 'Create note', query: 'remind me to buy milk on the way home' }, | |
| ]; | |