Namespace: Microsoft.AI.Foundry.Local
public interface IModelAttributes NullableContextAttribute
public abstract string Id { get; }public abstract string Alias { get; }public abstract ModelInfo Info { get; }Variants of the model that are available. Variants of the model are optimized for different devices.
public abstract IReadOnlyList<IModel> Variants { get; }Task<bool> IsCachedAsync(Nullable<CancellationToken> ct)ct Nullable<CancellationToken>
Task<bool> IsLoadedAsync(Nullable<CancellationToken> ct)ct Nullable<CancellationToken>
Download the model to local cache if not already present.
Task DownloadAsync(Action<float> downloadProgress, Nullable<CancellationToken> ct)downloadProgress Action<Single>
Optional progress callback for download progress.
Percentage download (0 - 100.0) is reported.
ct Nullable<CancellationToken>
Optional cancellation token.
Gets the model path if cached.
Task<string> GetPathAsync(Nullable<CancellationToken> ct)ct Nullable<CancellationToken>
Optional cancellation token.
Task<String>
Path of model directory.
Load the model into memory if not already loaded.
Task LoadAsync(Nullable<CancellationToken> ct)ct Nullable<CancellationToken>
Optional cancellation token.
Remove the model from the local cache.
Task RemoveFromCacheAsync(Nullable<CancellationToken> ct)ct Nullable<CancellationToken>
Optional cancellation token.
Unload the model if loaded.
Task UnloadAsync(Nullable<CancellationToken> ct)ct Nullable<CancellationToken>
Optional cancellation token.
Get an OpenAI API based ChatClient
Task<OpenAIChatClient> GetChatClientAsync(Nullable<CancellationToken> ct)ct Nullable<CancellationToken>
Optional cancellation token.
Task<OpenAIChatClient>
OpenAI.ChatClient
Get an OpenAI API based AudioClient
Task<OpenAIAudioClient> GetAudioClientAsync(Nullable<CancellationToken> ct)ct Nullable<CancellationToken>
Optional cancellation token.
Task<OpenAIAudioClient>
OpenAI.AudioClient
Get an OpenAI API based EmbeddingClient
Task<OpenAIEmbeddingClient> GetEmbeddingClientAsync(Nullable<CancellationToken> ct)ct Nullable<CancellationToken>
Optional cancellation token.
Task<OpenAIEmbeddingClient>
OpenAI.EmbeddingClient
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)variant IModel
Model variant to select. Must be one of the variants in IModel.Variants.
FoundryLocalException
If variant is not valid for this model.