GenkitG
Genkitโ€ข2mo ago
military-pink

I am struggling validation issues for

I am struggling validation issues for output schema mapping. here is the schema and flow def:

const userProfileFinSchema = z.object({ "profile": z.object({ "currentAge": z.number().optional().describe("User current age"), }).optional() }) export const enrichFlow = agenticAi.defineFlow( { name: 'enrichFlow', inputSchema: z.object({msg: z.string(), chatHistory: z.array(MessageSchema)}), outputSchema: userProfileFinSchema }, async ({msg, chatHistory},{ context }) => { const response = await agenticAi.generate({ system: "My sys prompt", prompt: msg, messages: chatHistory, output: { schema: userProfileFinSchema }, model: googleAI.model('gemini-2.5-flash'), }); return response }, );
Was this page helpful?