@smythos/sdk
Version:
41 lines (40 loc) • 1.51 kB
TypeScript
import { TCustomLLMModel, TLLMProvider, TLLMModel } from '@smythos/sre';
import { TLLMInstanceParams } from './LLMInstance.class';
/**
* Model factory functions for each LLM provider.
*
* **Supported calling patterns:**
* - `Model.provider(modelId, modelParams)` - specify model ID and optional parameters
* - `Model.provider(modelParams)` - specify model ID within modelParams object
*
* @example
* ```typescript
* // Pattern 1: Explicit model ID
* const model1 = Model.openai('gpt-4', { temperature: 0.7 });
*
* // Pattern 2: Model ID in params
* const model2 = Model.openai({ model: 'gpt-4', temperature: 0.7 });
* ```
*/
export type TModelFactory = {
/**
* Create a model with explicit model ID and optional parameters.
*
* @param modelId - The model identifier (e.g., `'gpt-4'`, `'claude-3-sonnet'`)
* @param modelParams - Optional model parameters (temperature, maxTokens, etc.)
* @returns Configured model object
*/
(modelId: string, modelParams?: TLLMInstanceParams): any;
/**
* Create a model with parameters object containing model ID.
*
* @param modelParams - Model parameters including the required `model` field
* @returns Configured model object
*/
(modelParams: TLLMInstanceParams & {
model: string | TLLMModel | TCustomLLMModel;
}): any;
};
declare const Model: Record<TLLMProvider, TModelFactory>;
export declare function findClosestModelInfo(models: any, modelId: string): any;
export { Model };