execute: async ({ inputData, mastra }) => {
const { screenshots } = inputData;
const agent = mastra.getAgent("gameExtractorAgent");
const imageParts: any[] = screenshots.map(({ base64, mimeType }) => ({
type: "image",
image: base64,
mimeType,
}));
const justOneImage = imageParts.slice(0, 1);
const content: any[] = [
{
type: "text",
text: "Analyze these screenshots and extract all available statistics.",
},
// ...imageParts,
...justOneImage,
];
const result = await agent.generate([{ role: "user", content }], {
structuredOutput: {
schema: gameStatsSchema,
},
});
execute: async ({ inputData, mastra }) => {
const { screenshots } = inputData;
const agent = mastra.getAgent("gameExtractorAgent");
const imageParts: any[] = screenshots.map(({ base64, mimeType }) => ({
type: "image",
image: base64,
mimeType,
}));
const justOneImage = imageParts.slice(0, 1);
const content: any[] = [
{
type: "text",
text: "Analyze these screenshots and extract all available statistics.",
},
// ...imageParts,
...justOneImage,
];
const result = await agent.generate([{ role: "user", content }], {
structuredOutput: {
schema: gameStatsSchema,
},
});