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
},
);