GenkitG
Genkitโ€ข2mo agoโ€ข
64 replies
military-pink

my app stores some data using a nested

my app stores some data using a nested schema of objects which i wish to pass to a tool as parameter. The current definition of the tool looks like below:

const getFutureExpenseValue = agenticAi.defineTool( { name: 'getFutureExpenseValue', description: 'Calculates future value of current monthly non business expenses at desired age considering inflation rate', inputSchema: z.object({ finance: z.any().describe('user financial portfolio data including assets, liabilities, expenses, annual income, total assets, total liabilities, passive income and monthly non business expense amount'), birthYear: z.number().describe('Year of birth of the user in YYYY format'), desiredAge: z.number().describe('Desired F.I.R.E. age or retirement age of the user'), inflationRate: z.number().describe('Current annual inflation rate for the given country') }), outputSchema: z.object({ futureMonthlyExpense: z.number().describe('Estimated future monthly non business expense amount at desired age considering inflation rate') }), }, async ({finance, birthYear, desiredAge, inflationRate}) => { logger.log("#TOOL calculating future monthly expense for finance:", finance, "desiredAge:", desiredAge, " birthYear:", birthYear, " inflationRate:", inflationRate)


the issue is that finance object is not really a z schema type. So, how should i pass the finance object to the tool? Currently, it is showing value undefined in the tool.
Was this page helpful?