import { bedrock } from "@ai-sdk/amazon-bedrock"
import { generateText, isStepCount, jsonSchema, tool } from "ai"
import { Doconda } from "@doconda/sdk"
const doconda = new Doconda()
const tools = Object.fromEntries(
doconda.tools().map((t) => [
t.name,
tool({ description: t.description, inputSchema: jsonSchema(t.inputSchema), execute: (input) => t.run(input as Record<string, unknown>) }),
]),
)
const { text } = await generateText({
model: bedrock(process.env.BEDROCK_MODEL_ID!),
tools,
stopWhen: isStepCount(5),
prompt: "Make me an Excel file with the event budget: venue, catering, sound and travel",
})
console.log(text)