5 ms·
This is great. Want to come demo it in the weekly EarthPilot.ai AI Playground tomorrow at 11est? Http://earthpilot.com/play and then join at AnthonyDavidAdams.
by ada1981 2y ago
This is great. Want to come demo it in the weekly EarthPilot.ai AI Playground tomorrow at 11est?
Http://earthpilot.com/play and then join at AnthonyDavidAdams.com/zoom at 11 for show and tell.
I’m making a non-fiction book writing agent and I’d love to better understand how you used function calling to navigate the website!
- tomblomfield 2y agoBasically you declare to the AI which functions (tools) are available for it to call: https://platform.openai.com/docs/guides/function-calling?api-mode=responses https://platform.openai.com/docs/guides/function-calling?api... Then you handle those function calls in your javascript. ``` if (function_name === 'search_recipes') { const searchParams = new URLSearchParams(); if (args.name) searchParams.set('name', args.name); if (args.difficulty) searchParams.set('difficulty', formatDifficulty(args.difficulty)); if (args.min_duration) searchParams.set('minDuration', args.min_duration.toString()); if (args.max_duration) searchParams.set('maxDuration', args.max_duration.toString()); if (args.tag) searchParams.set('tag', args.tag); // Handle ingredients array correctly - the search page expects ingredients[] if (args.ingredients && args.ingredients.length > 0) { // Clear any existing ingredients searchParams.delete('ingredients[]'); // Add each ingredient individually with the correct array notation args.ingredients.forEach((ingredient: string) => { searchParams.append('ingredients[]', ingredient); }); } const queryString = searchParams.toString(); const url = queryString ? `/search?${queryString}` : '/search'; navigate(url); return; } // start_cooking function if (function_name === 'start_cooking') { // First check if we have an onStartCooking callback registered if (callbacksRef.current.onStartCooking) { callbacksRef.current.onStartCooking(); return; } } ```
- Gaming8392 2y ago[dead]
- tomblomfield 2y agoAfraid I have a day job, so I will politely decline your kind invitation
- ada1981 2y agoThanks! I’m going to show the folks what you built. We have VCs, founders, and all Sorts of folks who join us every week.