File tree Expand file tree Collapse file tree 8 files changed +16
-16
lines changed
examples/calling-apis/chatbot/app Expand file tree Collapse file tree 8 files changed +16
-16
lines changed Original file line number Diff line number Diff line change 11import { tool } from "ai" ;
2- import { addHours , formatISO } from "date-fns" ;
2+ import { addDays , formatISO } from "date-fns" ;
33import { GaxiosError } from "gaxios" ;
44import { google } from "googleapis" ;
55import { z } from "zod/v3" ;
@@ -32,7 +32,7 @@ export const checkUsersCalendar = withGoogleCalendar(
3232 auth,
3333 requestBody : {
3434 timeMin : formatISO ( date ) ,
35- timeMax : addHours ( date , 1 ) . toISOString ( ) ,
35+ timeMax : addDays ( date , 1 ) . toISOString ( ) ,
3636 timeZone : "UTC" ,
3737 items : [ { id : "primary" } ] ,
3838 } ,
Original file line number Diff line number Diff line change 1- import { addHours , formatISO } from "date-fns" ;
1+ import { addDays , formatISO } from "date-fns" ;
22import { GaxiosError } from "gaxios" ;
33import { google } from "googleapis" ;
44import { z } from "zod/v3" ;
@@ -40,7 +40,7 @@ export const checkUsersCalendar = ai.defineTool(
4040 auth,
4141 requestBody : {
4242 timeMin : formatISO ( date ) ,
43- timeMax : addHours ( date , 1 ) . toISOString ( ) ,
43+ timeMax : addDays ( date , 1 ) . toISOString ( ) ,
4444 timeZone : "UTC" ,
4545 items : [ { id : "primary" } ] ,
4646 } ,
Original file line number Diff line number Diff line change 1- import { addHours , formatISO } from "date-fns" ;
1+ import { addDays , formatISO } from "date-fns" ;
22import { GaxiosError } from "gaxios" ;
33import { google } from "googleapis" ;
44import { z } from "zod/v3" ;
@@ -27,7 +27,7 @@ export const checkUsersCalendar = withGoogleCalendar(
2727 auth,
2828 requestBody : {
2929 timeMin : formatISO ( date ) ,
30- timeMax : addHours ( date , 1 ) . toISOString ( ) ,
30+ timeMax : addDays ( date , 1 ) . toISOString ( ) ,
3131 timeZone : "UTC" ,
3232 items : [ { id : "primary" } ] ,
3333 } ,
Original file line number Diff line number Diff line change 1- import { addHours , formatISO } from "date-fns" ;
1+ import { addDays , formatISO } from "date-fns" ;
22import { GaxiosError } from "gaxios" ;
33import { google } from "googleapis" ;
44import { tool } from "llamaindex" ;
@@ -28,7 +28,7 @@ export const checkUsersCalendar = () =>
2828 auth,
2929 requestBody : {
3030 timeMin : formatISO ( date ) ,
31- timeMax : addHours ( date , 1 ) . toISOString ( ) ,
31+ timeMax : addDays ( date , 1 ) . toISOString ( ) ,
3232 timeZone : "UTC" ,
3333 items : [ { id : "primary" } ] ,
3434 } ,
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ Then use the `withGoogleAccess` to wrap the tool and use `getAccessTokenFromToke
8383``` javascript
8484import { getAccessTokenFromTokenVault } from " @auth0/ai-genkit" ;
8585import { TokenVaultError } from " @auth0/ai/interrupts" ;
86- import { addHours } from " date-fns" ;
86+ import { addDays } from " date-fns" ;
8787import { z } from " zod" ;
8888
8989export const checkCalendarTool = ai .defineTool (
@@ -102,7 +102,7 @@ export const checkCalendarTool = ai.defineTool(
102102 const accessToken = getAccessTokenFromTokenVault ();
103103 const body = JSON .stringify ({
104104 timeMin: date,
105- timeMax: addHours (date, 1 ),
105+ timeMax: addDays (date, 1 ),
106106 timeZone: " UTC" ,
107107 items: [{ id: " primary" }],
108108 });
Original file line number Diff line number Diff line change @@ -78,15 +78,15 @@ Then use the `withGoogleAccess` to wrap the tool and use `getAccessTokenFromToke
7878import { tool } from " @langchain/core/tools" ;
7979import { getAccessTokenFromTokenVault } from " @auth0/ai-langchain" ;
8080import { TokenVaultError } from " @auth0/ai/interrupts" ;
81- import { addHours } from " date-fns" ;
81+ import { addDays } from " date-fns" ;
8282
8383export const checkCalendarTool = withGoogleAccess (
8484 tool (
8585 async ({ date }) => {
8686 const accessToken = getAccessTokenFromTokenVault ();
8787 const body = JSON .stringify ({
8888 timeMin: date,
89- timeMax: addHours (date, 1 ),
89+ timeMax: addDays (date, 1 ),
9090 timeZone: " UTC" ,
9191 items: [{ id: " primary" }],
9292 });
Original file line number Diff line number Diff line change @@ -82,15 +82,15 @@ Then use the `withGoogleAccess` to wrap the tool and use `getAccessTokenFromToke
8282import { tool } from " llamaindex" ;
8383import { getAccessTokenFromTokenVault } from " @auth0/ai-llamaindex" ;
8484import { TokenVaultError } from " @auth0/ai/interrupts" ;
85- import { addHours } from " date-fns" ;
85+ import { addDays } from " date-fns" ;
8686
8787export const checkUsersCalendar = withGoogleAccess (
8888 tool (async ({ date }) => {
8989 const accessToken = getAccessTokenFromTokenVault ();
9090 const url = " https://www.googleapis.com/calendar/v3/freeBusy" ;
9191 const body = JSON .stringify ({
9292 timeMin: date,
93- timeMax: addHours (date, 1 ),
93+ timeMax: addDays (date, 1 ),
9494 timeZone: " UTC" ,
9595 items: [{ id: " primary" }],
9696 });
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ Then use the `withGoogleAccess` to wrap the tool and use `getAccessTokenFromToke
8080import { tool } from " ai" ;
8181import { getAccessTokenFromTokenVault } from " @auth0/ai-vercel" ;
8282import { TokenVaultError } from " @auth0/ai/interrupts" ;
83- import { addHours } from " date-fns" ;
83+ import { addDays } from " date-fns" ;
8484
8585export const checkUsersCalendar = withGoogleAccess (
8686 tool ({
@@ -94,7 +94,7 @@ export const checkUsersCalendar = withGoogleAccess(
9494 const url = " https://www.googleapis.com/calendar/v3/freeBusy" ;
9595 const body = JSON .stringify ({
9696 timeMin: date,
97- timeMax: addHours (date, 1 ),
97+ timeMax: addDays (date, 1 ),
9898 timeZone: " UTC" ,
9999 items: [{ id: " primary" }],
100100 });
You can’t perform that action at this time.
0 commit comments