using AIStudio.Chat; namespace AIStudio.Provider; /// /// A common interface for all providers. /// public interface IProvider { /// /// The provider's ID. /// public string Id { get; } /// /// The provider's instance name. Useful for multiple instances of the same provider, /// e.g., to distinguish between different OpenAI API keys. /// public string InstanceName { get; } /// /// Starts a chat completion stream. /// /// The model to use for chat completion. /// The chat thread to continue. /// The cancellation token. /// The chat completion stream. public IAsyncEnumerable StreamChatCompletion(Model chatModel, ChatThread chatThread, CancellationToken token = default); /// /// Starts an image completion stream. /// /// The model to use for image completion. /// The positive prompt. /// The negative prompt. /// The reference image URL. /// The cancellation token. /// The image completion stream. public IAsyncEnumerable StreamImageCompletion(Model imageModel, string promptPositive, string promptNegative = FilterOperator.String.Empty, ImageURL referenceImageURL = default, CancellationToken token = default); /// /// Load all possible text models that can be used with this provider. /// /// The provisional API key to use. Useful when the user is adding a new provider. When null, the stored API key is used. /// The cancellation token. /// The list of text models. public Task> GetTextModels(string? apiKeyProvisional = null, CancellationToken token = default); /// /// Load all possible image models that can be used with this provider. /// /// The provisional API key to use. Useful when the user is adding a new provider. When null, the stored API key is used. /// The cancellation token. /// The list of image models. public Task> GetImageModels(string? apiKeyProvisional = null, CancellationToken token = default); /// /// Load all possible embedding models that can be used with this provider. /// /// The provisional API key to use. Useful when the user is adding a new provider. When null, the stored API key is used. /// The cancellation token. /// The list of embedding models. public Task> GetEmbeddingModels(string? apiKeyProvisional = null, CancellationToken token = default); }