Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
fcd5c28
Add Microsoft.Maui.AI.Attributes — source-generated AI tool bindings
mattleibow May 5, 2026
25de0e3
Move AI Attributes source to src/AIAttributes and tests to tests/AIAt…
mattleibow May 5, 2026
0ce9a92
Restore src/AI/README.md from main
mattleibow May 5, 2026
41068b8
Rename AIAttributes to AIExtensions across folders and samples
mattleibow May 6, 2026
82fb714
Bump OpenAI package to 2.9.1 for Microsoft.Extensions.AI.OpenAI 10.4.…
mattleibow May 6, 2026
9cd2e10
Remove runtime reflection from generated tools for AOT/trim safety
mattleibow May 7, 2026
b1a7fd8
Fix non-nullable reference params missing from schema required array
mattleibow May 7, 2026
920e413
Add missing AI Attributes test cases for enums, collections, schema, …
mattleibow May 7, 2026
28724e2
Refactor generator into separate files for maintainability
mattleibow May 7, 2026
ec7f864
Apply dotnet format
mattleibow May 7, 2026
f302f4a
Address PR review comments
mattleibow May 11, 2026
9d14eb9
Revert Debug-only gate on user secrets — sample app only
mattleibow May 11, 2026
67d93fb
Simplify csproj README packing to match EssentialsAI pattern
mattleibow May 11, 2026
b45792c
Rename AI Attributes branding to AI Extensions across display names
mattleibow May 11, 2026
f0a72f8
Restructure AIExtensions README as product-area landing page
mattleibow May 11, 2026
f2a055d
Make AI Extensions a heading with AI Attributes as sub-heading in roo…
mattleibow May 11, 2026
1ace811
Rename publishAINuget to publishAIExtensionsNuget in AzDO pipeline
mattleibow May 11, 2026
3557a39
Fix link text in AIExtensions README
mattleibow May 11, 2026
dc414a0
Add ValidateXcodeVersion=false and secrets warning comment
mattleibow May 11, 2026
effb361
Improve Garden sample: clean up AppShell, document tool patterns, upd…
mattleibow May 11, 2026
6d54758
Replace Unicode arrows with Fluent icons in Garden sample
mattleibow May 11, 2026
d2d6524
Fix Fluent chevron codepoints — use actual FluentSystemIcons-Filled m…
mattleibow May 11, 2026
7155072
Remove Android Entry underline in Garden chat input
mattleibow May 11, 2026
7533581
Move Entry border removal into ConfigureMauiHandlers builder chain
mattleibow May 11, 2026
0ca6479
Scaffold XAML UI Indexer projects
mattleibow May 11, 2026
d0d117e
Implement XAML UI Indexer source generator
mattleibow May 11, 2026
5e5f61e
Add SemanticProperties to Garden sample for accessibility
mattleibow May 11, 2026
38eac44
Boost test coverage to 90%+ with 77 tests
mattleibow May 12, 2026
c726675
Fix CI build error and address review feedback
mattleibow May 12, 2026
565fe82
Add cross-file resolution and exact-match tests
mattleibow May 12, 2026
1aa99ac
Add exhaustive emoji, unicode, and edge case tests
mattleibow May 12, 2026
f61e101
Fix all issues from Opus 4.7 and GPT 5.5 code reviews
mattleibow May 12, 2026
54d6c70
Bundle source generator into NuGet package — single PackageReference
mattleibow May 12, 2026
5de7998
Add AI search tools for UI discovery
mattleibow May 12, 2026
7f512fa
Fix UI search tools — generator wasn't loaded, add auto-registration
mattleibow May 12, 2026
54849e4
Redesign runtime API — no reflection, follows AIToolContext pattern
mattleibow May 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/ci-ai.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI - AI Extensions

on:
push:
branches: [main]
paths:
- 'src/AIExtensions/**'
- 'tests/AIExtensions/**'
- 'eng/**'
- 'Directory.Build.props'
- 'Directory.Build.targets'
- 'Directory.Packages.props'
- 'global.json'
- 'NuGet.config'
pull_request:
types: [opened, synchronize, reopened, edited]
branches: [main]
paths:
- 'src/AIExtensions/**'
- 'tests/AIExtensions/**'
- 'eng/**'
- 'Directory.Build.props'
- 'Directory.Build.targets'
- 'Directory.Packages.props'
- 'global.json'
- 'NuGet.config'

jobs:
build:
uses: ./.github/workflows/_build.yml
with:
project-path: src/AIExtensions/AIExtensions.slnf
project-name: ai-extensions
run-tests: true
pack: true
install-workloads: false
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<PackageProjectUrl>https://github.com/dotnet/maui-labs</PackageProjectUrl>
<RepositoryUrl>https://github.com/dotnet/maui-labs</RepositoryUrl>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<ValidateXcodeVersion>false</ValidateXcodeVersion>
<!-- Allow restoring/building Windows TFMs on non-Windows hosts (macOS CI runners) -->
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<!-- NU1507: official builds inject internal feeds via SetupNugetSources that aren't in packageSourceMapping -->
Expand Down
25 changes: 19 additions & 6 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,28 @@
<PackageVersion Include="Microsoft.Extensions.Http" Version="$(MicrosoftExtensionsHttpVersion)" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="$(MicrosoftExtensionsHostingVersion)" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsLoggingAbstractionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingVersion)" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsoleVersion)" />
<PackageVersion Include="Microsoft.Extensions.Logging.Debug" Version="$(MicrosoftExtensionsLoggingDebugVersion)" />
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="$(MicrosoftExtensionsConfigurationUserSecretsVersion)" />
</ItemGroup>

<!-- AI (Microsoft.Extensions.AI + Azure OpenAI) -->
<ItemGroup Label="AI">
<PackageVersion Include="Microsoft.Extensions.AI" Version="$(MicrosoftExtensionsAIVersion)" />
<PackageVersion Include="Microsoft.Extensions.AI.OpenAI" Version="$(MicrosoftExtensionsAIOpenAIVersion)" />
<PackageVersion Include="Azure.AI.OpenAI" Version="$(AzureAIOpenAIVersion)" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="$(CommunityToolkitMvvmVersion)" />
</ItemGroup>

<!-- Roslyn (for source generators) -->
<ItemGroup Label="Roslyn">
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="$(MicrosoftCodeAnalysisCSharpVersion)" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="$(MicrosoftCodeAnalysisAnalyzersVersion)" />
</ItemGroup>

<!-- DevFlow dependencies (pinned, third party) -->
<ItemGroup Label="DevFlow">
<PackageVersion Include="Fizzler" Version="$(FizzlerVersion)" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="$(MicrosoftCodeAnalysisCSharpVersion)" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(MicrosoftCodeAnalysisCSharpVersion)" />
<PackageVersion Include="SkiaSharp" Version="$(SkiaSharpVersion)" />
<PackageVersion Include="Spectre.Console" Version="$(SpectreConsoleVersion)" />
Expand Down Expand Up @@ -63,17 +77,14 @@
<!-- EssentialsAI dependencies -->
<ItemGroup Label="EssentialsAI">
<PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="$(MicrosoftExtensionsAIAbstractionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.AI" Version="$(MicrosoftExtensionsAIVersion)" />
<!-- Sample app: Microsoft Agents AI -->
<PackageVersion Include="Microsoft.Agents.AI" Version="$(MicrosoftAgentsAIVersion)" />
<PackageVersion Include="Microsoft.Agents.AI.Hosting" Version="$(MicrosoftAgentsAIHostingVersion)" />
<PackageVersion Include="Microsoft.Agents.AI.Workflows" Version="$(MicrosoftAgentsAIWorkflowsVersion)" />
<PackageVersion Include="Microsoft.Agents.AI.Workflows.Generators" Version="$(MicrosoftAgentsAIWorkflowsGeneratorsVersion)" />
<!-- Sample app: additional packages (pinned) -->
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageVersion Include="Markdig" Version="0.31.0" />
<PackageVersion Include="Microsoft.Extensions.AI.OpenAI" Version="10.0.0-preview.1.25560.10" />
<PackageVersion Include="OpenAI" Version="2.6.0" />
<PackageVersion Include="OpenAI" Version="2.9.1" />
<!-- Unit tests -->
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<!-- Benchmarks -->
Expand All @@ -93,6 +104,8 @@
<PackageVersion Include="xunit" Version="$(XunitVersion)" />
<PackageVersion Include="xunit.runner.utility" Version="$(XunitVersion)" />
<PackageVersion Include="coverlet.collector" Version="$(CoverletCollectorVersion)" />
<PackageVersion Include="Verify.Xunit" Version="$(VerifyXunitVersion)" />
<PackageVersion Include="Verify.SourceGenerators" Version="$(VerifySourceGeneratorsVersion)" />
<PackageVersion Include="Microsoft.OpenApi" Version="$(MicrosoftOpenApiVersion)" />
<PackageVersion Include="YamlDotNet" Version="$(YamlDotNetVersion)" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing" Version="1.1.2" />
Expand Down
12 changes: 12 additions & 0 deletions MauiLabs.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<Project Path="playground/DevFlow.Console/DevFlow.Console.csproj" />
</Folder>
<Folder Name="/samples/">
<Project Path="samples/AIExtensions.Sample.Garden/AIExtensions.Sample.Garden.csproj" />
<Project Path="samples/AIExtensions.Sample.Hello/AIExtensions.Sample.Hello.csproj" />
<Project Path="samples/AIExtensions.Sample.DIParameters/AIExtensions.Sample.DIParameters.csproj" />
<Project Path="samples/DevFlow.Sample.Linux/DevFlow.Sample.Linux.csproj" />
<Project Path="samples/DevFlow.Sample.MacOS/DevFlow.Sample.MacOS.csproj" />
<Project Path="samples/DevFlow.Sample/DevFlow.Sample.csproj" />
Expand All @@ -17,6 +20,15 @@
<Folder Name="/src/AI/">
<Project Path="src/AI/Microsoft.Maui.Essentials.AI/Microsoft.Maui.Essentials.AI.csproj" />
</Folder>
<Folder Name="/src/AIExtensions/">
<Project Path="src/AIExtensions/Microsoft.Maui.AI.Attributes/Microsoft.Maui.AI.Attributes.csproj" />
<Project Path="src/AIExtensions/Microsoft.Maui.AI.Attributes.Generators/Microsoft.Maui.AI.Attributes.Generators.csproj" />
<Project Path="src/AIExtensions/Microsoft.Maui.AI.Indexer/Microsoft.Maui.AI.Indexer.csproj" />
<Project Path="src/AIExtensions/Microsoft.Maui.AI.Indexer.Generators/Microsoft.Maui.AI.Indexer.Generators.csproj" />
<Project Path="tests/AIExtensions/Microsoft.Maui.AI.Attributes.Tests/Microsoft.Maui.AI.Attributes.Tests.csproj" />
<Project Path="tests/AIExtensions/Microsoft.Maui.AI.Attributes.Generators.Tests/Microsoft.Maui.AI.Attributes.Generators.Tests.csproj" />
<Project Path="tests/AIExtensions/Microsoft.Maui.AI.Indexer.Tests/Microsoft.Maui.AI.Indexer.Tests.csproj" />
</Folder>
<Folder Name="/src/Comet/">
<Project Path="src/Comet/src/Comet.SourceGenerator/Comet.SourceGenerator.csproj" />
<Project Path="src/Comet/src/Comet/Comet.csproj" />
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ A comprehensive MAUI testing, automation, and debugging toolkit. The DevFlow CLI
| `Microsoft.Maui.DevFlow.Driver` | Platform driver library |
| `Microsoft.Maui.DevFlow.Logging` | Buffered JSONL file logger |

### AI Extensions

AI integration packages for `Microsoft.Extensions.AI` and .NET MAUI apps.

#### AI Attributes

Source-generated AI tool discovery — annotate methods or property accessors with `[ExportAIFunction]` to create AI-callable tools. Composed or auto-generated tool contexts, DI-aware parameter binding, approval gates, AOT-friendly.

| Package | Description |
|---------|-------------|
| `Microsoft.Maui.AI.Attributes` | Source-generated AI tool contexts for `Microsoft.Extensions.AI` |

### macOS AppKit Backend

A native macOS AppKit backend for .NET MAUI — run MAUI apps as true AppKit apps with NSWindow, NSButton, NSScrollView, native menu bar, sidebar flyout, and more. An alternative to Mac Catalyst.
Expand Down Expand Up @@ -168,6 +180,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for build instructions and development se

For the formal DevFlow HTTP and WebSocket contract, see [`docs/DevFlow/spec`](docs/DevFlow/spec/README.md).

For AI Extensions usage and samples, see [`src/AIExtensions/README.md`](src/AIExtensions/README.md) and [`samples/AIExtensions.Sample.Garden`](samples/AIExtensions.Sample.Garden/README.md).

## Support

See [SUPPORT.md](.github/SUPPORT.md) for how to file issues, get help, and the support policy for this repository.
18 changes: 15 additions & 3 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,26 @@
<MicrosoftExtensionsHttpVersion>10.0.5</MicrosoftExtensionsHttpVersion>
<MicrosoftExtensionsHostingVersion>10.0.5</MicrosoftExtensionsHostingVersion>
<MicrosoftExtensionsLoggingAbstractionsVersion>10.0.5</MicrosoftExtensionsLoggingAbstractionsVersion>
<MicrosoftExtensionsLoggingConsoleVersion>10.0.5</MicrosoftExtensionsLoggingConsoleVersion>
<MicrosoftExtensionsLoggingVersion>10.0.5</MicrosoftExtensionsLoggingVersion>
<MicrosoftExtensionsLoggingDebugVersion>10.0.5</MicrosoftExtensionsLoggingDebugVersion>
<MicrosoftExtensionsConfigurationJsonVersion>10.0.5</MicrosoftExtensionsConfigurationJsonVersion>
<MicrosoftExtensionsConfigurationUserSecretsVersion>10.0.5</MicrosoftExtensionsConfigurationUserSecretsVersion>
<SystemTextJsonVersion>10.0.5</SystemTextJsonVersion>
</PropertyGroup>
<PropertyGroup Label="AI">
<MicrosoftExtensionsAIVersion>10.4.1</MicrosoftExtensionsAIVersion>
<MicrosoftExtensionsAIOpenAIVersion>10.4.1</MicrosoftExtensionsAIOpenAIVersion>
<AzureAIOpenAIVersion>2.1.0</AzureAIOpenAIVersion>
</PropertyGroup>
<PropertyGroup Label="Roslyn">
<MicrosoftCodeAnalysisAnalyzersVersion>3.11.0</MicrosoftCodeAnalysisAnalyzersVersion>
</PropertyGroup>
<!-- Pinned dependencies (third party, not flowing via maestro) -->
<PropertyGroup Label="Third Party">
<AathifMahirMauiIconsCupertinoVersion>5.0.0</AathifMahirMauiIconsCupertinoVersion>
<CommunityToolkitMvvmVersion>8.4.2</CommunityToolkitMvvmVersion>
<FizzlerVersion>1.3.1</FizzlerVersion>
<MicrosoftCodeAnalysisCSharpVersion>4.12.0</MicrosoftCodeAnalysisCSharpVersion>
<SkiaSharpVersion>3.119.2</SkiaSharpVersion>
<SpectreConsoleVersion>0.54.0</SpectreConsoleVersion>
<SystemCommandLineStableVersion>2.0.5</SystemCommandLineStableVersion>
Expand Down Expand Up @@ -71,8 +82,7 @@
<PropertyGroup Label="EssentialsAI">
<EssentialsAIPreviewVersionIteration>1</EssentialsAIPreviewVersionIteration>
<!-- Microsoft Extensions AI -->
<MicrosoftExtensionsAIVersion>10.3.0</MicrosoftExtensionsAIVersion>
<MicrosoftExtensionsAIAbstractionsVersion>10.3.0</MicrosoftExtensionsAIAbstractionsVersion>
<MicrosoftExtensionsAIAbstractionsVersion>10.4.1</MicrosoftExtensionsAIAbstractionsVersion>
<!-- Microsoft Agents AI (sample only) -->
<MicrosoftAgentsAIVersion>1.0.0-rc2</MicrosoftAgentsAIVersion>
<MicrosoftAgentsAIWorkflowsVersion>1.0.0-rc2</MicrosoftAgentsAIWorkflowsVersion>
Expand All @@ -86,6 +96,8 @@
<XunitVersion>2.9.3</XunitVersion>
<XunitRunnerVisualstudioVersion>3.1.5</XunitRunnerVisualstudioVersion>
<CoverletCollectorVersion>8.0.0</CoverletCollectorVersion>
<VerifyXunitVersion>28.15.0</VerifyXunitVersion>
<VerifySourceGeneratorsVersion>2.5.0</VerifySourceGeneratorsVersion>
</PropertyGroup>
<PropertyGroup Label="SourceLink">
<MicrosoftSourceLinkGitHubVersion>10.0.201</MicrosoftSourceLinkGitHubVersion>
Expand Down
83 changes: 83 additions & 0 deletions eng/pipelines/devflow-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ parameters:
displayName: 'Publish macOS AppKit packages to NuGet.org'
type: boolean
default: false
- name: publishAIExtensionsNuget
displayName: 'Publish AI Extensions packages to NuGet.org'
type: boolean
default: false
- name: publishEssentialsAINuget
displayName: 'Publish EssentialsAI packages to NuGet.org'
type: boolean
Expand Down Expand Up @@ -141,6 +145,30 @@ extends:
$(_OfficialBuildArgs)
displayName: Build and Test Cli

- job: AI
displayName: AI Extensions - Windows
pool:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals windows.vs2026preview.scout.amd64
strategy:
matrix:
Release:
_BuildConfig: Release
_OfficialBuildArgs: /p:DotNetSignType=$(_SignType)
/p:TeamName=$(_TeamName)
/p:OfficialBuildId=$(BUILD.BUILDNUMBER)
steps:
- task: UseDotNet@2
displayName: Install .NET SDK
inputs:
version: 10.0.105
- script: eng\common\cibuild.cmd
-configuration $(_BuildConfig)
-prepareMachine
-projects $(Build.SourcesDirectory)\src\AIExtensions\AIExtensions.slnf
$(_OfficialBuildArgs)
displayName: Build and Test AI Extensions

- job: AppProjectReference
displayName: AppProjectReference - Windows
pool:
Expand Down Expand Up @@ -587,6 +615,61 @@ extends:
nuGetFeedType: external
publishFeedCredentials: 'nuget.org (dotnetframework)'

# Publish AI Extensions packages to NuGet.org
- ${{ if eq(parameters.publishAIExtensionsNuget, true) }}:
- stage: publish_ai_extensions_nuget
displayName: 'Publish AI Extensions to NuGet.org'
dependsOn:
- Validate
- publish_using_darc
jobs:
- job: PrepareArtifacts
displayName: 'Prepare AI Artifacts'
timeoutInMinutes: 15
pool:
name: NetCore1ESPool-Internal
image: windows.vs2026preview.scout.amd64
os: windows
templateContext:
outputs:
- output: pipelineArtifact
displayName: Publish AI Packages
targetPath: '$(Pipeline.Workspace)/AIPackages'
artifactName: AIPackagesForNuGet
steps:
- download: current
artifact: PackageArtifacts
displayName: Download PackageArtifacts
- powershell: |
New-Item -ItemType Directory -Force -Path '$(Pipeline.Workspace)/AIPackages'
Copy-Item '$(Pipeline.Workspace)/PackageArtifacts/Microsoft.Maui.AI.*.nupkg' '$(Pipeline.Workspace)/AIPackages/' -Verbose
displayName: Filter AI packages

- job: PublishNuGet
displayName: 'Push AI to NuGet.org'
dependsOn: PrepareArtifacts
timeoutInMinutes: 30
pool:
name: NetCore1ESPool-Internal
image: windows.vs2026preview.scout.amd64
os: windows
templateContext:
type: releaseJob
isProduction: true
inputs:
- input: pipelineArtifact
artifactName: AIPackagesForNuGet
targetPath: '$(Pipeline.Workspace)/AIPackages'
steps:
- task: 1ES.PublishNuget@1
displayName: 'Push AI to NuGet.org'
inputs:
useDotNetTask: false
packagesToPush: '$(Pipeline.Workspace)/AIPackages/*.nupkg'
packageParentPath: '$(Pipeline.Workspace)/AIPackages'
nuGetFeedType: external
publishFeedCredentials: 'nuget.org (dotnetframework)'

# Publish WPF packages to NuGet.org
- ${{ if eq(parameters.publishWpfNuget, true) }}:
- stage: publish_wpf_nuget
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>AIExtensions.Sample.DIParameters</RootNamespace>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>ai-attributes-secrets</UserSecretsId>

<!-- For inspecting source-generator output only. Not required to run the sample. -->
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.AI.OpenAI" />
<PackageReference Include="Microsoft.Extensions.AI" />
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\AIExtensions\Microsoft.Maui.AI.Attributes\Microsoft.Maui.AI.Attributes.csproj" />
<ProjectReference Include="..\..\src\AIExtensions\Microsoft.Maui.AI.Attributes.Generators\Microsoft.Maui.AI.Attributes.Generators.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false" />
</ItemGroup>

</Project>
20 changes: 20 additions & 0 deletions samples/AIExtensions.Sample.DIParameters/ModelProviders.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace AIExtensions.Sample.DIParameters;

/// <summary>
/// A keyed service. Pulled from DI using <c>[FromKeyedServices("premium")]</c>
/// or <c>[FromKeyedServices("free")]</c>.
/// </summary>
public interface IModelProvider
{
string Name { get; }
}

public sealed class FreeModelProvider : IModelProvider
{
public string Name => "free-v1";
}

public sealed class PremiumModelProvider : IModelProvider
{
public string Name => "premium-v2";
}
Loading
Loading