UNPKG

jorel

Version:

A unified wrapper for working with LLMs from multiple providers, including streams, images, documents & automatic tool use.

120 lines (119 loc) 3.45 kB
import { LogService } from "../logger"; import { ReasoningEffort, Verbosity } from "../providers"; export interface ModelSpecificDefaults { temperature?: number | null; reasoningEffort?: ReasoningEffort; verbosity?: Verbosity; } export interface ModelEntry { model: string; provider: string; defaults?: ModelSpecificDefaults; } /** * Manages models for JorEl */ export declare class JorElModelManager { private logger; private models; private embeddingModels; private defaultModel; private defaultEmbeddingModel; constructor(logger: LogService); /** * Register a model for an existing provider * @param model The model name * @param provider The provider name * @param setAsDefault Whether to set this model as the default * @returns The model entry * @throws Error - If the provider does not exist */ registerModel({ model, provider, setAsDefault, defaults, }: { model: string; provider: string; setAsDefault?: boolean; defaults?: ModelSpecificDefaults; }): void; /** * Set the defaults for a model * @param model The model name * @param defaults The defaults to set */ setModelSpecificDefaults(model: string, defaults: ModelSpecificDefaults): void; /** * Unregister a model * @param model The model name */ unregisterModel(model: string): void; /** * Get a model entry * @param model The model name * @returns The model entry * @throws Error - If the model does not exist */ getModel(model: string): ModelEntry; /** * Get the default model * @returns The default model id */ getDefaultModel(): string; /** * Set the default model * @param model The model name * @throws Error - If the model does not exist */ setDefaultModel(model: string): void; /** * List all models */ listModels(): ModelEntry[]; /** * Register an embedding model for an existing provider * @param model The model name * @param provider The provider name * @param dimensions The number of dimensions * @param setAsDefault Whether to set this model as the default * @returns The model entry * @throws Error - If the provider does not exist */ registerEmbeddingModel({ model, provider, dimensions, setAsDefault, }: { model: string; provider: string; dimensions: number; setAsDefault?: boolean; }): void; /** * Unregister an embedding model * @param model The model name */ unregisterEmbeddingModel(model: string): void; /** * Get an embedding model entry * @param model The model name * @returns The model entry * @throws Error - If the model does not exist */ getEmbeddingModel(model: string): { model: string; provider: string; }; /** * Get the default embedding model * @returns The default model id */ getDefaultEmbeddingModel(): string; /** * Set the default embedding model * @param model The model name * @throws Error - If the model does not exist */ setDefaultEmbeddingModel(model: string): void; /** * List all embedding models * @returns The list of embedding models */ listEmbeddingModels(): { model: string; provider: string; }[]; }