Skip to content

Commit

Permalink
⬆️ Bump Package Versions (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
MattParkerDev authored Jan 16, 2025
1 parent 5541b1b commit 5abe523
Show file tree
Hide file tree
Showing 29 changed files with 67 additions and 73 deletions.
6 changes: 3 additions & 3 deletions src/Application/Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Betalgo.OpenAI" Version="6.8.6" />
<PackageReference Include="Betalgo.OpenAI" Version="8.7.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Polly" Version="8.3.1" />
<PackageReference Include="SharpToken" Version="1.0.28" />
<PackageReference Include="Polly" Version="8.5.1" />
<PackageReference Include="SharpToken" Version="2.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Domain\Domain.csproj" />
Expand Down
6 changes: 3 additions & 3 deletions src/Application/Contracts/IOpenAiChatCompletionsService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using OpenAI.GPT3.ObjectModels;
using OpenAI.GPT3.ObjectModels.RequestModels;
using OpenAI.GPT3.ObjectModels.ResponseModels;
using OpenAI.ObjectModels;
using OpenAI.ObjectModels.RequestModels;
using OpenAI.ObjectModels.ResponseModels;

namespace Application.Contracts;

Expand Down
6 changes: 3 additions & 3 deletions src/Application/Services/ChatCompletionsService.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Runtime.CompilerServices;
using Application.Contracts;
using Microsoft.Extensions.Logging;
using OpenAI.GPT3.ObjectModels;
using OpenAI.GPT3.ObjectModels.RequestModels;
using OpenAI.ObjectModels;
using OpenAI.ObjectModels.RequestModels;

namespace Application.Services;

Expand Down Expand Up @@ -89,7 +89,7 @@ [EnumeratorCancellation] CancellationToken cancellationToken
yield return new SharedClasses.ChatMessage("assistant", "⚠️ *GPT-4 Request failed, reverting to GPT-3.5 Turbo.*" + Environment.NewLine);
await foreach (
var chatMessage in RequestNewCompletionMessage(messageList, apiKey,
Models.Model.ChatGpt3_5Turbo,
Models.Model.Gpt_3_5_Turbo,
cancellationToken))
{
yield return chatMessage;
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Services/MessageHandler.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Runtime.CompilerServices;
using System.Text.Json;
using OpenAI.GPT3.ObjectModels;
using OpenAI.ObjectModels;
using SharedClasses;

namespace Application.Services;
Expand Down
6 changes: 3 additions & 3 deletions src/Application/Services/OpenAiServiceFactory.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.Extensions.Configuration;
using OpenAI.GPT3;
using OpenAI.GPT3.Interfaces;
using OpenAI.GPT3.Managers;
using OpenAI;
using OpenAI.Interfaces;
using OpenAI.Managers;

namespace Application.Services;

Expand Down
2 changes: 1 addition & 1 deletion src/Application/Services/PruningService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Domain;
using Domain.DTOs;
using OpenAI.GPT3.ObjectModels;
using OpenAI.ObjectModels;
using SharedClasses;

namespace Application.Services;
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Services/RelevantRulesService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Application.Contracts;
using Domain.DTOs;
using OpenAI.GPT3.ObjectModels;
using OpenAI.ObjectModels;
using Pgvector;
using SharedClasses;

Expand Down
8 changes: 4 additions & 4 deletions src/Application/Services/TokenService.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using OpenAI.GPT3.ObjectModels;
using SharpToken;
using SharpToken;
using Domain;
using Domain.DTOs;
using OpenAI.ObjectModels;
using SharedClasses;

namespace Application.Services;
Expand Down Expand Up @@ -29,7 +29,7 @@ private TokenResult GetTokenCount(List<string> messageList, Models.Model model)
var allowedTokens = model switch
{
Models.Model.Gpt_4 => Gpt4AllowedTokens,
Models.Model.ChatGpt3_5Turbo => Gpt3AllowedTokens,
Models.Model.Gpt_3_5_Turbo => Gpt3AllowedTokens,
_ => throw new ArgumentOutOfRangeException()
};

Expand All @@ -45,7 +45,7 @@ public int GetMaxAllowedTokens(Models.Model gptModel)
{
return gptModel switch
{
Models.Model.ChatGpt3_5Turbo => Gpt3AllowedTokens,
Models.Model.Gpt_3_5_Turbo => Gpt3AllowedTokens,
Models.Model.Gpt_4 => Gpt4AllowedTokens,
_ => throw new ArgumentOutOfRangeException(),
};
Expand Down
2 changes: 1 addition & 1 deletion src/Domain/Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Betalgo.OpenAI" Version="6.8.6" />
<PackageReference Include="Betalgo.OpenAI" Version="8.7.2" />
<PackageReference Include="Pgvector.EntityFrameworkCore" Version="0.2.1" />
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 1 addition & 3 deletions src/Infrastructure/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using OpenAI.GPT3.Extensions;
using Pgvector.EntityFrameworkCore;
using OpenAI.Extensions;
using Polly;

namespace Infrastructure;
Expand Down Expand Up @@ -36,7 +35,6 @@ IConfiguration config
: 50;

var rateLimitPolicy = Policy.RateLimitAsync(maxRequestsPerMinute, TimeSpan.FromSeconds(60));

services.AddOpenAIService(settings =>
{
settings.ApiKey = openAiApiKey;
Expand Down
6 changes: 3 additions & 3 deletions src/Infrastructure/Infrastructure.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="9.0.0" />
<PackageReference Include="Microsoft.SemanticKernel" Version="1.33.0" />
<PackageReference Include="Microsoft.SemanticKernel" Version="1.17.2" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.2" />
<PackageReference Include="Polly" Version="8.3.1" />
<PackageReference Include="OpenAI" Version="2.1.0" />
<PackageReference Include="Polly" Version="8.5.1" />
<PackageReference Include="Polly.Extensions.Http" Version="3.0.0" />
<PackageReference Include="supabase-csharp" Version="0.9.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Application\Application.csproj" />
Expand Down
11 changes: 6 additions & 5 deletions src/Infrastructure/Services/OpenAiChatCompletionsService.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Application.Contracts;
using Application.Services;
using Microsoft.Extensions.Configuration;
using OpenAI.GPT3.Interfaces;
using OpenAI.GPT3.ObjectModels;
using OpenAI.GPT3.ObjectModels.RequestModels;
using OpenAI.GPT3.ObjectModels.ResponseModels;
using OpenAI.Interfaces;
using OpenAI.ObjectModels;
using OpenAI.ObjectModels.RequestModels;
using OpenAI.ObjectModels.ResponseModels;
using Polly.RateLimit;

namespace Infrastructure.Services;
Expand Down Expand Up @@ -47,7 +47,8 @@ CancellationToken cancellationToken
{
return openAiService.ChatCompletion.CreateCompletionAsStream(
chatCompletionCreateRequest,
gptModelStr,
gptModelStr,
true,
cancellationToken
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Infrastructure/Services/OpenAiEmbeddingService.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Application.Contracts;
using Microsoft.Extensions.Configuration;
using Application.Services;
using OpenAI.GPT3.Interfaces;
using OpenAI.GPT3.ObjectModels;
using OpenAI.GPT3.ObjectModels.RequestModels;
using OpenAI.Interfaces;
using OpenAI.ObjectModels;
using OpenAI.ObjectModels.RequestModels;
using Pgvector;
using Polly.RateLimit;

Expand Down
4 changes: 2 additions & 2 deletions src/Shared/AvailableGptModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

public enum AvailableGptModels
{
Gpt35Turbo = OpenAI.GPT3.ObjectModels.Models.Model.ChatGpt3_5Turbo,
Gpt4 = OpenAI.GPT3.ObjectModels.Models.Model.Gpt_4
Gpt35Turbo = OpenAI.ObjectModels.Models.Model.Gpt_3_5_Turbo,
Gpt4 = OpenAI.ObjectModels.Models.Model.Gpt_4
}

public static class AvailableGptModelsExtensions
Expand Down
1 change: 0 additions & 1 deletion src/Shared/ChatLinkedListItem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Text.Json.Serialization;
using OpenAI.GPT3.ObjectModels.RequestModels;

namespace SharedClasses;

Expand Down
2 changes: 1 addition & 1 deletion src/Shared/ChatMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class ChatMessage
//Required for deserialization
public ChatMessage() { }

Check warning on line 6 in src/Shared/ChatMessage.cs

View workflow job for this annotation

GitHub Actions / call-reusable-build-and-deploy / build

Non-nullable property 'Role' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 6 in src/Shared/ChatMessage.cs

View workflow job for this annotation

GitHub Actions / call-reusable-build-and-deploy / build

Non-nullable property 'Content' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 6 in src/Shared/ChatMessage.cs

View workflow job for this annotation

GitHub Actions / call-reusable-build-and-deploy / build

Non-nullable property 'Role' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 6 in src/Shared/ChatMessage.cs

View workflow job for this annotation

GitHub Actions / call-reusable-build-and-deploy / build

Non-nullable property 'Content' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

public ChatMessage(OpenAI.GPT3.ObjectModels.RequestModels.ChatMessage message)
public ChatMessage(OpenAI.ObjectModels.RequestModels.ChatMessage message)

Check warning on line 8 in src/Shared/ChatMessage.cs

View workflow job for this annotation

GitHub Actions / call-reusable-build-and-deploy / build

Non-nullable property 'Content' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 8 in src/Shared/ChatMessage.cs

View workflow job for this annotation

GitHub Actions / call-reusable-build-and-deploy / build

Non-nullable property 'Content' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
{
Role = message.Role;
Content = message.Content;

Check warning on line 11 in src/Shared/ChatMessage.cs

View workflow job for this annotation

GitHub Actions / call-reusable-build-and-deploy / build

Possible null reference assignment.

Check warning on line 11 in src/Shared/ChatMessage.cs

View workflow job for this annotation

GitHub Actions / call-reusable-build-and-deploy / build

Possible null reference assignment.
Expand Down
2 changes: 1 addition & 1 deletion src/Shared/Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<RootNamespace>Shared</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Betalgo.OpenAI" Version="6.8.6" />
<PackageReference Include="Betalgo.OpenAI" Version="8.7.2" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/WebAPI/SignalR/RulesHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Domain.Entities;
using Duende.IdentityServer.Extensions;
using Microsoft.AspNetCore.SignalR;
using OpenAI.GPT3.ObjectModels;
using OpenAI.ObjectModels;
using Polly.RateLimit;
using SharedClasses;

Expand Down Expand Up @@ -98,7 +98,7 @@ CancellationToken cancellationToken
else if (!isAuthenticated && string.IsNullOrWhiteSpace(apiKey) && gptModel == Models.Model.Gpt_4)
{
Clients.Caller.ReceiveInvalidModelWarning();
gptModel = Models.Model.ChatGpt3_5Turbo;
gptModel = Models.Model.Gpt_3_5_Turbo;
}

return _messageHandler.Handle(messageList, apiKey, gptModel, cancellationToken);
Expand Down
2 changes: 1 addition & 1 deletion src/WebAPI/WebAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="9.0.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
<PackageReference Include="Duende.BFF" Version="1.1.0" />
<PackageReference Include="Duende.BFF" Version="2.3.0" />
<PackageReference Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0" />
Expand Down
1 change: 0 additions & 1 deletion src/WebUI/Components/RulesBotChat.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@using OpenAI.GPT3.ObjectModels.RequestModels
@using DialogService = WebUI.Services.DialogService;

@inject DataState DataState
Expand Down
2 changes: 1 addition & 1 deletion src/WebUI/Models/DataState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public DataState(NotifierService notifierService, RulesGptClient rulesGptClient)
public bool IsAwaitingResponseStream { get; set; }

public AvailableGptModels SelectedGptModel { get; set; } =
(AvailableGptModels)OpenAI.GPT3.ObjectModels.Models.Model.ChatGpt3_5Turbo;
(AvailableGptModels)OpenAI.ObjectModels.Models.Model.Gpt_3_5_Turbo;

public async Task CancelStreamingResponse()
{
Expand Down
12 changes: 6 additions & 6 deletions src/WebUI/Services/ApiKeyValidationService.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
using OpenAI.GPT3;
using OpenAI.GPT3.Managers;
using OpenAI.GPT3.ObjectModels;
using OpenAI.GPT3.ObjectModels.RequestModels;
using OpenAI;
using OpenAI.Managers;
using OpenAI.ObjectModels;
using OpenAI.ObjectModels.RequestModels;
using SharedClasses;
using WebUI.Classes;
using ChatMessage = OpenAI.GPT3.ObjectModels.RequestModels.ChatMessage;
using ChatMessage = OpenAI.ObjectModels.RequestModels.ChatMessage;

namespace WebUI.Services;

public class ApiKeyValidationService
{
public async Task<ApiValidationResult> ValidateApiKey(string apiKey, AvailableGptModels gptModel)
{
var model = (OpenAI.GPT3.ObjectModels.Models.Model)gptModel;
var model = (OpenAI.ObjectModels.Models.Model)gptModel;
var customAiService = new OpenAIService(new OpenAiOptions { ApiKey = apiKey });
var completionResult = await customAiService.ChatCompletion.CreateCompletion(
new ChatCompletionCreateRequest
Expand Down
2 changes: 1 addition & 1 deletion src/WebUI/Services/MessagingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private async Task SendMessageInternal(ChatMessage assistantMessage)
var resultStream = _signalRClient.RequestNewCompletionMessage(
_dataState.Conversation.CurrentThread.Select(s => s.Message).ToList(),
_dataState.ApiKeyString,
(OpenAI.GPT3.ObjectModels.Models.Model)_dataState.SelectedGptModel,
(OpenAI.ObjectModels.Models.Model)_dataState.SelectedGptModel,
_dataState.CancellationTokenSource.Token);

await foreach (var result in resultStream)
Expand Down
7 changes: 3 additions & 4 deletions src/WebUI/SignalRClient.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Runtime.CompilerServices;
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
using Microsoft.AspNetCore.SignalR.Client;
using OpenAI.GPT3.ObjectModels.RequestModels;
using SharedClasses;
using WebUI.Services;
using ChatMessage = SharedClasses.ChatMessage;
Expand Down Expand Up @@ -77,12 +76,12 @@ public StatusHubConnectionState GetConnectionState()
public async IAsyncEnumerable<ChatMessage?> RequestNewCompletionMessage(
List<ChatMessage> messageList,
string? apiKey,
OpenAI.GPT3.ObjectModels.Models.Model gptModel,
OpenAI.ObjectModels.Models.Model gptModel,
[EnumeratorCancellation] CancellationToken cancellationToken)
{
var mappedList = messageList.Select(s => new OpenAI.GPT3.ObjectModels.RequestModels.ChatMessage(s.Role, s.Content, s.Name));
var mappedList = messageList.Select(s => new OpenAI.ObjectModels.RequestModels.ChatMessage(s.Role, s.Content, s.Name));

var completionResult = _connection.StreamAsync<OpenAI.GPT3.ObjectModels.RequestModels.ChatMessage?>(
var completionResult = _connection.StreamAsync<OpenAI.ObjectModels.RequestModels.ChatMessage?>(
"RequestNewCompletionMessage",
mappedList,
apiKey,
Expand Down
10 changes: 5 additions & 5 deletions src/WebUI/WebUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Blazor-Analytics" Version="3.11.0" />
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
<PackageReference Include="Betalgo.OpenAI" Version="6.8.6" />
<PackageReference Include="Markdig" Version="0.31.0" />
<PackageReference Include="Blazor-Analytics" Version="3.12.0" />
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
<PackageReference Include="Betalgo.OpenAI" Version="8.7.2" />
<PackageReference Include="Markdig" Version="0.40.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0" />
<PackageReference Include="MudBlazor" Version="7.15.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Polly" Version="8.3.1" />
<PackageReference Include="Polly" Version="8.5.1" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Helpers\JwtHandler.cs" />
Expand Down
2 changes: 0 additions & 2 deletions src/WebUI/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
@using WebUI.Models
@using WebUI.Components
@using WebUI.Services
@using OpenAI.GPT3.Interfaces
@using OpenAI.GPT3.ObjectModels
@using Blazor.Analytics
@using Blazor.Analytics.Components
@using Blazored.LocalStorage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="FluentAssertions" Version="6.12.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="coverlet.collector" Version="6.0.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Infrastructure.Services;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using OpenAI.GPT3.ObjectModels;
using OpenAI.ObjectModels;
using Pgvector.EntityFrameworkCore;
using SharedClasses;

Expand Down Expand Up @@ -55,7 +55,7 @@ string dbRuleName
var relevantRules = await relevantRulesService.GetRelevantRules(
messageList,
apiKey: null,
gptModel: Models.Model.ChatGpt3_5Turbo
gptModel: Models.Model.Gpt_3_5_Turbo
);

//Assert
Expand Down
Loading

0 comments on commit 5abe523

Please sign in to comment.