diff --git a/.gitignore b/.gitignore index 1b1f680f..406a20e9 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ Cargo.lock bin/ obj/ /src/cs/samples/ConsoleClient/test.http +logs/ \ No newline at end of file diff --git a/sdk_v2/cs/GENERATE-DOCS.md b/sdk_v2/cs/GENERATE-DOCS.md new file mode 100644 index 00000000..4ff9b5a6 --- /dev/null +++ b/sdk_v2/cs/GENERATE-DOCS.md @@ -0,0 +1,45 @@ +# Generating API Reference Docs + +The `docs/api/` folder contains auto-generated markdown from the C# XML documentation comments. This guide explains how to regenerate them. + +## Prerequisites + +Install xmldoc2md as a global dotnet tool: + +```bash +dotnet tool install -g XMLDoc2Markdown +``` + +## Steps + +### 1. Publish the SDK + +xmldoc2md needs the XML documentation file and all dependency DLLs in one folder. The project only generates the XML documentation file in **Release** mode (`-c Release`), so always publish with that configuration: + +```bash +dotnet publish src/Microsoft.AI.Foundry.Local.csproj -c Release -o src/bin/publish +``` + +### 2. Generate the docs + +```bash +dotnet xmldoc2md src/bin/publish/Microsoft.AI.Foundry.Local.dll --output docs/api --member-accessibility-level public +``` + +### All-in-one + +```powershell +dotnet publish src/Microsoft.AI.Foundry.Local.csproj -c Release -o src/bin/publish +dotnet xmldoc2md src/bin/publish/Microsoft.AI.Foundry.Local.dll --output docs/api --member-accessibility-level public +``` + +## Known Limitations + +xmldoc2md uses reflection metadata, which loses some C# language-level details: + +- **Nullable annotations stripped** — `Task` renders as `Task`. The `` text documents nullability, but the generated signature does not show `?`. +- **Record/init semantics lost** — Record types with `init`-only properties (e.g., `Runtime`, `ModelInfo`) are rendered with `{ get; set; }` instead of `{ get; init; }`. +- **Default parameter values omitted** — Optional parameters like `CancellationToken? ct = null` appear without their defaults. +- **Compiler-generated members surfaced** — Record types emit synthetic methods like `$()`, `Equals(T)`, `GetHashCode()`, and `ToString()` that appear in the generated docs. These are not part of the intended public API and should be ignored. + +These are cosmetic issues in the generated docs. Always refer to the source code or IntelliSense for the authoritative API surface. diff --git a/sdk_v2/cs/README.md b/sdk_v2/cs/README.md index 0297937e..d00aa4ff 100644 --- a/sdk_v2/cs/README.md +++ b/sdk_v2/cs/README.md @@ -1,59 +1,308 @@ # Foundry Local C# SDK -## Installation +The Foundry Local C# SDK provides a .NET interface for running AI models locally via the Foundry Local Core. Discover, download, load, and run inference entirely on your own machine — no cloud required. + +## Features -To use the Foundry Local C# SDK, you need to install the NuGet package: +- **Model catalog** — browse and search all available models; filter by cached or loaded state +- **Lifecycle management** — download, load, unload, and remove models programmatically +- **Chat completions** — synchronous and `IAsyncEnumerable` streaming via OpenAI-compatible types +- **Audio transcription** — transcribe audio files with streaming support +- **Download progress** — wire up an `Action` callback for real-time download percentage +- **Model variants** — select specific hardware/quantization variants per model alias +- **Optional web service** — start an OpenAI-compatible REST endpoint (`/v1/chat_completions`, `/v1/models`) +- **WinML acceleration** — opt-in Windows hardware acceleration with automatic EP download +- **Full async/await** — every operation supports `CancellationToken` and async patterns +- **IDisposable** — deterministic cleanup of native resources + +## Installation ```bash dotnet add package Microsoft.AI.Foundry.Local ``` ### Building from source -To build the SDK, run the following command in your terminal: ```bash -cd sdk/cs -dotnet build sdk_v2/cs/src/Microsoft.AI.Foundry.Local.csproj +cd sdk_v2/cs +dotnet build src/Microsoft.AI.Foundry.Local.csproj ``` -You can also load [FoundryLocal.sln](./FoundryLocal.sln) in Visual Studio 2022 or VSCode. +Or open [Microsoft.AI.Foundry.Local.SDK.sln](./Microsoft.AI.Foundry.Local.SDK.sln) in Visual Studio / VS Code. -## Usage +## WinML: Automatic Hardware Acceleration (Windows) + +On Windows, Foundry Local can leverage WinML for GPU/NPU hardware acceleration via ONNX Runtime execution providers (EPs). EPs are large binaries downloaded on first use and cached for subsequent runs. + +Install the WinML package variant instead: + +```bash +dotnet add package Microsoft.AI.Foundry.Local.WinML +``` + +Or build from source with: + +```bash +dotnet build src/Microsoft.AI.Foundry.Local.csproj /p:UseWinML=true +``` -> [!NOTE] -> For this example, you'll need the OpenAI Nuget package installed as well: -> ```bash -> dotnet add package OpenAI -> ``` +### Triggering EP download + +EP download can be time-consuming. Call `EnsureEpsDownloadedAsync` early (after initialization) to separate the download step from catalog access: + +```csharp +// Initialize the manager first (see Quick Start) +await FoundryLocalManager.CreateAsync( + new Configuration { AppName = "my-app" }, + NullLogger.Instance); + +await FoundryLocalManager.Instance.EnsureEpsDownloadedAsync(); + +// Now catalog access won't trigger an EP download +var catalog = await FoundryLocalManager.Instance.GetCatalogAsync(); +``` + +If you skip this step, EPs are downloaded automatically the first time you access the catalog. Once cached, subsequent calls are fast. + +## Quick Start ```csharp using Microsoft.AI.Foundry.Local; -using OpenAI; -using OpenAI.Chat; -using System.ClientModel; -using System.Diagnostics.Metrics; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Betalgo.Ranul.OpenAI.ObjectModels.RequestModels; + +// 1. Initialize the singleton manager +await FoundryLocalManager.CreateAsync( + new Configuration { AppName = "my-app" }, + NullLogger.Instance); + +// 2. Get the model catalog and look up a model +var catalog = await FoundryLocalManager.Instance.GetCatalogAsync(); +var model = await catalog.GetModelAsync("phi-3.5-mini") + ?? throw new Exception("Model 'phi-3.5-mini' not found in catalog."); + +// 3. Download (if needed) and load the model +await model.DownloadAsync(); +await model.LoadAsync(); + +// 4. Get a chat client and run inference +var chatClient = await model.GetChatClientAsync(); +var response = await chatClient.CompleteChatAsync(new[] +{ + ChatMessage.FromUser("Why is the sky blue?") +}); + +Console.WriteLine(response.Choices![0].Message.Content); + +// 5. Clean up +FoundryLocalManager.Instance.Dispose(); +``` + +## Usage + +### Initialization + +`FoundryLocalManager` is an async singleton. Call `CreateAsync` once at startup: + +```csharp +await FoundryLocalManager.CreateAsync( + new Configuration { AppName = "my-app" }, + loggerFactory.CreateLogger("FoundryLocal")); +``` + +Access it anywhere afterward via `FoundryLocalManager.Instance`. Check `FoundryLocalManager.IsInitialized` to verify creation. + +### Catalog + +The catalog lists all models known to the Foundry Local Core: + +```csharp +var catalog = await FoundryLocalManager.Instance.GetCatalogAsync(); + +// List all available models +var models = await catalog.ListModelsAsync(); +foreach (var m in models) + Console.WriteLine($"{m.Alias} — {m.SelectedVariant.Info.DisplayName}"); + +// Get a specific model by alias +var model = await catalog.GetModelAsync("phi-3.5-mini") + ?? throw new Exception("Model 'phi-3.5-mini' not found in catalog."); + +// Get a specific variant by its unique model ID +var variant = await catalog.GetModelVariantAsync("phi-3.5-mini-generic-gpu-4") + ?? throw new Exception("Variant 'phi-3.5-mini-generic-gpu-4' not found in catalog."); + +// List models already downloaded to the local cache +var cached = await catalog.GetCachedModelsAsync(); + +// List models currently loaded in memory +var loaded = await catalog.GetLoadedModelsAsync(); +``` + +### Model Lifecycle + +Each `Model` wraps one or more `ModelVariant` entries (different quantizations, hardware targets). The SDK auto-selects the best variant, or you can pick one: + +```csharp +// Check and select variants +Console.WriteLine($"Selected: {model.SelectedVariant.Id}"); +foreach (var v in model.Variants) + Console.WriteLine($" {v.Id} (cached: {await v.IsCachedAsync()})"); + +// Switch to a different variant +model.SelectVariant(model.Variants[1]); +``` + +Download, load, and unload: -var alias = "phi-3.5-mini"; +```csharp +// Download with progress reporting +await model.DownloadAsync(progress => + Console.WriteLine($"Download: {progress:F1}%")); + +// Load into memory +await model.LoadAsync(); -var manager = await FoundryLocalManager.StartModelAsync(aliasOrModelId: alias); +// Unload when done +await model.UnloadAsync(); + +// Remove from local cache entirely +await model.RemoveFromCacheAsync(); +``` + +### Chat Completions + +```csharp +var chatClient = await model.GetChatClientAsync(); -var model = await manager.GetModelInfoAsync(aliasOrModelId: alias); -ApiKeyCredential key = new ApiKeyCredential(manager.ApiKey); -OpenAIClient client = new OpenAIClient(key, new OpenAIClientOptions +var response = await chatClient.CompleteChatAsync(new[] { - Endpoint = manager.Endpoint + ChatMessage.FromSystem("You are a helpful assistant."), + ChatMessage.FromUser("Explain async/await in C#.") }); -var chatClient = client.GetChatClient(model?.ModelId); +Console.WriteLine(response.Choices![0].Message.Content); +``` + +#### Streaming -var completionUpdates = chatClient.CompleteChatStreaming("Why is the sky blue'"); +Use `IAsyncEnumerable` for token-by-token output: + +```csharp +using var cts = new CancellationTokenSource(); -Console.Write($"[ASSISTANT]: "); -foreach (var completionUpdate in completionUpdates) +await foreach (var chunk in chatClient.CompleteChatStreamingAsync( + new[] { ChatMessage.FromUser("Write a haiku about .NET") }, cts.Token)) { - if (completionUpdate.ContentUpdate.Count > 0) - { - Console.Write(completionUpdate.ContentUpdate[0].Text); - } + Console.Write(chunk.Choices?[0]?.Delta?.Content); +} +``` + +#### Chat Settings + +Tune generation parameters per client: + +```csharp +chatClient.Settings.Temperature = 0.7f; +chatClient.Settings.MaxTokens = 256; +chatClient.Settings.TopP = 0.9f; +chatClient.Settings.FrequencyPenalty = 0.5f; +``` + +### Audio Transcription + +```csharp +var audioClient = await model.GetAudioClientAsync(); + +// One-shot transcription +var result = await audioClient.TranscribeAudioAsync("recording.mp3"); +Console.WriteLine(result.Text); + +// Streaming transcription +await foreach (var chunk in audioClient.TranscribeAudioStreamingAsync("recording.mp3", CancellationToken.None)) +{ + Console.Write(chunk.Text); } ``` + +#### Audio Settings + +```csharp +audioClient.Settings.Language = "en"; +audioClient.Settings.Temperature = 0.0f; +``` + +### Web Service + +Start an OpenAI-compatible REST endpoint for use by external tools or processes: + +```csharp +// Configure the web service URL in your Configuration +await FoundryLocalManager.CreateAsync( + new Configuration + { + AppName = "my-app", + Web = new Configuration.WebService { Urls = "http://127.0.0.1:5000" } + }, + NullLogger.Instance); + +await FoundryLocalManager.Instance.StartWebServiceAsync(); +Console.WriteLine($"Listening on: {string.Join(", ", FoundryLocalManager.Instance.Urls!)}"); + +// ... use the service ... + +await FoundryLocalManager.Instance.StopWebServiceAsync(); +``` + +### Configuration + +| Property | Type | Default | Description | +|---|---|---|---| +| `AppName` | `string` | **(required)** | Your application name | +| `AppDataDir` | `string?` | `~/.{AppName}` | Application data directory | +| `ModelCacheDir` | `string?` | `{AppDataDir}/cache/models` | Where models are stored locally | +| `LogsDir` | `string?` | `{AppDataDir}/logs` | Log output directory | +| `LogLevel` | `LogLevel` | `Warning` | `Verbose`, `Debug`, `Information`, `Warning`, `Error`, `Fatal` | +| `Web` | `WebService?` | `null` | Web service configuration (see below) | +| `AdditionalSettings` | `IDictionary?` | `null` | Extra key-value settings passed to Core | + +**`Configuration.WebService`** + +| Property | Type | Default | Description | +|---|---|---|---| +| `Urls` | `string?` | `127.0.0.1:0` | Bind address; semi-colon separated for multiple | +| `ExternalUrl` | `Uri?` | `null` | URI for accessing the web service in a separate process | + +### Disposal + +`FoundryLocalManager` implements `IDisposable`. Dispose stops the web service (if running) and releases native resources: + +```csharp +FoundryLocalManager.Instance.Dispose(); +``` + +## API Reference + +Auto-generated API docs live in [`docs/api/`](./docs/api/). See [`GENERATE-DOCS.md`](./GENERATE-DOCS.md) to regenerate. + +Key types: + +| Type | Description | +|---|---| +| [`FoundryLocalManager`](./docs/api/microsoft.ai.foundry.local.foundrylocalmanager.md) | Singleton entry point — create, catalog, web service | +| [`Configuration`](./docs/api/microsoft.ai.foundry.local.configuration.md) | Initialization settings | +| [`ICatalog`](./docs/api/microsoft.ai.foundry.local.icatalog.md) | Model catalog interface | +| [`Model`](./docs/api/microsoft.ai.foundry.local.model.md) | Model with variant selection | +| [`ModelVariant`](./docs/api/microsoft.ai.foundry.local.modelvariant.md) | Specific model variant (hardware/quantization) | +| [`OpenAIChatClient`](./docs/api/microsoft.ai.foundry.local.openaichatclient.md) | Chat completions (sync + streaming) | +| [`OpenAIAudioClient`](./docs/api/microsoft.ai.foundry.local.openaiaudioclient.md) | Audio transcription (sync + streaming) | +| [`ModelInfo`](./docs/api/microsoft.ai.foundry.local.modelinfo.md) | Full model metadata record | + +## Tests + +```bash +dotnet test +``` + +See [`test/FoundryLocal.Tests/LOCAL_MODEL_TESTING.md`](./test/FoundryLocal.Tests/LOCAL_MODEL_TESTING.md) for prerequisites and local model setup. diff --git a/sdk_v2/cs/docs/api/index.md b/sdk_v2/cs/docs/api/index.md new file mode 100644 index 00000000..1dcc4e4c --- /dev/null +++ b/sdk_v2/cs/docs/api/index.md @@ -0,0 +1,41 @@ +# Microsoft.AI.Foundry.Local + +## Microsoft.AI.Foundry.Local + +[Configuration](./microsoft.ai.foundry.local.configuration.md) + +[DeviceType](./microsoft.ai.foundry.local.devicetype.md) + +[FoundryLocalException](./microsoft.ai.foundry.local.foundrylocalexception.md) + +[FoundryLocalManager](./microsoft.ai.foundry.local.foundrylocalmanager.md) + +[ICatalog](./microsoft.ai.foundry.local.icatalog.md) + +[IModel](./microsoft.ai.foundry.local.imodel.md) + +[LogLevel](./microsoft.ai.foundry.local.loglevel.md) + +[Model](./microsoft.ai.foundry.local.model.md) + +[ModelInfo](./microsoft.ai.foundry.local.modelinfo.md) + +[ModelSettings](./microsoft.ai.foundry.local.modelsettings.md) + +[ModelVariant](./microsoft.ai.foundry.local.modelvariant.md) + +[OpenAIAudioClient](./microsoft.ai.foundry.local.openaiaudioclient.md) + +[OpenAIChatClient](./microsoft.ai.foundry.local.openaichatclient.md) + +[Parameter](./microsoft.ai.foundry.local.parameter.md) + +[PromptTemplate](./microsoft.ai.foundry.local.prompttemplate.md) + +[Runtime](./microsoft.ai.foundry.local.runtime.md) + +## Microsoft.AI.Foundry.Local.Detail + +[AsyncLock](./microsoft.ai.foundry.local.detail.asynclock.md) + +[CoreInteropRequest](./microsoft.ai.foundry.local.detail.coreinteroprequest.md) diff --git a/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.configuration.md b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.configuration.md new file mode 100644 index 00000000..a549a301 --- /dev/null +++ b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.configuration.md @@ -0,0 +1,117 @@ +# Configuration + +Namespace: Microsoft.AI.Foundry.Local + +```csharp +public class Configuration +``` + +Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [Configuration](./microsoft.ai.foundry.local.configuration.md)
+Attributes [NullableContextAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullablecontextattribute), [NullableAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullableattribute), [RequiredMemberAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.requiredmemberattribute) + +## Properties + +### **AppName** + +Your application name. MUST be set to a valid name. + +```csharp +public string AppName { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **AppDataDir** + +Application data directory. + Default: {home}/.{appname}, where {home} is the user's home directory and {appname} is the AppName value. + +```csharp +public string AppDataDir { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **ModelCacheDir** + +Model cache directory. + Default: {appdata}/cache/models, where {appdata} is the AppDataDir value. + +```csharp +public string ModelCacheDir { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **LogsDir** + +Log directory. + Default: {appdata}/logs + +```csharp +public string LogsDir { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **LogLevel** + +Logging level. + Valid values are: Verbose, Debug, Information, Warning, Error, Fatal. + Default: LogLevel.Warning + +```csharp +public LogLevel LogLevel { get; set; } +``` + +#### Property Value + +[LogLevel](./microsoft.ai.foundry.local.loglevel.md)
+ +### **Web** + +Optional configuration for the built-in web service. + NOTE: This is not included in all builds. + +```csharp +public WebService Web { get; set; } +``` + +#### Property Value + +[WebService](./microsoft.ai.foundry.local.configuration.webservice.md)
+ +### **AdditionalSettings** + +Additional settings that Foundry Local Core can consume. + Keys and values are strings. + +```csharp +public IDictionary AdditionalSettings { get; set; } +``` + +#### Property Value + +[IDictionary<String, String>](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.idictionary-2)
+ +## Constructors + +### **Configuration()** + +#### Caution + +Constructors of types with required members are not supported in this version of your compiler. + +--- + +```csharp +public Configuration() +``` diff --git a/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.detail.asynclock.md b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.detail.asynclock.md new file mode 100644 index 00000000..56ccf77a --- /dev/null +++ b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.detail.asynclock.md @@ -0,0 +1,47 @@ +# AsyncLock + +Namespace: Microsoft.AI.Foundry.Local.Detail + +```csharp +public sealed class AsyncLock : System.IDisposable +``` + +Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [AsyncLock](./microsoft.ai.foundry.local.detail.asynclock.md)
+Implements [IDisposable](https://docs.microsoft.com/en-us/dotnet/api/system.idisposable)
+Attributes [NullableContextAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullablecontextattribute), [NullableAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullableattribute) + +## Constructors + +### **AsyncLock()** + +```csharp +public AsyncLock() +``` + +## Methods + +### **Dispose()** + +```csharp +public void Dispose() +``` + +### **Lock()** + +```csharp +public IDisposable Lock() +``` + +#### Returns + +[IDisposable](https://docs.microsoft.com/en-us/dotnet/api/system.idisposable)
+ +### **LockAsync()** + +```csharp +public Task LockAsync() +``` + +#### Returns + +[Task<IDisposable>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
diff --git a/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.detail.coreinteroprequest.md b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.detail.coreinteroprequest.md new file mode 100644 index 00000000..5a2a1378 --- /dev/null +++ b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.detail.coreinteroprequest.md @@ -0,0 +1,30 @@ +# CoreInteropRequest + +Namespace: Microsoft.AI.Foundry.Local.Detail + +```csharp +public class CoreInteropRequest +``` + +Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [CoreInteropRequest](./microsoft.ai.foundry.local.detail.coreinteroprequest.md)
+Attributes [NullableContextAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullablecontextattribute), [NullableAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullableattribute) + +## Properties + +### **Params** + +```csharp +public Dictionary Params { get; set; } +``` + +#### Property Value + +[Dictionary<String, String>](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2)
+ +## Constructors + +### **CoreInteropRequest()** + +```csharp +public CoreInteropRequest() +``` diff --git a/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.devicetype.md b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.devicetype.md new file mode 100644 index 00000000..f605fa0e --- /dev/null +++ b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.devicetype.md @@ -0,0 +1,20 @@ +# DeviceType + +Namespace: Microsoft.AI.Foundry.Local + +```csharp +public enum DeviceType +``` + +Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [ValueType](https://docs.microsoft.com/en-us/dotnet/api/system.valuetype) → [Enum](https://docs.microsoft.com/en-us/dotnet/api/system.enum) → [DeviceType](./microsoft.ai.foundry.local.devicetype.md)
+Implements [IComparable](https://docs.microsoft.com/en-us/dotnet/api/system.icomparable), [ISpanFormattable](https://docs.microsoft.com/en-us/dotnet/api/system.ispanformattable), [IFormattable](https://docs.microsoft.com/en-us/dotnet/api/system.iformattable), [IConvertible](https://docs.microsoft.com/en-us/dotnet/api/system.iconvertible)
+Attributes JsonConverterAttribute + +## Fields + +| Name | Value | Description | +| --- | --: | --- | +| Invalid | 0 | | +| CPU | 1 | | +| GPU | 2 | | +| NPU | 3 | | diff --git a/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.foundrylocalexception.md b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.foundrylocalexception.md new file mode 100644 index 00000000..a28d1dcc --- /dev/null +++ b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.foundrylocalexception.md @@ -0,0 +1,117 @@ +# FoundryLocalException + +Namespace: Microsoft.AI.Foundry.Local + +```csharp +public class FoundryLocalException : System.Exception, System.Runtime.Serialization.ISerializable +``` + +Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [Exception](https://docs.microsoft.com/en-us/dotnet/api/system.exception) → [FoundryLocalException](./microsoft.ai.foundry.local.foundrylocalexception.md)
+Implements [ISerializable](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.serialization.iserializable)
+Attributes [NullableContextAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullablecontextattribute), [NullableAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullableattribute) + +## Properties + +### **TargetSite** + +```csharp +public MethodBase TargetSite { get; } +``` + +#### Property Value + +[MethodBase](https://docs.microsoft.com/en-us/dotnet/api/system.reflection.methodbase)
+ +### **Message** + +```csharp +public string Message { get; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **Data** + +```csharp +public IDictionary Data { get; } +``` + +#### Property Value + +[IDictionary](https://docs.microsoft.com/en-us/dotnet/api/system.collections.idictionary)
+ +### **InnerException** + +```csharp +public Exception InnerException { get; } +``` + +#### Property Value + +[Exception](https://docs.microsoft.com/en-us/dotnet/api/system.exception)
+ +### **HelpLink** + +```csharp +public string HelpLink { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **Source** + +```csharp +public string Source { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **HResult** + +```csharp +public int HResult { get; set; } +``` + +#### Property Value + +[Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)
+ +### **StackTrace** + +```csharp +public string StackTrace { get; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +## Constructors + +### **FoundryLocalException(String)** + +```csharp +public FoundryLocalException(string message) +``` + +#### Parameters + +`message` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **FoundryLocalException(String, Exception)** + +```csharp +public FoundryLocalException(string message, Exception innerException) +``` + +#### Parameters + +`message` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +`innerException` [Exception](https://docs.microsoft.com/en-us/dotnet/api/system.exception)
diff --git a/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.foundrylocalmanager.md b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.foundrylocalmanager.md new file mode 100644 index 00000000..93f162b7 --- /dev/null +++ b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.foundrylocalmanager.md @@ -0,0 +1,170 @@ +# FoundryLocalManager + +Namespace: Microsoft.AI.Foundry.Local + +```csharp +public class FoundryLocalManager : System.IDisposable +``` + +Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [FoundryLocalManager](./microsoft.ai.foundry.local.foundrylocalmanager.md)
+Implements [IDisposable](https://docs.microsoft.com/en-us/dotnet/api/system.idisposable)
+Attributes [NullableContextAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullablecontextattribute), [NullableAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullableattribute) + +## Properties + +### **IsInitialized** + +```csharp +public static bool IsInitialized { get; } +``` + +#### Property Value + +[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+ +### **Instance** + +```csharp +public static FoundryLocalManager Instance { get; } +``` + +#### Property Value + +[FoundryLocalManager](./microsoft.ai.foundry.local.foundrylocalmanager.md)
+ +### **Urls** + +Bound Urls if the web service has been started. Null otherwise. + See [FoundryLocalManager.StartWebServiceAsync(Nullable<CancellationToken>)](./microsoft.ai.foundry.local.foundrylocalmanager.md#startwebserviceasyncnullablecancellationtoken). + +```csharp +public String[] Urls { get; private set; } +``` + +#### Property Value + +[String[]](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +## Methods + +### **CreateAsync(Configuration, ILogger, Nullable<CancellationToken>)** + +Create the [FoundryLocalManager](./microsoft.ai.foundry.local.foundrylocalmanager.md) singleton instance. + +```csharp +public static Task CreateAsync(Configuration configuration, ILogger logger, Nullable ct) +``` + +#### Parameters + +`configuration` [Configuration](./microsoft.ai.foundry.local.configuration.md)
+Configuration to use. + +`logger` ILogger
+Application logger to use. + Use Microsoft.Extensions.Logging.NullLogger.Instance if you wish to ignore log output from the SDK. + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional cancellation token for the initialization. + +#### Returns + +[Task](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task)
+Task creating the instance. + +#### Exceptions + +[FoundryLocalException](./microsoft.ai.foundry.local.foundrylocalexception.md)
+ +### **GetCatalogAsync(Nullable<CancellationToken>)** + +Get the model catalog instance. + +```csharp +public Task GetCatalogAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional cancellation token. + +#### Returns + +[Task<ICatalog>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+The model catalog. + +**Remarks:** + +The catalog is populated on first use. + If you are using a WinML build this will trigger a one-off execution provider download if not already done. + It is recommended to call [FoundryLocalManager.EnsureEpsDownloadedAsync(Nullable<CancellationToken>)](./microsoft.ai.foundry.local.foundrylocalmanager.md#ensureepsdownloadedasyncnullablecancellationtoken) first to separate out the two steps. + +### **StartWebServiceAsync(Nullable<CancellationToken>)** + +Start the optional web service. This will provide an OpenAI-compatible REST endpoint that supports + /v1/chat_completions + /v1/models to list downloaded models + /v1/models/{model_id} to get model details + + [FoundryLocalManager.Urls](./microsoft.ai.foundry.local.foundrylocalmanager.md#urls) is populated with the actual bound Urls after startup. + +```csharp +public Task StartWebServiceAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional cancellation token. + +#### Returns + +[Task](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task)
+Task starting the web service. + +### **StopWebServiceAsync(Nullable<CancellationToken>)** + +Stops the web service if started. + +```csharp +public Task StopWebServiceAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional cancellation token. + +#### Returns + +[Task](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task)
+Task stopping the web service. + +### **EnsureEpsDownloadedAsync(Nullable<CancellationToken>)** + +Ensure execution providers are downloaded and registered. + Only relevant when using WinML. + + Execution provider download can be time consuming due to the size of the packages. + Once downloaded, EPs are not re-downloaded unless a new version is available, so this method will be fast + on subsequent calls. + +```csharp +public Task EnsureEpsDownloadedAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional cancellation token. + +#### Returns + +[Task](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task)
+ +### **Dispose()** + +```csharp +public void Dispose() +``` diff --git a/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.icatalog.md b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.icatalog.md new file mode 100644 index 00000000..dc68c173 --- /dev/null +++ b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.icatalog.md @@ -0,0 +1,121 @@ +# ICatalog + +Namespace: Microsoft.AI.Foundry.Local + +```csharp +public interface ICatalog +``` + +Attributes [NullableContextAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullablecontextattribute) + +## Properties + +### **Name** + +The catalog name. + +```csharp +public abstract string Name { get; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +## Methods + +### **ListModelsAsync(Nullable<CancellationToken>)** + +List the available models in the catalog. + +```csharp +Task> ListModelsAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional CancellationToken. + +#### Returns + +[Task<List<Model>>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+List of Model instances. + +### **GetModelAsync(String, Nullable<CancellationToken>)** + +Lookup a model by its alias. + +```csharp +Task GetModelAsync(string modelAlias, Nullable ct) +``` + +#### Parameters + +`modelAlias` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+Model alias. + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional CancellationToken. + +#### Returns + +[Task<Model>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+The matching Model, or null if no model with the given alias exists. + +### **GetModelVariantAsync(String, Nullable<CancellationToken>)** + +Lookup a model variant by its unique model id. + +```csharp +Task GetModelVariantAsync(string modelId, Nullable ct) +``` + +#### Parameters + +`modelId` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+Model id. + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional CancellationToken. + +#### Returns + +[Task<ModelVariant>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+The matching ModelVariant, or null if no variant with the given id exists. + +### **GetCachedModelsAsync(Nullable<CancellationToken>)** + +Get a list of currently downloaded models from the model cache. + +```csharp +Task> GetCachedModelsAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional CancellationToken. + +#### Returns + +[Task<List<ModelVariant>>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+List of ModelVariant instances. + +### **GetLoadedModelsAsync(Nullable<CancellationToken>)** + +Get a list of the currently loaded models. + +```csharp +Task> GetLoadedModelsAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional CancellationToken. + +#### Returns + +[Task<List<ModelVariant>>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+List of ModelVariant instances. diff --git a/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.imodel.md b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.imodel.md new file mode 100644 index 00000000..d5d2b437 --- /dev/null +++ b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.imodel.md @@ -0,0 +1,187 @@ +# IModel + +Namespace: Microsoft.AI.Foundry.Local + +```csharp +public interface IModel +``` + +Attributes [NullableContextAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullablecontextattribute) + +## Properties + +### **Id** + +```csharp +public abstract string Id { get; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **Alias** + +```csharp +public abstract string Alias { get; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +## Methods + +### **IsCachedAsync(Nullable<CancellationToken>)** + +```csharp +Task IsCachedAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task<Boolean>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+ +### **IsLoadedAsync(Nullable<CancellationToken>)** + +```csharp +Task IsLoadedAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task<Boolean>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+ +### **DownloadAsync(Action<Single>, Nullable<CancellationToken>)** + +Download the model to local cache if not already present. + +```csharp +Task DownloadAsync(Action downloadProgress, Nullable ct) +``` + +#### Parameters + +`downloadProgress` [Action<Single>](https://docs.microsoft.com/en-us/dotnet/api/system.action-1)
+Optional progress callback for download progress. + Percentage download (0 - 100.0) is reported. + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional cancellation token. + +#### Returns + +[Task](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task)
+ +### **GetPathAsync(Nullable<CancellationToken>)** + +Gets the model path if cached. + +```csharp +Task GetPathAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional cancellation token. + +#### Returns + +[Task<String>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+Path of model directory. + +### **LoadAsync(Nullable<CancellationToken>)** + +Load the model into memory if not already loaded. + +```csharp +Task LoadAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional cancellation token. + +#### Returns + +[Task](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task)
+ +### **RemoveFromCacheAsync(Nullable<CancellationToken>)** + +Remove the model from the local cache. + +```csharp +Task RemoveFromCacheAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional cancellation token. + +#### Returns + +[Task](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task)
+ +### **UnloadAsync(Nullable<CancellationToken>)** + +Unload the model if loaded. + +```csharp +Task UnloadAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional cancellation token. + +#### Returns + +[Task](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task)
+ +### **GetChatClientAsync(Nullable<CancellationToken>)** + +Get an OpenAI API based ChatClient + +```csharp +Task GetChatClientAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional cancellation token. + +#### Returns + +[Task<OpenAIChatClient>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+OpenAI.ChatClient + +### **GetAudioClientAsync(Nullable<CancellationToken>)** + +Get an OpenAI API based AudioClient + +```csharp +Task GetAudioClientAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional cancellation token. + +#### Returns + +[Task<OpenAIAudioClient>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+OpenAI.AudioClient diff --git a/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.loglevel.md b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.loglevel.md new file mode 100644 index 00000000..ac942c0d --- /dev/null +++ b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.loglevel.md @@ -0,0 +1,21 @@ +# LogLevel + +Namespace: Microsoft.AI.Foundry.Local + +```csharp +public enum LogLevel +``` + +Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [ValueType](https://docs.microsoft.com/en-us/dotnet/api/system.valuetype) → [Enum](https://docs.microsoft.com/en-us/dotnet/api/system.enum) → [LogLevel](./microsoft.ai.foundry.local.loglevel.md)
+Implements [IComparable](https://docs.microsoft.com/en-us/dotnet/api/system.icomparable), [ISpanFormattable](https://docs.microsoft.com/en-us/dotnet/api/system.ispanformattable), [IFormattable](https://docs.microsoft.com/en-us/dotnet/api/system.iformattable), [IConvertible](https://docs.microsoft.com/en-us/dotnet/api/system.iconvertible) + +## Fields + +| Name | Value | Description | +| --- | --: | --- | +| Verbose | 0 | | +| Debug | 1 | | +| Information | 2 | | +| Warning | 3 | | +| Error | 4 | | +| Fatal | 5 | | diff --git a/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.model.md b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.model.md new file mode 100644 index 00000000..c63b78a4 --- /dev/null +++ b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.model.md @@ -0,0 +1,228 @@ +# Model + +Namespace: Microsoft.AI.Foundry.Local + +```csharp +public class Model : IModel +``` + +Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [Model](./microsoft.ai.foundry.local.model.md)
+Implements [IModel](./microsoft.ai.foundry.local.imodel.md)
+Attributes [NullableContextAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullablecontextattribute), [NullableAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullableattribute) + +## Properties + +### **Variants** + +```csharp +public List Variants { get; internal set; } +``` + +#### Property Value + +[List<ModelVariant>](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1)
+ +### **SelectedVariant** + +```csharp +public ModelVariant SelectedVariant { get; internal set; } +``` + +#### Property Value + +[ModelVariant](./microsoft.ai.foundry.local.modelvariant.md)
+ +### **Alias** + +```csharp +public string Alias { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **Id** + +```csharp +public string Id { get; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +## Methods + +### **IsCachedAsync(Nullable<CancellationToken>)** + +Is the currently selected variant cached locally? + +```csharp +public Task IsCachedAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task<Boolean>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+ +### **IsLoadedAsync(Nullable<CancellationToken>)** + +Is the currently selected variant loaded in memory? + +```csharp +public Task IsLoadedAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task<Boolean>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+ +### **SelectVariant(ModelVariant)** + +Select a specific model variant from [Model.Variants](./microsoft.ai.foundry.local.model.md#variants) to use for [IModel](./microsoft.ai.foundry.local.imodel.md) operations. + +```csharp +public void SelectVariant(ModelVariant variant) +``` + +#### Parameters + +`variant` [ModelVariant](./microsoft.ai.foundry.local.modelvariant.md)
+Model variant to select. Must be one of the variants in [Model.Variants](./microsoft.ai.foundry.local.model.md#variants). + +#### Exceptions + +[FoundryLocalException](./microsoft.ai.foundry.local.foundrylocalexception.md)
+If variant is not valid for this model. + +### **GetLatestVersion(ModelVariant)** + +Get the latest version of the specified model variant. + +```csharp +public ModelVariant GetLatestVersion(ModelVariant variant) +``` + +#### Parameters + +`variant` [ModelVariant](./microsoft.ai.foundry.local.modelvariant.md)
+Model variant. + +#### Returns + +[ModelVariant](./microsoft.ai.foundry.local.modelvariant.md)
+ModelVariant for latest version. Same as `variant` if that is the latest version. + +#### Exceptions + +[FoundryLocalException](./microsoft.ai.foundry.local.foundrylocalexception.md)
+If variant is not valid for this model. + +### **GetPathAsync(Nullable<CancellationToken>)** + +```csharp +public Task GetPathAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task<String>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+ +### **DownloadAsync(Action<Single>, Nullable<CancellationToken>)** + +```csharp +public Task DownloadAsync(Action downloadProgress, Nullable ct) +``` + +#### Parameters + +`downloadProgress` [Action<Single>](https://docs.microsoft.com/en-us/dotnet/api/system.action-1)
+ +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task)
+ +### **LoadAsync(Nullable<CancellationToken>)** + +```csharp +public Task LoadAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task)
+ +### **GetChatClientAsync(Nullable<CancellationToken>)** + +```csharp +public Task GetChatClientAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task<OpenAIChatClient>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+ +### **GetAudioClientAsync(Nullable<CancellationToken>)** + +```csharp +public Task GetAudioClientAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task<OpenAIAudioClient>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+ +### **UnloadAsync(Nullable<CancellationToken>)** + +```csharp +public Task UnloadAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task)
+ +### **RemoveFromCacheAsync(Nullable<CancellationToken>)** + +```csharp +public Task RemoveFromCacheAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task)
diff --git a/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.modelinfo.md b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.modelinfo.md new file mode 100644 index 00000000..750253c1 --- /dev/null +++ b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.modelinfo.md @@ -0,0 +1,297 @@ +# ModelInfo + +Namespace: Microsoft.AI.Foundry.Local + +```csharp +public class ModelInfo : System.IEquatable`1[[Microsoft.AI.Foundry.Local.ModelInfo, Microsoft.AI.Foundry.Local, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] +``` + +Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [ModelInfo](./microsoft.ai.foundry.local.modelinfo.md)
+Implements [IEquatable<ModelInfo>](https://docs.microsoft.com/en-us/dotnet/api/system.iequatable-1)
+Attributes [NullableContextAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullablecontextattribute), [NullableAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullableattribute), [RequiredMemberAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.requiredmemberattribute) + +## Properties + +### **Id** + +```csharp +public string Id { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **Name** + +```csharp +public string Name { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **Version** + +```csharp +public int Version { get; set; } +``` + +#### Property Value + +[Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)
+ +### **Alias** + +```csharp +public string Alias { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **DisplayName** + +```csharp +public string DisplayName { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **ProviderType** + +```csharp +public string ProviderType { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **Uri** + +```csharp +public string Uri { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **ModelType** + +```csharp +public string ModelType { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **PromptTemplate** + +```csharp +public PromptTemplate PromptTemplate { get; set; } +``` + +#### Property Value + +[PromptTemplate](./microsoft.ai.foundry.local.prompttemplate.md)
+ +### **Publisher** + +```csharp +public string Publisher { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **ModelSettings** + +```csharp +public ModelSettings ModelSettings { get; set; } +``` + +#### Property Value + +[ModelSettings](./microsoft.ai.foundry.local.modelsettings.md)
+ +### **License** + +```csharp +public string License { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **LicenseDescription** + +```csharp +public string LicenseDescription { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **Cached** + +```csharp +public bool Cached { get; set; } +``` + +#### Property Value + +[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+ +### **Task** + +```csharp +public string Task { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **Runtime** + +```csharp +public Runtime Runtime { get; set; } +``` + +#### Property Value + +[Runtime](./microsoft.ai.foundry.local.runtime.md)
+ +### **FileSizeMb** + +```csharp +public Nullable FileSizeMb { get; set; } +``` + +#### Property Value + +[Nullable<Int32>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +### **SupportsToolCalling** + +```csharp +public Nullable SupportsToolCalling { get; set; } +``` + +#### Property Value + +[Nullable<Boolean>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +### **MaxOutputTokens** + +```csharp +public Nullable MaxOutputTokens { get; set; } +``` + +#### Property Value + +[Nullable<Int64>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +### **MinFLVersion** + +```csharp +public string MinFLVersion { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **CreatedAtUnix** + +```csharp +public long CreatedAtUnix { get; set; } +``` + +#### Property Value + +[Int64](https://docs.microsoft.com/en-us/dotnet/api/system.int64)
+ +## Constructors + +### **ModelInfo()** + +#### Caution + +Constructors of types with required members are not supported in this version of your compiler. + +--- + +```csharp +public ModelInfo() +``` + +## Methods + +### **ToString()** + +```csharp +public string ToString() +``` + +#### Returns + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **GetHashCode()** + +```csharp +public int GetHashCode() +``` + +#### Returns + +[Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)
+ +### **Equals(Object)** + +```csharp +public bool Equals(object obj) +``` + +#### Parameters + +`obj` [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object)
+ +#### Returns + +[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+ +### **Equals(ModelInfo)** + +```csharp +public bool Equals(ModelInfo other) +``` + +#### Parameters + +`other` [ModelInfo](./microsoft.ai.foundry.local.modelinfo.md)
+ +#### Returns + +[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+ +### **<Clone>$()** + +```csharp +public ModelInfo $() +``` + +#### Returns + +[ModelInfo](./microsoft.ai.foundry.local.modelinfo.md)
diff --git a/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.modelsettings.md b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.modelsettings.md new file mode 100644 index 00000000..68386377 --- /dev/null +++ b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.modelsettings.md @@ -0,0 +1,91 @@ +# ModelSettings + +Namespace: Microsoft.AI.Foundry.Local + +```csharp +public class ModelSettings : System.IEquatable`1[[Microsoft.AI.Foundry.Local.ModelSettings, Microsoft.AI.Foundry.Local, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] +``` + +Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [ModelSettings](./microsoft.ai.foundry.local.modelsettings.md)
+Implements [IEquatable<ModelSettings>](https://docs.microsoft.com/en-us/dotnet/api/system.iequatable-1)
+Attributes [NullableContextAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullablecontextattribute), [NullableAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullableattribute) + +## Properties + +### **Parameters** + +```csharp +public Parameter[] Parameters { get; set; } +``` + +#### Property Value + +[Parameter[]](./microsoft.ai.foundry.local.parameter.md)
+ +## Constructors + +### **ModelSettings()** + +```csharp +public ModelSettings() +``` + +## Methods + +### **ToString()** + +```csharp +public string ToString() +``` + +#### Returns + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **GetHashCode()** + +```csharp +public int GetHashCode() +``` + +#### Returns + +[Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)
+ +### **Equals(Object)** + +```csharp +public bool Equals(object obj) +``` + +#### Parameters + +`obj` [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object)
+ +#### Returns + +[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+ +### **Equals(ModelSettings)** + +```csharp +public bool Equals(ModelSettings other) +``` + +#### Parameters + +`other` [ModelSettings](./microsoft.ai.foundry.local.modelsettings.md)
+ +#### Returns + +[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+ +### **<Clone>$()** + +```csharp +public ModelSettings $() +``` + +#### Returns + +[ModelSettings](./microsoft.ai.foundry.local.modelsettings.md)
diff --git a/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.modelvariant.md b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.modelvariant.md new file mode 100644 index 00000000..1f674511 --- /dev/null +++ b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.modelvariant.md @@ -0,0 +1,183 @@ +# ModelVariant + +Namespace: Microsoft.AI.Foundry.Local + +```csharp +public class ModelVariant : IModel +``` + +Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [ModelVariant](./microsoft.ai.foundry.local.modelvariant.md)
+Implements [IModel](./microsoft.ai.foundry.local.imodel.md)
+Attributes [NullableContextAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullablecontextattribute), [NullableAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullableattribute) + +## Properties + +### **Info** + +```csharp +public ModelInfo Info { get; } +``` + +#### Property Value + +[ModelInfo](./microsoft.ai.foundry.local.modelinfo.md)
+ +### **Id** + +```csharp +public string Id { get; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **Alias** + +```csharp +public string Alias { get; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **Version** + +```csharp +public int Version { get; set; } +``` + +#### Property Value + +[Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)
+ +## Methods + +### **IsLoadedAsync(Nullable<CancellationToken>)** + +```csharp +public Task IsLoadedAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task<Boolean>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+ +### **IsCachedAsync(Nullable<CancellationToken>)** + +```csharp +public Task IsCachedAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task<Boolean>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+ +### **GetPathAsync(Nullable<CancellationToken>)** + +```csharp +public Task GetPathAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task<String>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+ +### **DownloadAsync(Action<Single>, Nullable<CancellationToken>)** + +```csharp +public Task DownloadAsync(Action downloadProgress, Nullable ct) +``` + +#### Parameters + +`downloadProgress` [Action<Single>](https://docs.microsoft.com/en-us/dotnet/api/system.action-1)
+ +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task)
+ +### **LoadAsync(Nullable<CancellationToken>)** + +```csharp +public Task LoadAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task)
+ +### **UnloadAsync(Nullable<CancellationToken>)** + +```csharp +public Task UnloadAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task)
+ +### **RemoveFromCacheAsync(Nullable<CancellationToken>)** + +```csharp +public Task RemoveFromCacheAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task)
+ +### **GetChatClientAsync(Nullable<CancellationToken>)** + +```csharp +public Task GetChatClientAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task<OpenAIChatClient>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+ +### **GetAudioClientAsync(Nullable<CancellationToken>)** + +```csharp +public Task GetAudioClientAsync(Nullable ct) +``` + +#### Parameters + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+ +#### Returns + +[Task<OpenAIAudioClient>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
diff --git a/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.openaiaudioclient.md b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.openaiaudioclient.md new file mode 100644 index 00000000..bcaefc04 --- /dev/null +++ b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.openaiaudioclient.md @@ -0,0 +1,73 @@ +# OpenAIAudioClient + +Namespace: Microsoft.AI.Foundry.Local + +Audio Client that uses the OpenAI API. + Implemented using Betalgo.Ranul.OpenAI SDK types. + +```csharp +public class OpenAIAudioClient +``` + +Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [OpenAIAudioClient](./microsoft.ai.foundry.local.openaiaudioclient.md)
+Attributes [NullableContextAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullablecontextattribute), [NullableAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullableattribute) + +## Properties + +### **Settings** + +Settings to use for audio transcription using this client. + +```csharp +public AudioSettings Settings { get; } +``` + +#### Property Value + +[AudioSettings](./microsoft.ai.foundry.local.openaiaudioclient.audiosettings.md)
+ +## Methods + +### **TranscribeAudioAsync(String, Nullable<CancellationToken>)** + +Transcribe audio from a file. + +```csharp +public Task TranscribeAudioAsync(string audioFilePath, Nullable ct) +``` + +#### Parameters + +`audioFilePath` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+Path to file containing audio recording. + Supported formats: mp3 + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional cancellation token. + +#### Returns + +[Task<AudioCreateTranscriptionResponse>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+Transcription response. + +### **TranscribeAudioStreamingAsync(String, CancellationToken)** + +Transcribe audio from a file with streamed output. + +```csharp +public IAsyncEnumerable TranscribeAudioStreamingAsync(string audioFilePath, CancellationToken ct) +``` + +#### Parameters + +`audioFilePath` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+Path to file containing audio recording. + Supported formats: mp3 + +`ct` [CancellationToken](https://docs.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken)
+Cancellation token. + +#### Returns + +[IAsyncEnumerable<AudioCreateTranscriptionResponse>](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.iasyncenumerable-1)
+An asynchronous enumerable of transcription responses. diff --git a/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.openaichatclient.md b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.openaichatclient.md new file mode 100644 index 00000000..251e474c --- /dev/null +++ b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.openaichatclient.md @@ -0,0 +1,75 @@ +# OpenAIChatClient + +Namespace: Microsoft.AI.Foundry.Local + +Chat Client that uses the OpenAI API. + Implemented using Betalgo.Ranul.OpenAI SDK types. + +```csharp +public class OpenAIChatClient +``` + +Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [OpenAIChatClient](./microsoft.ai.foundry.local.openaichatclient.md)
+Attributes [NullableContextAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullablecontextattribute), [NullableAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullableattribute) + +## Properties + +### **Settings** + +Settings to use for chat completions using this client. + +```csharp +public ChatSettings Settings { get; } +``` + +#### Property Value + +[ChatSettings](./microsoft.ai.foundry.local.openaichatclient.chatsettings.md)
+ +## Methods + +### **CompleteChatAsync(IEnumerable<ChatMessage>, Nullable<CancellationToken>)** + +Execute a chat completion request. + + To continue a conversation, add the ChatMessage from the previous response and new prompt to the messages. + +```csharp +public Task CompleteChatAsync(IEnumerable messages, Nullable ct) +``` + +#### Parameters + +`messages` [IEnumerable<ChatMessage>](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)
+Chat messages. The system message is automatically added. + +`ct` [Nullable<CancellationToken>](https://docs.microsoft.com/en-us/dotnet/api/system.nullable-1)
+Optional cancellation token. + +#### Returns + +[Task<ChatCompletionCreateResponse>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1)
+Chat completion response. + +### **CompleteChatStreamingAsync(IEnumerable<ChatMessage>, CancellationToken)** + +Execute a chat completion request with streamed output. + + To continue a conversation, add the ChatMessage from the previous response and new prompt to the messages. + +```csharp +public IAsyncEnumerable CompleteChatStreamingAsync(IEnumerable messages, CancellationToken ct) +``` + +#### Parameters + +`messages` [IEnumerable<ChatMessage>](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1)
+Chat messages. The system message is automatically added. + +`ct` [CancellationToken](https://docs.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken)
+Optional cancellation token. + +#### Returns + +[IAsyncEnumerable<ChatCompletionCreateResponse>](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.iasyncenumerable-1)
+Async enumerable of chat completion responses. diff --git a/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.parameter.md b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.parameter.md new file mode 100644 index 00000000..24a092c9 --- /dev/null +++ b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.parameter.md @@ -0,0 +1,107 @@ +# Parameter + +Namespace: Microsoft.AI.Foundry.Local + +```csharp +public class Parameter : System.IEquatable`1[[Microsoft.AI.Foundry.Local.Parameter, Microsoft.AI.Foundry.Local, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] +``` + +Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [Parameter](./microsoft.ai.foundry.local.parameter.md)
+Implements [IEquatable<Parameter>](https://docs.microsoft.com/en-us/dotnet/api/system.iequatable-1)
+Attributes [NullableContextAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullablecontextattribute), [NullableAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullableattribute), [RequiredMemberAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.requiredmemberattribute) + +## Properties + +### **Name** + +```csharp +public string Name { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **Value** + +```csharp +public string Value { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +## Constructors + +### **Parameter()** + +#### Caution + +Constructors of types with required members are not supported in this version of your compiler. + +--- + +```csharp +public Parameter() +``` + +## Methods + +### **ToString()** + +```csharp +public string ToString() +``` + +#### Returns + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **GetHashCode()** + +```csharp +public int GetHashCode() +``` + +#### Returns + +[Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)
+ +### **Equals(Object)** + +```csharp +public bool Equals(object obj) +``` + +#### Parameters + +`obj` [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object)
+ +#### Returns + +[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+ +### **Equals(Parameter)** + +```csharp +public bool Equals(Parameter other) +``` + +#### Parameters + +`other` [Parameter](./microsoft.ai.foundry.local.parameter.md)
+ +#### Returns + +[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+ +### **<Clone>$()** + +```csharp +public Parameter $() +``` + +#### Returns + +[Parameter](./microsoft.ai.foundry.local.parameter.md)
diff --git a/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.prompttemplate.md b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.prompttemplate.md new file mode 100644 index 00000000..432f74db --- /dev/null +++ b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.prompttemplate.md @@ -0,0 +1,121 @@ +# PromptTemplate + +Namespace: Microsoft.AI.Foundry.Local + +```csharp +public class PromptTemplate : System.IEquatable`1[[Microsoft.AI.Foundry.Local.PromptTemplate, Microsoft.AI.Foundry.Local, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] +``` + +Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [PromptTemplate](./microsoft.ai.foundry.local.prompttemplate.md)
+Implements [IEquatable<PromptTemplate>](https://docs.microsoft.com/en-us/dotnet/api/system.iequatable-1)
+Attributes [NullableContextAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullablecontextattribute), [NullableAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullableattribute) + +## Properties + +### **System** + +```csharp +public string System { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **User** + +```csharp +public string User { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **Assistant** + +```csharp +public string Assistant { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **Prompt** + +```csharp +public string Prompt { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +## Constructors + +### **PromptTemplate()** + +```csharp +public PromptTemplate() +``` + +## Methods + +### **ToString()** + +```csharp +public string ToString() +``` + +#### Returns + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **GetHashCode()** + +```csharp +public int GetHashCode() +``` + +#### Returns + +[Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)
+ +### **Equals(Object)** + +```csharp +public bool Equals(object obj) +``` + +#### Parameters + +`obj` [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object)
+ +#### Returns + +[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+ +### **Equals(PromptTemplate)** + +```csharp +public bool Equals(PromptTemplate other) +``` + +#### Parameters + +`other` [PromptTemplate](./microsoft.ai.foundry.local.prompttemplate.md)
+ +#### Returns + +[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+ +### **<Clone>$()** + +```csharp +public PromptTemplate $() +``` + +#### Returns + +[PromptTemplate](./microsoft.ai.foundry.local.prompttemplate.md)
diff --git a/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.runtime.md b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.runtime.md new file mode 100644 index 00000000..3d0d9fd5 --- /dev/null +++ b/sdk_v2/cs/docs/api/microsoft.ai.foundry.local.runtime.md @@ -0,0 +1,101 @@ +# Runtime + +Namespace: Microsoft.AI.Foundry.Local + +```csharp +public class Runtime : System.IEquatable`1[[Microsoft.AI.Foundry.Local.Runtime, Microsoft.AI.Foundry.Local, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] +``` + +Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [Runtime](./microsoft.ai.foundry.local.runtime.md)
+Implements [IEquatable<Runtime>](https://docs.microsoft.com/en-us/dotnet/api/system.iequatable-1)
+Attributes [NullableContextAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullablecontextattribute), [NullableAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.nullableattribute) + +## Properties + +### **DeviceType** + +```csharp +public DeviceType DeviceType { get; set; } +``` + +#### Property Value + +[DeviceType](./microsoft.ai.foundry.local.devicetype.md)
+ +### **ExecutionProvider** + +```csharp +public string ExecutionProvider { get; set; } +``` + +#### Property Value + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +## Constructors + +### **Runtime()** + +```csharp +public Runtime() +``` + +## Methods + +### **ToString()** + +```csharp +public string ToString() +``` + +#### Returns + +[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)
+ +### **GetHashCode()** + +```csharp +public int GetHashCode() +``` + +#### Returns + +[Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)
+ +### **Equals(Object)** + +```csharp +public bool Equals(object obj) +``` + +#### Parameters + +`obj` [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object)
+ +#### Returns + +[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+ +### **Equals(Runtime)** + +```csharp +public bool Equals(Runtime other) +``` + +#### Parameters + +`other` [Runtime](./microsoft.ai.foundry.local.runtime.md)
+ +#### Returns + +[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)
+ +### **<Clone>$()** + +```csharp +public Runtime $() +``` + +#### Returns + +[Runtime](./microsoft.ai.foundry.local.runtime.md)
diff --git a/sdk_v2/cs/src/FoundryLocalManager.cs b/sdk_v2/cs/src/FoundryLocalManager.cs index ce3712cd..639be3a2 100644 --- a/sdk_v2/cs/src/FoundryLocalManager.cs +++ b/sdk_v2/cs/src/FoundryLocalManager.cs @@ -94,7 +94,7 @@ public static async Task CreateAsync(Configuration configuration, ILogger logger /// /// Get the model catalog instance. /// - /// Optional canellation token. + /// Optional cancellation token. /// The model catalog. /// /// The catalog is populated on first use. diff --git a/sdk_v2/cs/src/ICatalog.cs b/sdk_v2/cs/src/ICatalog.cs index 12347940..35285736 100644 --- a/sdk_v2/cs/src/ICatalog.cs +++ b/sdk_v2/cs/src/ICatalog.cs @@ -26,7 +26,7 @@ public interface ICatalog /// /// Model alias. /// Optional CancellationToken. - /// Model if found. + /// The matching Model, or null if no model with the given alias exists. Task GetModelAsync(string modelAlias, CancellationToken? ct = null); /// @@ -34,7 +34,7 @@ public interface ICatalog /// /// Model id. /// Optional CancellationToken. - /// Model variant if found. + /// The matching ModelVariant, or null if no variant with the given id exists. Task GetModelVariantAsync(string modelId, CancellationToken? ct = null); /// diff --git a/sdk_v2/cs/src/Microsoft.AI.Foundry.Local.csproj b/sdk_v2/cs/src/Microsoft.AI.Foundry.Local.csproj index 6ee998f9..ef0ea35d 100644 --- a/sdk_v2/cs/src/Microsoft.AI.Foundry.Local.csproj +++ b/sdk_v2/cs/src/Microsoft.AI.Foundry.Local.csproj @@ -26,6 +26,7 @@ true snupkg + true