import { ollama } from "ollama-ai-provider";
import { generateObject } from "ai";
import { z } from "zod";
import { parseArgs } from "node:util";
const { positionals } = parseArgs({
allowPositionals: true,
});
const model = ollama("gemma3:latest");
const prompt = positionals[0];
const { object } = await generateObject({
model,
schema: z.object({
command: z
.string()
.describe("The command to execute, e.g. 'summarize' or 'translate'"),
}),
prompt,
});
console.log(object);
/**
➜ ollama-vercel-language-scripting bun index.ts "Download a file"
{
command: "download",
}
➜ ollama-vercel-language-scripting bun index.ts "I want to download a file fromo internet"
{
command: "download",
}
*/