import { generateText, tool } from "ai";
import { anthropic } from "@ai-sdk/anthropic";
import { z } from "zod";
import { podflareRunCode } from "podflare/ai-sdk";
const pf = podflareRunCode();
const runCode = tool({
description: pf.description,
parameters: z.object({
code: z.string().describe("Python (default) or bash source"),
language: z.enum(["python", "bash"]).optional(),
}),
execute: pf.execute,
});
const { text } = await generateText({
model: anthropic("claude-opus-4-7"),
tools: { runCode },
prompt: "Load /data/sales.csv and tell me the top 5 products by revenue.",
});
console.log(text);
await pf.close();