Skip to content

Latest commit

 

History

History
446 lines (249 loc) · 6.35 KB

File metadata and controls

446 lines (249 loc) · 6.35 KB

foundry-local-sdk / Model

Class: 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.

Implements

Constructors

Constructor

new Model(variant): Model;

Parameters

Parameter Type
variant ModelVariant

Returns

Model

Accessors

alias

Get Signature

get alias(): string;

Gets the alias of the model.

Returns

string

The model alias.

Implementation of

IModel.alias


capabilities

Get Signature

get capabilities(): string | null;
Returns

string | null

Implementation of

IModel.capabilities


contextLength

Get Signature

get contextLength(): number | null;
Returns

number | null

Implementation of

IModel.contextLength


id

Get Signature

get id(): string;

Gets the ID of the currently selected variant.

Returns

string

The ID of the selected variant.

Implementation of

IModel.id


info

Get Signature

get info(): ModelInfo;

Gets the ModelInfo of the currently selected variant.

Returns

ModelInfo

The ModelInfo object.

Implementation of

IModel.info


inputModalities

Get Signature

get inputModalities(): string | null;
Returns

string | null

Implementation of

IModel.inputModalities


isCached

Get Signature

get isCached(): boolean;

Checks if the currently selected variant is cached locally.

Returns

boolean

True if cached, false otherwise.

Implementation of

IModel.isCached


outputModalities

Get Signature

get outputModalities(): string | null;
Returns

string | null

Implementation of

IModel.outputModalities


path

Get Signature

get path(): string;

Gets the local file path of the currently selected variant.

Returns

string

The local file path.

Implementation of

IModel.path


supportsToolCalling

Get Signature

get supportsToolCalling(): boolean | null;
Returns

boolean | null

Implementation of

IModel.supportsToolCalling


variants

Get Signature

get variants(): IModel[];

Gets all available variants for this model.

Returns

IModel[]

An array of IModel objects.

Implementation of

IModel.variants

Methods

createAudioClient()

createAudioClient(): AudioClient;

Creates an AudioClient for interacting with the model via audio operations.

Returns

AudioClient

An AudioClient instance.

Implementation of

IModel.createAudioClient


createChatClient()

createChatClient(): ChatClient;

Creates a ChatClient for interacting with the model via chat completions.

Returns

ChatClient

A ChatClient instance.

Implementation of

IModel.createChatClient


createResponsesClient()

createResponsesClient(baseUrl): ResponsesClient;

Creates a ResponsesClient for interacting with the model via the Responses API.

Parameters

Parameter Type Description
baseUrl string The base URL of the Foundry Local web service.

Returns

ResponsesClient

A ResponsesClient instance.

Implementation of

IModel.createResponsesClient


download()

download(progressCallback?): Promise<void>;

Downloads the currently selected variant.

Parameters

Parameter Type Description
progressCallback? (progress) => void Optional callback to report download progress.

Returns

Promise<void>

Implementation of

IModel.download


isLoaded()

isLoaded(): Promise<boolean>;

Checks if the currently selected variant is loaded in memory.

Returns

Promise<boolean>

True if loaded, false otherwise.

Implementation of

IModel.isLoaded


load()

load(): Promise<void>;

Loads the currently selected variant into memory.

Returns

Promise<void>

A promise that resolves when the model is loaded.

Implementation of

IModel.load


removeFromCache()

removeFromCache(): void;

Removes the currently selected variant from the local cache.

Returns

void

Implementation of

IModel.removeFromCache


selectVariant()

selectVariant(variant): void;

Selects a specific variant.

Parameters

Parameter Type Description
variant IModel The model variant to select. Must be one of the variants in variants.

Returns

void

Throws

Error - If the variant does not belong to this model.

Implementation of

IModel.selectVariant


unload()

unload(): Promise<void>;

Unloads the currently selected variant from memory.

Returns

Promise<void>

A promise that resolves when the model is unloaded.

Implementation of

IModel.unload