gadget/packages/api/src/interfaces/ai-provider.ts
Rob Colbert cc6d3b901a refactor gadget-code model interfaces to @gadget/api
Moved all Mongoose model interfaces to @gadget/api to commonize the data
structures being passed around the system as JSON objects via HTTP and
Socket.IO.
2026-04-28 12:42:32 -04:00

60 lines
1.7 KiB
TypeScript

// src/interfaces/ai-provider.ts
// Copyright (C) 2026 Rob Colbert <rob.colbert@openplatform.us>
// Licensed under the Apache License, Version 2.0
export type AiApiType = "ollama" | "openai";
/**
* Normalised capability flags stored with each model record. These are
* populated during model refresh from provider-specific metadata and drive
* slot-based filtering in the UI (e.g. only canCallTools models for Agent).
*/
export interface IAiModelSettings {
temperature?: number;
topP?: number;
topK?: number;
numCtx?: number;
}
export interface IAiModelCapabilities {
/** Model supports structured function / tool calling via the API. */
canCallTools: boolean;
/** Model accepts image inputs (multimodal / vision). */
hasVision: boolean;
/** Model can produce vector embeddings (required for the Vector slot). */
hasEmbedding: boolean;
/** Model has an explicit reasoning / thinking phase (e.g. o1, QwQ). */
hasThinking: boolean;
/** Model is instruction-tuned / chat-tuned (as opposed to a base model). */
isInstructTuned: boolean;
}
export interface IAiModel {
id: string;
name: string;
/**
* Raw parameter count in billions (float). Use parameterLabel for display.
*/
parameterCount?: number;
/**
* Human-readable parameter size label sourced directly from the provider,
* e.g. "7b", "70b", "3.8b".
*/
parameterLabel?: string;
contextWindow?: number;
capabilities: IAiModelCapabilities;
settings?: IAiModelSettings;
}
import { Document } from "mongoose";
export interface IAiProvider extends Document {
name: string;
apiType: AiApiType;
baseUrl: string;
apiKey: string;
enabled: boolean;
models: IAiModel[];
lastModelRefresh: Date;
}