UNPKG

modelmix

Version:

đŸ§¬ Reliable interface with automatic fallback for AI LLMs.

28 lines (25 loc) • 800 B
import { ModelMix } from '../index.js'; try { process.loadEnvFile(); } catch {} const model = await ModelMix.new({ options: { max_tokens: 10000 }, config: { debug: 3 } }) .gpt54nano() // .gptOss() // .scout({ config: { temperature: 0 } }) // .o4mini() // .gpt45() // .gemini25flash() .addText("Name and capital of 3 South American countries.") const jsonResult = await model.json([{ name: "Argentina", capital: "BUENOS AIRES" }, { name: "Brazil", capital: "BRASILIA" }, { name: "Colombia", capital: "BOGOTA" }], [{ name: { description: "name of the country", enum: ["PerĂº", "Colombia", "Argentina"] }, capital: "capital of the country in uppercase" }], { addNote: true }); console.log(jsonResult); console.log(model.lastRaw.tokens);