-
Hello! I am playing around with examples involving tools. Could you please explain how to enforce the model to convert user requests to the expected input format? Or what's the recommended way to implement that? Let's say we have a tool createReminder and a user requests, "Please remind me to drink water tomorrow at noon." The tool receives the request with { "input": {"time": "tomorrow at noon", "reminder": "Drink water" }}, but not in an ISO timestamp string as described in the schema. export const createReminder = defineTool(
{
name: 'createReminder',
description: 'Use this to create reminders for things in the future.',
inputSchema: z.object({
time: z
.string()
.describe('ISO timestamp string, e.g. 2024-04-03T12:23:00Z.'),
reminder: z.string().describe('the content of the reminder')
}),
outputSchema: z.number().describe('the ID of the created reminder')
},
(reminder) =>
new Promise((resolve) => {
console.log(`Saving Reminder: ${reminder}`);
return resolve(1);
})
); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I understand. Since the model doesn't have real-time awareness of the current date, converting relative times like "tomorrow at noon" into absolute times (such as ISO timestamps) requires additional steps or tools. |
Beta Was this translation helpful? Give feedback.
I understand. Since the model doesn't have real-time awareness of the current date, converting relative times like "tomorrow at noon" into absolute times (such as ISO timestamps) requires additional steps or tools.