foundry-local-sdk / Model
Represents a high-level AI model that may have multiple variants (e.g., quantized versions, different formats). Manages the selection and interaction with a specific model variant.
new Model(variant): Model;| Parameter | Type |
|---|---|
variant |
ModelVariant |
Model
get alias(): string;Gets the alias of the model.
string
The model alias.
get capabilities(): string | null;string | null
get contextLength(): number | null;number | null
get id(): string;Gets the ID of the currently selected variant.
string
The ID of the selected variant.
get info(): ModelInfo;Gets the ModelInfo of the currently selected variant.
The ModelInfo object.
get inputModalities(): string | null;string | null
get isCached(): boolean;Checks if the currently selected variant is cached locally.
boolean
True if cached, false otherwise.
get outputModalities(): string | null;string | null
get path(): string;Gets the local file path of the currently selected variant.
string
The local file path.
get supportsToolCalling(): boolean | null;boolean | null
get variants(): IModel[];Gets all available variants for this model.
IModel[]
An array of IModel objects.
createAudioClient(): AudioClient;Creates an AudioClient for interacting with the model via audio operations.
An AudioClient instance.
createChatClient(): ChatClient;Creates a ChatClient for interacting with the model via chat completions.
A ChatClient instance.
createResponsesClient(baseUrl): ResponsesClient;Creates a ResponsesClient for interacting with the model via the Responses API.
| Parameter | Type | Description |
|---|---|---|
baseUrl |
string |
The base URL of the Foundry Local web service. |
A ResponsesClient instance.
download(progressCallback?): Promise<void>;Downloads the currently selected variant.
| Parameter | Type | Description |
|---|---|---|
progressCallback? |
(progress) => void |
Optional callback to report download progress. |
Promise<void>
isLoaded(): Promise<boolean>;Checks if the currently selected variant is loaded in memory.
Promise<boolean>
True if loaded, false otherwise.
load(): Promise<void>;Loads the currently selected variant into memory.
Promise<void>
A promise that resolves when the model is loaded.
removeFromCache(): void;Removes the currently selected variant from the local cache.
void
selectVariant(variant): void;Selects a specific variant.
| Parameter | Type | Description |
|---|---|---|
variant |
IModel |
The model variant to select. Must be one of the variants in variants. |
void
Error - If the variant does not belong to this model.
unload(): Promise<void>;Unloads the currently selected variant from memory.
Promise<void>
A promise that resolves when the model is unloaded.