import GLib from "gi://GLib"; export type Backend = "deepseek" | "ollama"; export type LLMConfig = { backend: Backend; baseUrl: string; apiKey?: string; model: string; systemPrompt?: string; }; /** * Sensible defaults per backend. */ export const BACKEND_DEFAULTS: Record> = { deepseek: { baseUrl: "https://api.deepseek.com", apiKey: GLib.getenv("DEEPSEEK_API_KEY") ?? "", systemPrompt: "You are a helpful assistant. Provide short answers.", }, ollama: { baseUrl: "http://localhost:11434", systemPrompt: "You are a helpful assistant. Provide short answers.", }, }; /** * Predefined models per backend. * The first model in each list is the default for that backend. */ export const MODELS: Record = { deepseek: [ "deepseek-v4-flash", "deepseek-v4-pro", ], ollama: [ "granite4.1:3b", ], }; /** Build a full LLMConfig for the given backend and optional model override. */ export function getConfig(backend: Backend, model?: string): LLMConfig { const defaults = BACKEND_DEFAULTS[backend]; return { backend, ...defaults, model: model ?? MODELS[backend][0], }; }