Skip to content

Commit 36e9efd

Browse files
Merge branch 'jlester/try-net' of https://github.com/Joshua-Lester3/EssentialCSharp.Web into jlester/try-net
2 parents 168c8d5 + ecf4699 commit 36e9efd

File tree

11 files changed

+81
-35
lines changed

11 files changed

+81
-35
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<PropertyGroup>
33
<Nullable>enable</Nullable>
4-
<LangVersion>12</LangVersion>
4+
<LangVersion>14</LangVersion>
55
<AnalysisMode>Recommended</AnalysisMode>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<PreserveCompilationContext>true</PreserveCompilationContext>

Directory.Packages.props

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
44
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
5-
<ToolingPackagesVersion>1.1.1.18576</ToolingPackagesVersion>
5+
<ToolingPackagesVersion>1.1.1.18585</ToolingPackagesVersion>
66
<AccessToNugetFeed>false</AccessToNugetFeed>
77
<RestoreSources>
88
https://api.nuget.org/v3/index.json;
@@ -16,7 +16,7 @@
1616
<PackageVersion Include="ContentFeedNuget" Version="$(ToolingPackagesVersion)" />
1717
</ItemGroup>
1818
<ItemGroup>
19-
<PackageVersion Include="AspNet.Security.OAuth.GitHub" Version="9.4.1" />
19+
<PackageVersion Include="AspNet.Security.OAuth.GitHub" Version="10.0.0" />
2020
<PackageVersion Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.4.0" />
2121
<PackageVersion Include="Azure.Identity" Version="1.17.1" />
2222
<PackageVersion Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.4.0" />
@@ -26,31 +26,31 @@
2626
<PackageVersion Include="HtmlAgilityPack" Version="1.12.4" />
2727
<PackageVersion Include="IntelliTect.Multitool" Version="1.5.3" />
2828
<PackageVersion Include="Mailjet.Api" Version="3.0.1" />
29-
<PackageVersion Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="9.0.13" />
30-
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.12" />
31-
<PackageVersion Include="Microsoft.AspNetCore.Identity.UI" Version="9.0.13" />
32-
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="9.0.12" />
33-
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.12" />
34-
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" />
35-
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
36-
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.10" />
37-
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />
38-
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.10" />
29+
<PackageVersion Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="10.0.3" />
30+
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.3" />
31+
<PackageVersion Include="Microsoft.AspNetCore.Identity.UI" Version="10.0.3" />
32+
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="10.0.3" />
33+
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.3" />
34+
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="5.0.0" />
35+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" />
36+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.3" />
37+
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.3" />
38+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.3" />
3939
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
40-
<PackageVersion Include="Microsoft.SemanticKernel" Version="1.60.0" />
41-
<PackageVersion Include="Microsoft.SemanticKernel.Connectors.PgVector" Version="1.60.0-preview" />
42-
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="10.0.102" />
40+
<PackageVersion Include="Microsoft.SemanticKernel" Version="1.70.0" />
41+
<PackageVersion Include="Microsoft.SemanticKernel.Connectors.PgVector" Version="1.70.0-preview" />
42+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="10.0.103" />
4343
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />
44-
<PackageVersion Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="9.0.0" />
44+
<PackageVersion Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="10.0.2" />
4545
<PackageVersion Include="ModelContextProtocol" Version="0.3.0-preview.4" />
4646
<PackageVersion Include="ModelContextProtocol.AspNetCore" Version="0.3.0-preview.4" />
4747
<PackageVersion Include="Moq" Version="4.20.72" />
4848
<PackageVersion Include="Moq.AutoMock" Version="3.6.1" />
4949
<PackageVersion Include="System.CommandLine" Version="2.0.3" />
5050
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
5151
<PackageVersion Include="Octokit" Version="14.0.0" />
52-
<PackageVersion Include="DotnetSitemapGenerator" Version="1.0.4" />
52+
<PackageVersion Include="DotnetSitemapGenerator" Version="2.0.0" />
5353
<PackageVersion Include="xunit" Version="2.9.3" />
5454
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
5555
</ItemGroup>
56-
</Project>
56+
</Project>

EssentialCSharp.Chat.Shared/EssentialCSharp.Chat.Common.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>

EssentialCSharp.Chat.Shared/Extensions/ServiceCollectionExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace EssentialCSharp.Chat.Common.Extensions;
1111

1212
public static class ServiceCollectionExtensions
1313
{
14-
private static readonly string[] PostgresScopes = ["https://ossrdbms-aad.database.windows.net/.default"];
14+
private static readonly string[] _PostgresScopes = ["https://ossrdbms-aad.database.windows.net/.default"];
1515

1616
/// <summary>
1717
/// Adds Azure OpenAI and related AI services to the service collection using Managed Identity
@@ -124,7 +124,7 @@ private static IServiceCollection AddPostgresVectorStoreWithManagedIdentity(
124124
if (isAzurePostgres && string.IsNullOrEmpty(builder.Password))
125125
{
126126
// Get access token for Azure PostgreSQL using managed identity
127-
var tokenRequestContext = new TokenRequestContext(PostgresScopes);
127+
var tokenRequestContext = new TokenRequestContext(_PostgresScopes);
128128
var accessToken = credential.GetToken(tokenRequestContext, default);
129129

130130
// Set the password to the access token

EssentialCSharp.Chat.Shared/Services/AIChatService.cs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ public class AIChatService
1313
{
1414
private readonly AIOptions _Options;
1515
private readonly AzureOpenAIClient _AzureClient;
16+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
1617
private readonly OpenAIResponseClient _ResponseClient;
18+
#pragma warning restore OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
1719
private readonly AISearchService _SearchService;
1820

1921
public AIChatService(IOptions<AIOptions> options, AISearchService searchService, AzureOpenAIClient azureClient)
@@ -24,7 +26,9 @@ public AIChatService(IOptions<AIOptions> options, AISearchService searchService,
2426
// Initialize Azure OpenAI client and get the Response Client from it
2527
_AzureClient = azureClient;
2628

29+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
2730
_ResponseClient = _AzureClient.GetOpenAIResponseClient(_Options.ChatDeploymentName);
31+
#pragma warning restore OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
2832
}
2933

3034
/// <summary>
@@ -43,8 +47,10 @@ public AIChatService(IOptions<AIOptions> options, AISearchService searchService,
4347
string? systemPrompt = null,
4448
string? previousResponseId = null,
4549
IMcpClient? mcpClient = null,
50+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
4651
IEnumerable<ResponseTool>? tools = null,
4752
ResponseReasoningEffortLevel? reasoningEffortLevel = null,
53+
#pragma warning restore OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
4854
bool enableContextualSearch = false,
4955
CancellationToken cancellationToken = default)
5056
{
@@ -69,8 +75,10 @@ public AIChatService(IOptions<AIOptions> options, AISearchService searchService,
6975
string? systemPrompt = null,
7076
string? previousResponseId = null,
7177
IMcpClient? mcpClient = null,
78+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
7279
IEnumerable<ResponseTool>? tools = null,
7380
ResponseReasoningEffortLevel? reasoningEffortLevel = null,
81+
#pragma warning restore OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
7482
bool enableContextualSearch = false,
7583
[System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken = default)
7684
{
@@ -81,12 +89,14 @@ public AIChatService(IOptions<AIOptions> options, AISearchService searchService,
8189
var systemContext = systemPrompt ?? _Options.SystemPrompt;
8290

8391
// Create the streaming response using the Responses API
92+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
8493
List<ResponseItem> responseItems = [ResponseItem.CreateUserMessageItem(enrichedPrompt)];
8594
if (systemContext is not null)
8695
{
8796
responseItems.Add(
8897
ResponseItem.CreateSystemMessageItem(systemContext));
8998
}
99+
#pragma warning restore OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
90100
var streamingUpdates = _ResponseClient.CreateResponseStreamingAsync(
91101
responseItems,
92102
options: responseOptions,
@@ -132,14 +142,17 @@ private async Task<string> EnrichPromptWithContext(string prompt, bool enableCon
132142
/// Processes streaming updates from the OpenAI Responses API, handling both regular responses and function calls
133143
/// </summary>
134144
private async IAsyncEnumerable<(string text, string? responseId)> ProcessStreamingUpdatesAsync(
145+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
135146
IAsyncEnumerable<StreamingResponseUpdate> streamingUpdates,
136147
ResponseCreationOptions responseOptions,
148+
#pragma warning restore OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
137149
IMcpClient? mcpClient,
138150
[System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken = default)
139151
{
140152
await foreach (var update in streamingUpdates.WithCancellation(cancellationToken))
141153
{
142154
string? responseId;
155+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
143156
if (update is StreamingResponseCreatedUpdate created)
144157
{
145158
// Remember the response ID for later function calls
@@ -169,15 +182,18 @@ private async Task<string> EnrichPromptWithContext(string prompt, bool enableCon
169182
{
170183
yield return (string.Empty, responseId: completedUpdate.Response.Id); // Signal completion with response ID
171184
}
185+
#pragma warning restore OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
172186
}
173187
}
174188

175189
/// <summary>
176190
/// Executes a function call and streams the response
177191
/// </summary>
178192
private async IAsyncEnumerable<(string text, string? responseId)> ExecuteFunctionCallAsync(
193+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
179194
FunctionCallResponseItem functionCallItem,
180195
ResponseCreationOptions responseOptions,
196+
#pragma warning restore OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
181197
IMcpClient mcpClient,
182198
[System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken = default)
183199
{
@@ -217,11 +233,13 @@ private async Task<string> EnrichPromptWithContext(string prompt, bool enableCon
217233

218234
// Create input items with both the function call and the result
219235
// This matches the Python pattern: append both tool_call and result
236+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
220237
var inputItems = new List<ResponseItem>
221238
{
222239
functionCallItem, // The original function call
223240
new FunctionCallOutputResponseItem(functionCallItem.CallId, string.Join("", toolResult.Content.Where(x => x.Type == "text").OfType<TextContentBlock>().Select(x => x.Text)))
224241
};
242+
#pragma warning restore OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
225243

226244
// Stream the function call response using the same processing logic
227245
var functionResponseStream = _ResponseClient.CreateResponseStreamingAsync(
@@ -238,6 +256,7 @@ private async Task<string> EnrichPromptWithContext(string prompt, bool enableCon
238256
/// <summary>
239257
/// Creates response options with optional features
240258
/// </summary>
259+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
241260
private static async Task<ResponseCreationOptions> CreateResponseOptionsAsync(
242261
string? previousResponseId = null,
243262
IEnumerable<ResponseTool>? tools = null,
@@ -247,6 +266,7 @@ private static async Task<ResponseCreationOptions> CreateResponseOptionsAsync(
247266
)
248267
{
249268
var options = new ResponseCreationOptions();
269+
#pragma warning restore OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
250270

251271
// Add conversation context if available
252272
if (!string.IsNullOrEmpty(previousResponseId))
@@ -267,17 +287,21 @@ private static async Task<ResponseCreationOptions> CreateResponseOptionsAsync(
267287
{
268288
await foreach (McpClientTool tool in mcpClient.EnumerateToolsAsync(cancellationToken: cancellationToken))
269289
{
270-
options.Tools.Add(ResponseTool.CreateFunctionTool(tool.Name, tool.Description, BinaryData.FromString(tool.JsonSchema.GetRawText())));
290+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
291+
options.Tools.Add(ResponseTool.CreateFunctionTool(tool.Name, functionDescription: tool.Description, strictModeEnabled: true, functionParameters: BinaryData.FromString(tool.JsonSchema.GetRawText())));
292+
#pragma warning restore OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
271293
}
272294
}
273295

274296
// Add reasoning options if specified
275297
if (reasoningEffortLevel.HasValue)
276298
{
299+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
277300
options.ReasoningOptions = new ResponseReasoningOptions()
278301
{
279302
ReasoningEffortLevel = reasoningEffortLevel.Value
280303
};
304+
#pragma warning restore OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
281305
}
282306

283307
return options;
@@ -288,20 +312,24 @@ private static async Task<ResponseCreationOptions> CreateResponseOptionsAsync(
288312
/// </summary>
289313
private async Task<(string response, string responseId)> GetChatCompletionCore(
290314
string prompt,
315+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
291316
ResponseCreationOptions responseOptions,
317+
#pragma warning restore OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
292318
string? systemPrompt = null,
293319
CancellationToken cancellationToken = default)
294320
{
295321
// Construct the user input with system context if provided
296322
var systemContext = systemPrompt ?? _Options.SystemPrompt;
297323

298324
// Create the streaming response using the Responses API
325+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
299326
List<ResponseItem> responseItems = [ResponseItem.CreateUserMessageItem(prompt)];
300327
if (systemContext is not null)
301328
{
302329
responseItems.Add(
303330
ResponseItem.CreateSystemMessageItem(systemContext));
304331
}
332+
#pragma warning restore OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
305333

306334
// Create the response using the Responses API
307335
var response = await _ResponseClient.CreateResponseAsync(
@@ -315,6 +343,7 @@ private static async Task<ResponseCreationOptions> CreateResponseOptionsAsync(
315343

316344
foreach (var outputItem in response.Value.OutputItems)
317345
{
346+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
318347
if (outputItem is MessageResponseItem messageItem &&
319348
messageItem.Role == MessageRole.Assistant)
320349
{
@@ -325,6 +354,7 @@ private static async Task<ResponseCreationOptions> CreateResponseOptionsAsync(
325354
break;
326355
}
327356
}
357+
#pragma warning restore OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
328358
}
329359

330360
return (responseText, responseId);

EssentialCSharp.Chat.Tests/EssentialCSharp.Chat.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<IsPackable>false</IsPackable>
66
</PropertyGroup>
77

EssentialCSharp.Chat/EssentialCSharp.Chat.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net9.0</TargetFramework>
5+
<TargetFramework>net10.0</TargetFramework>
66
<Version>0.0.1</Version>
77
</PropertyGroup>
88

EssentialCSharp.Web.Tests/EssentialCSharp.Web.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55

66
<IsPackable>false</IsPackable>
77
<IsPublishable>false</IsPublishable>

0 commit comments

Comments
 (0)