122 lines
2.9 KiB
TypeScript
122 lines
2.9 KiB
TypeScript
/**
|
|
* ModelGrid Configuration Interfaces
|
|
*
|
|
* Defines the configuration structure for the ModelGrid daemon.
|
|
*/
|
|
|
|
import type { IContainerConfig } from './container.ts';
|
|
|
|
/**
|
|
* API server configuration
|
|
*/
|
|
export interface IApiConfig {
|
|
/** Port to listen on (default: 8080) */
|
|
port: number;
|
|
/** Host to bind to (default: '0.0.0.0') */
|
|
host: string;
|
|
/** Valid API keys for authentication */
|
|
apiKeys: string[];
|
|
/** Rate limit in requests per minute (optional) */
|
|
rateLimit?: number;
|
|
/** Enable CORS (default: false) */
|
|
cors?: boolean;
|
|
/** Allowed origins for CORS */
|
|
corsOrigins?: string[];
|
|
}
|
|
|
|
/**
|
|
* Docker/container runtime configuration
|
|
*/
|
|
export interface IDockerConfig {
|
|
/** Docker network name (default: 'modelgrid') */
|
|
networkName: string;
|
|
/** Container runtime to use */
|
|
runtime: 'docker' | 'podman';
|
|
/** Path to docker/podman socket (optional) */
|
|
socketPath?: string;
|
|
}
|
|
|
|
/**
|
|
* GPU assignment configuration
|
|
*/
|
|
export interface IGpuAssignmentConfig {
|
|
/** Whether to auto-detect GPUs */
|
|
autoDetect: boolean;
|
|
/** Manual GPU to container assignments (gpuId -> containerId) */
|
|
assignments: Record<string, string>;
|
|
}
|
|
|
|
/**
|
|
* Model management configuration
|
|
*/
|
|
export interface IModelConfig {
|
|
/** URL to fetch greenlit models list */
|
|
greenlistUrl: string;
|
|
/** Whether to auto-pull models when requested */
|
|
autoPull: boolean;
|
|
/** Default container type for new models */
|
|
defaultContainer: 'ollama' | 'vllm' | 'tgi';
|
|
/** Models to auto-load on startup */
|
|
autoLoad: string[];
|
|
}
|
|
|
|
/**
|
|
* Main ModelGrid configuration interface
|
|
*/
|
|
export interface IModelGridConfig {
|
|
/** Configuration format version */
|
|
version: string;
|
|
/** API server configuration */
|
|
api: IApiConfig;
|
|
/** Docker configuration */
|
|
docker: IDockerConfig;
|
|
/** GPU configuration */
|
|
gpus: IGpuAssignmentConfig;
|
|
/** Container configurations */
|
|
containers: IContainerConfig[];
|
|
/** Model management configuration */
|
|
models: IModelConfig;
|
|
/** Health check interval in milliseconds */
|
|
checkInterval: number;
|
|
}
|
|
|
|
/**
|
|
* Greenlit model entry from remote list
|
|
*/
|
|
export interface IGreenlitModel {
|
|
/** Model name (e.g., "llama3:8b") */
|
|
name: string;
|
|
/** Preferred container type */
|
|
container: 'ollama' | 'vllm' | 'tgi';
|
|
/** Minimum VRAM required in GB */
|
|
minVram: number;
|
|
/** Optional tags for categorization */
|
|
tags?: string[];
|
|
/** Optional description */
|
|
description?: string;
|
|
}
|
|
|
|
/**
|
|
* Greenlit models list structure
|
|
*/
|
|
export interface IGreenlitModelsList {
|
|
/** List version */
|
|
version: string;
|
|
/** Last updated timestamp */
|
|
lastUpdated: string;
|
|
/** List of greenlit models */
|
|
models: IGreenlitModel[];
|
|
}
|
|
|
|
/**
|
|
* Update status information
|
|
*/
|
|
export interface IUpdateStatus {
|
|
/** Current installed version */
|
|
currentVersion: string;
|
|
/** Latest available version */
|
|
latestVersion: string;
|
|
/** Whether an update is available */
|
|
updateAvailable: boolean;
|
|
}
|