You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -290,9 +290,6 @@ export class GoogleRoutesAPI extends StructuredTool {
290
290
Expected departure time should be provided as a timestamp in RFC3339 format: YYYY-MM-DDThh:mm:ss+00:00. The date should be in UTC time and the +00:00 represents the UTC offset.
291
291
For instance, if the the user's timezone is -5, the offset would be -05:00 meaning YYYY-MM-DDThh:mm:ss-05:00 with YYYY-MM-DDThh:mm:ss being in UTC.
292
292
For reference, here is the current time in UTC: ${newDate().toISOString()} and the user's timezone offset is ${getTimezoneOffsetInHours()}.
293
-
Reminder that the departure time must be in the future.
294
-
If the user asks for a departure time in the past, warn them that it is not possible.
295
-
If the user asks for a departure time in a passed hour today, calculate it for the next day.
296
293
If the departure time is not specified it should not be included.
297
294
`
298
295
),
@@ -305,34 +302,26 @@ export class GoogleRoutesAPI extends StructuredTool {
305
302
Expected arrival time should be provided as a timestamp in RFC3339 format: YYYY-MM-DDThh:mm:ss+00:00. The date should be in UTC time and the +00:00 represents the UTC offset.
306
303
For instance, if the the user's timezone is -5, the offset would be -05:00 meaning YYYY-MM-DDThh:mm:ss-05:00 with YYYY-MM-DDThh:mm:ss being in UTC.
307
304
For reference, here is the current time in UTC: ${newDate().toISOString()} and the user's timezone offset is ${getTimezoneOffsetInHours()}.
308
-
Reminder that the arrival time must be in the future, if the user asks for a departure time in the past, warn them that it is not possible.
309
-
If the user asks for a departure time in a passed hour today, calculate it for the next day.
310
-
Arrival time only works for transit mode. It should not be included if transit mode is not selected.
311
-
If the user wants to calculate the arrival time for other modes you must warn them that it is not possible.
305
+
Reminder that the arrival time must be in the future, if the user asks for a arrival time in the past instead of processing the request, warn them that it is not possible to calculate a route for a past time.
306
+
If the user asks for a arrival time in a passed hour today, calculate it for the next day.
312
307
If the arrival time is not specified it should not be included. `
It should not be included if transit mode is not selected.
320
313
By default, it should not be included.`),
321
314
})
322
315
.optional()
323
316
.describe(
324
317
`Transit routing preference.
325
-
Only works for transit mode.
326
-
It should not be included if transit mode is not selected.
327
318
By default, it should not be included.`
328
319
),
329
320
extraComputations: z
330
321
.array(z.enum(["TOLLS"]))
331
322
.optional()
332
323
.describe(
333
-
`Calculate tolls for the route.
334
-
Does not work for transit mode.
335
-
It should not be included if transit mode is selected, if the user wants to calculate tolls for transit mode you should warn them that it is not possible.`
324
+
`Calculate tolls for the route.`
336
325
),
337
326
});
338
327
}
@@ -349,7 +338,23 @@ export class GoogleRoutesAPI extends StructuredTool {
349
338
extraComputations,
350
339
}=input;
351
340
352
-
console.log("input:",input);
341
+
constnow=newDate();
342
+
343
+
if(departureTime&&newDate(departureTime)<now){
344
+
return"It is not possible to calculate a route with a past departure time. Warn the user that it is not possible to calculate a route with a past departure time.";
345
+
}
346
+
347
+
if(arrivalTime&&newDate(arrivalTime)<now){
348
+
return"It is not possible to calculate a route with a past arrival time. Warn the user that it is not possible to calculate a route with a past arrival time.";
349
+
}
350
+
351
+
if(travel_mode!=="TRANSIT"&&arrivalTime){
352
+
return"It is not possible to calculate an arrival time for modes other than transit. Warn the user that it is not possible to calculate an arrival time for the selected mode of transport.";
353
+
}
354
+
355
+
if(travel_mode==="TRANSIT"&&extraComputations){
356
+
return"It is not possible to calculate tolls for transit mode. Warn the user that it is not possible to calculate tolls for transit mode.";
357
+
}
353
358
354
359
constbody: Body={
355
360
origin: {
@@ -413,7 +418,7 @@ export class GoogleRoutesAPI extends StructuredTool {
0 commit comments