Skip to content

Instantly share code, notes, and snippets.

@dgalarza
Created June 3, 2026 19:49
Show Gist options
  • Select an option

  • Save dgalarza/4c23467f005c9f60d138ac781f00c99c to your computer and use it in GitHub Desktop.

Select an option

Save dgalarza/4c23467f005c9f60d138ac781f00c99c to your computer and use it in GitHub Desktop.
generateObject.ts
import { generateObject } from "ai";
import { createOpenAI } from "@ai-sdk/openai";
const localClassifier = createOpenAI({
baseURL: "http://127.0.0.1:11434/v1",
apiKey: "ollama",
});
const { object } = await generateObject({
model: localClassifier("ministral-3:8b"),
schema: classificationSchema.omit({ routing: true }),
system: classifierSystemPrompt,
prompt: JSON.stringify(email, null, 2),
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment