-
Notifications
You must be signed in to change notification settings - Fork 751
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add NativeAOT testapp project for M.E.AI (#5573)
* Add NativeAOT testapp project for M.E.AI * Address PR feedback
- Loading branch information
1 parent
443dc6e
commit 090d7a2
Showing
5 changed files
with
104 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...sions.AI.AotCompatibility.TestApp/Microsoft.Extensions.AI.AotCompatibility.TestApp.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFrameworks>$(LatestTargetFramework)</TargetFrameworks> | ||
<PublishAot>true</PublishAot> | ||
<TrimmerSingleWarn>false</TrimmerSingleWarn> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<TrimmerRootAssembly Include="Microsoft.Extensions.AI" /> | ||
<TrimmerRootAssembly Include="Microsoft.Extensions.AI.Abstractions" /> | ||
<TrimmerRootAssembly Include="Microsoft.Extensions.AI.Ollama" /> | ||
<!-- Azure.AI.Inference produces many warnings | ||
<TrimmerRootAssembly Include="Microsoft.Extensions.AI.AzureAIInference" /> | ||
--> | ||
<!-- OpenAI produces a few warnings | ||
<TrimmerRootAssembly Include="Microsoft.Extensions.AI.OpenAI" /> | ||
--> | ||
|
||
<TrimmerRootAssembly Update="@(TrimmerRootAssembly)" Path="$(RepoRoot)\src\Libraries\%(Identity)\%(Identity).csproj" /> | ||
<ProjectReference Include="@(TrimmerRootAssembly->'%(Path)')" /> | ||
</ItemGroup> | ||
|
||
</Project> |
22 changes: 22 additions & 0 deletions
22
test/Libraries/Microsoft.Extensions.AI.AotCompatibility.TestApp/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
#pragma warning disable S125 // Remove this commented out code | ||
|
||
using Microsoft.Extensions.AI; | ||
|
||
// Use types from each library. | ||
|
||
// Microsoft.Extensions.AI.Ollama | ||
using var b = new OllamaChatClient("http://localhost:11434", "llama3.2"); | ||
|
||
// Microsoft.Extensions.AI.AzureAIInference | ||
// using var a = new Azure.AI.Inference.ChatCompletionClient(new Uri("http://localhost"), new("apikey")); // uncomment once warnings in Azure.AI.Inference are addressed | ||
|
||
// Microsoft.Extensions.AI.OpenAI | ||
// using var c = new OpenAI.OpenAIClient("apikey").AsChatClient("gpt-4o-mini"); // uncomment once warnings in OpenAI are addressed | ||
|
||
// Microsoft.Extensions.AI | ||
AIFunctionFactory.Create(() => { }); | ||
|
||
System.Console.WriteLine("Success!"); |