File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424 <BuildType Solution =" Publish|*" Project =" Release" />
2525 </Project >
2626 </Folder >
27+ <Folder Name =" /Demos/" >
28+ <Project Path =" demos/MinimalConsole/MinimalConsole.csproj" >
29+ <BuildType Solution =" Publish|*" Project =" Release" />
30+ </Project >
31+ </Folder >
2732 <Folder Name =" /Samples/" >
2833 <Project Path =" samples/GettingStarted/GettingStarted.csproj" >
2934 <BuildType Solution =" Publish|*" Project =" Debug" />
Original file line number Diff line number Diff line change 1+ # Suppressing errors for Sample projects under dotnet/samples folder
2+ [* .cs ]
3+ dotnet_diagnostic.CA2007.severity = none # Do not directly await a Task
4+ dotnet_diagnostic.CS1591.severity = none # Missing XML comment for publicly visible type or member
5+ dotnet_diagnostic.IDE1006.severity = warning # Naming rule violations
6+ dotnet_diagnostic.VSTHRD111.severity = none # Use .ConfigureAwait(bool) is hidden by default, set to none to prevent IDE from changing on autosave
7+ dotnet_diagnostic.CA1716.severity = none # Add summary to documentation comment.
8+ dotnet_diagnostic.CA2000.severity = none # Call System.IDisposable.Dispose on object before all references to it are out of scope
Original file line number Diff line number Diff line change 1+ <Project Sdk =" Microsoft.NET.Sdk" >
2+
3+ <PropertyGroup >
4+ <OutputType >Exe</OutputType >
5+ <TargetFrameworks >$(ProjectsTargetFrameworks)</TargetFrameworks >
6+ <TargetFrameworks Condition =" '$(Configuration)' == 'Debug'" >$(ProjectsDebugTargetFrameworks)</TargetFrameworks >
7+ </PropertyGroup >
8+
9+ <ItemGroup >
10+ <PackageReference Include =" Azure.AI.OpenAI" />
11+ <PackageReference Include =" Azure.Identity" />
12+ <PackageReference Include =" Microsoft.Extensions.AI.OpenAI" />
13+ </ItemGroup >
14+
15+ <ItemGroup >
16+ <ProjectReference Include =" ..\..\src\Microsoft.Extensions.AI.Agents\Microsoft.Extensions.AI.Agents.csproj" />
17+ </ItemGroup >
18+
19+ </Project >
Original file line number Diff line number Diff line change 1+ // Copyright (c) Microsoft. All rights reserved.
2+
3+ using System ;
4+ using System . ComponentModel ;
5+ using Azure . AI . OpenAI ;
6+ using Azure . Identity ;
7+ using Microsoft . Extensions . AI ;
8+ using Microsoft . Extensions . AI . Agents ;
9+
10+ [ Description ( "Get the weather for a given location." ) ]
11+ static string GetWeather ( [ Description ( "The location to get the weather for." ) ] string location )
12+ {
13+ return $ "The weather in { location } is cloudy with a high of 15°C.";
14+ }
15+
16+ IChatClient chatClient = new AzureOpenAIClient (
17+ new Uri ( Environment . GetEnvironmentVariable ( "AZURE_OPENAI_ENDPOINT" ) ! ) ,
18+ new AzureCliCredential ( ) )
19+ . GetChatClient ( "gpt-4o-mini" )
20+ . AsIChatClient ( ) ;
21+
22+ AIAgent agent = new ChatClientAgent (
23+ chatClient ,
24+ instructions : "You are a helpful assistant, you can help the user with weather information." ,
25+ tools : [ AIFunctionFactory . Create ( GetWeather ) ] ) ;
26+
27+ Console . WriteLine ( await agent . RunAsync ( "What's the weather in Amsterdam?" ) ) ;
You can’t perform that action at this time.
0 commit comments