Skip to content

Latest commit

 

History

History
246 lines (148 loc) · 6.2 KB

File metadata and controls

246 lines (148 loc) · 6.2 KB

IModel

Namespace: Microsoft.AI.Foundry.Local

public interface IModel

Attributes NullableContextAttribute

Properties

Id

public abstract string Id { get; }

Property Value

String

Alias

public abstract string Alias { get; }

Property Value

String

Info

public abstract ModelInfo Info { get; }

Property Value

ModelInfo

Variants

Variants of the model that are available. Variants of the model are optimized for different devices.

public abstract IReadOnlyList<IModel> Variants { get; }

Property Value

IReadOnlyList<IModel>

Methods

IsCachedAsync(Nullable<CancellationToken>)

Task<bool> IsCachedAsync(Nullable<CancellationToken> ct)

Parameters

ct Nullable<CancellationToken>

Returns

Task<Boolean>

IsLoadedAsync(Nullable<CancellationToken>)

Task<bool> IsLoadedAsync(Nullable<CancellationToken> ct)

Parameters

ct Nullable<CancellationToken>

Returns

Task<Boolean>

DownloadAsync(Action<Single>, Nullable<CancellationToken>)

Download the model to local cache if not already present.

Task DownloadAsync(Action<float> downloadProgress, Nullable<CancellationToken> ct)

Parameters

downloadProgress Action<Single>
Optional progress callback for download progress. Percentage download (0 - 100.0) is reported.

ct Nullable<CancellationToken>
Optional cancellation token.

Returns

Task

GetPathAsync(Nullable<CancellationToken>)

Gets the model path if cached.

Task<string> GetPathAsync(Nullable<CancellationToken> ct)

Parameters

ct Nullable<CancellationToken>
Optional cancellation token.

Returns

Task<String>
Path of model directory.

LoadAsync(Nullable<CancellationToken>)

Load the model into memory if not already loaded.

Task LoadAsync(Nullable<CancellationToken> ct)

Parameters

ct Nullable<CancellationToken>
Optional cancellation token.

Returns

Task

RemoveFromCacheAsync(Nullable<CancellationToken>)

Remove the model from the local cache.

Task RemoveFromCacheAsync(Nullable<CancellationToken> ct)

Parameters

ct Nullable<CancellationToken>
Optional cancellation token.

Returns

Task

UnloadAsync(Nullable<CancellationToken>)

Unload the model if loaded.

Task UnloadAsync(Nullable<CancellationToken> ct)

Parameters

ct Nullable<CancellationToken>
Optional cancellation token.

Returns

Task

GetChatClientAsync(Nullable<CancellationToken>)

Get an OpenAI API based ChatClient

Task<OpenAIChatClient> GetChatClientAsync(Nullable<CancellationToken> ct)

Parameters

ct Nullable<CancellationToken>
Optional cancellation token.

Returns

Task<OpenAIChatClient>
OpenAI.ChatClient

GetAudioClientAsync(Nullable<CancellationToken>)

Get an OpenAI API based AudioClient

Task<OpenAIAudioClient> GetAudioClientAsync(Nullable<CancellationToken> ct)

Parameters

ct Nullable<CancellationToken>
Optional cancellation token.

Returns

Task<OpenAIAudioClient>
OpenAI.AudioClient

GetEmbeddingClientAsync(Nullable<CancellationToken>)

Get an OpenAI API based EmbeddingClient

Task<OpenAIEmbeddingClient> GetEmbeddingClientAsync(Nullable<CancellationToken> ct)

Parameters

ct Nullable<CancellationToken>
Optional cancellation token.

Returns

Task<OpenAIEmbeddingClient>
OpenAI.EmbeddingClient

SelectVariant(IModel)

Select a model variant from IModel.Variants to use for IModel operations. An IModel from Variants can also be used directly.

void SelectVariant(IModel variant)

Parameters

variant IModel
Model variant to select. Must be one of the variants in IModel.Variants.

Exceptions

FoundryLocalException
If variant is not valid for this model.