From 5abe5231b1dc4d45947e1607a91404d9205b76d4 Mon Sep 17 00:00:00 2001
From: "Matthew Parker [SSW]" <61717342+MattParkerDev@users.noreply.github.com>
Date: Thu, 16 Jan 2025 14:31:39 +1000
Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Bump=20Package=20Versions?=
=?UTF-8?q?=20(#174)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Application/Application.csproj | 6 +++---
.../Contracts/IOpenAiChatCompletionsService.cs | 6 +++---
src/Application/Services/ChatCompletionsService.cs | 6 +++---
src/Application/Services/MessageHandler.cs | 2 +-
src/Application/Services/OpenAiServiceFactory.cs | 6 +++---
src/Application/Services/PruningService.cs | 2 +-
src/Application/Services/RelevantRulesService.cs | 2 +-
src/Application/Services/TokenService.cs | 8 ++++----
src/Domain/Domain.csproj | 2 +-
src/Infrastructure/DependencyInjection.cs | 4 +---
src/Infrastructure/Infrastructure.csproj | 6 +++---
.../Services/OpenAiChatCompletionsService.cs | 11 ++++++-----
.../Services/OpenAiEmbeddingService.cs | 6 +++---
src/Shared/AvailableGptModels.cs | 4 ++--
src/Shared/ChatLinkedListItem.cs | 1 -
src/Shared/ChatMessage.cs | 2 +-
src/Shared/Shared.csproj | 2 +-
src/WebAPI/SignalR/RulesHub.cs | 4 ++--
src/WebAPI/WebAPI.csproj | 2 +-
src/WebUI/Components/RulesBotChat.razor | 1 -
src/WebUI/Models/DataState.cs | 2 +-
src/WebUI/Services/ApiKeyValidationService.cs | 12 ++++++------
src/WebUI/Services/MessagingService.cs | 2 +-
src/WebUI/SignalRClient.cs | 7 +++----
src/WebUI/WebUI.csproj | 10 +++++-----
src/WebUI/_Imports.razor | 2 --
.../Application.IntegrationTests.csproj | 8 ++++----
.../Services/RelevantRulesServiceTests.cs | 4 ++--
.../Application.UnitTests.csproj | 10 +++++-----
29 files changed, 67 insertions(+), 73 deletions(-)
diff --git a/src/Application/Application.csproj b/src/Application/Application.csproj
index a5c9a91..f8323cc 100644
--- a/src/Application/Application.csproj
+++ b/src/Application/Application.csproj
@@ -5,14 +5,14 @@
enable
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
diff --git a/src/Application/Contracts/IOpenAiChatCompletionsService.cs b/src/Application/Contracts/IOpenAiChatCompletionsService.cs
index aa399a5..acdb304 100644
--- a/src/Application/Contracts/IOpenAiChatCompletionsService.cs
+++ b/src/Application/Contracts/IOpenAiChatCompletionsService.cs
@@ -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;
diff --git a/src/Application/Services/ChatCompletionsService.cs b/src/Application/Services/ChatCompletionsService.cs
index 7b1fe17..7ad8c18 100644
--- a/src/Application/Services/ChatCompletionsService.cs
+++ b/src/Application/Services/ChatCompletionsService.cs
@@ -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;
@@ -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;
diff --git a/src/Application/Services/MessageHandler.cs b/src/Application/Services/MessageHandler.cs
index 9d0fc20..85962cb 100644
--- a/src/Application/Services/MessageHandler.cs
+++ b/src/Application/Services/MessageHandler.cs
@@ -1,6 +1,6 @@
using System.Runtime.CompilerServices;
using System.Text.Json;
-using OpenAI.GPT3.ObjectModels;
+using OpenAI.ObjectModels;
using SharedClasses;
namespace Application.Services;
diff --git a/src/Application/Services/OpenAiServiceFactory.cs b/src/Application/Services/OpenAiServiceFactory.cs
index 3ee0611..8eba517 100644
--- a/src/Application/Services/OpenAiServiceFactory.cs
+++ b/src/Application/Services/OpenAiServiceFactory.cs
@@ -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;
diff --git a/src/Application/Services/PruningService.cs b/src/Application/Services/PruningService.cs
index d9807de..34f655d 100644
--- a/src/Application/Services/PruningService.cs
+++ b/src/Application/Services/PruningService.cs
@@ -1,6 +1,6 @@
using Domain;
using Domain.DTOs;
-using OpenAI.GPT3.ObjectModels;
+using OpenAI.ObjectModels;
using SharedClasses;
namespace Application.Services;
diff --git a/src/Application/Services/RelevantRulesService.cs b/src/Application/Services/RelevantRulesService.cs
index e35c494..81401a6 100644
--- a/src/Application/Services/RelevantRulesService.cs
+++ b/src/Application/Services/RelevantRulesService.cs
@@ -1,6 +1,6 @@
using Application.Contracts;
using Domain.DTOs;
-using OpenAI.GPT3.ObjectModels;
+using OpenAI.ObjectModels;
using Pgvector;
using SharedClasses;
diff --git a/src/Application/Services/TokenService.cs b/src/Application/Services/TokenService.cs
index ab62d19..76f099d 100644
--- a/src/Application/Services/TokenService.cs
+++ b/src/Application/Services/TokenService.cs
@@ -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;
@@ -29,7 +29,7 @@ private TokenResult GetTokenCount(List 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()
};
@@ -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(),
};
diff --git a/src/Domain/Domain.csproj b/src/Domain/Domain.csproj
index c75f9d5..a3b6172 100644
--- a/src/Domain/Domain.csproj
+++ b/src/Domain/Domain.csproj
@@ -5,7 +5,7 @@
enable
-
+
diff --git a/src/Infrastructure/DependencyInjection.cs b/src/Infrastructure/DependencyInjection.cs
index f1a9450..2b52d61 100644
--- a/src/Infrastructure/DependencyInjection.cs
+++ b/src/Infrastructure/DependencyInjection.cs
@@ -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;
@@ -36,7 +35,6 @@ IConfiguration config
: 50;
var rateLimitPolicy = Policy.RateLimitAsync(maxRequestsPerMinute, TimeSpan.FromSeconds(60));
-
services.AddOpenAIService(settings =>
{
settings.ApiKey = openAiApiKey;
diff --git a/src/Infrastructure/Infrastructure.csproj b/src/Infrastructure/Infrastructure.csproj
index 269141f..a2d1e18 100644
--- a/src/Infrastructure/Infrastructure.csproj
+++ b/src/Infrastructure/Infrastructure.csproj
@@ -10,11 +10,11 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
-
+
+
-
diff --git a/src/Infrastructure/Services/OpenAiChatCompletionsService.cs b/src/Infrastructure/Services/OpenAiChatCompletionsService.cs
index 1efbb76..7ce1db1 100644
--- a/src/Infrastructure/Services/OpenAiChatCompletionsService.cs
+++ b/src/Infrastructure/Services/OpenAiChatCompletionsService.cs
@@ -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;
@@ -47,7 +47,8 @@ CancellationToken cancellationToken
{
return openAiService.ChatCompletion.CreateCompletionAsStream(
chatCompletionCreateRequest,
- gptModelStr,
+ gptModelStr,
+ true,
cancellationToken
);
}
diff --git a/src/Infrastructure/Services/OpenAiEmbeddingService.cs b/src/Infrastructure/Services/OpenAiEmbeddingService.cs
index d8aa456..99315df 100644
--- a/src/Infrastructure/Services/OpenAiEmbeddingService.cs
+++ b/src/Infrastructure/Services/OpenAiEmbeddingService.cs
@@ -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;
diff --git a/src/Shared/AvailableGptModels.cs b/src/Shared/AvailableGptModels.cs
index c7044ea..cb72421 100644
--- a/src/Shared/AvailableGptModels.cs
+++ b/src/Shared/AvailableGptModels.cs
@@ -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
diff --git a/src/Shared/ChatLinkedListItem.cs b/src/Shared/ChatLinkedListItem.cs
index 7abf46e..49bed2a 100644
--- a/src/Shared/ChatLinkedListItem.cs
+++ b/src/Shared/ChatLinkedListItem.cs
@@ -1,5 +1,4 @@
using System.Text.Json.Serialization;
-using OpenAI.GPT3.ObjectModels.RequestModels;
namespace SharedClasses;
diff --git a/src/Shared/ChatMessage.cs b/src/Shared/ChatMessage.cs
index 2c97878..6e96cb2 100644
--- a/src/Shared/ChatMessage.cs
+++ b/src/Shared/ChatMessage.cs
@@ -5,7 +5,7 @@ public class ChatMessage
//Required for deserialization
public ChatMessage() { }
- public ChatMessage(OpenAI.GPT3.ObjectModels.RequestModels.ChatMessage message)
+ public ChatMessage(OpenAI.ObjectModels.RequestModels.ChatMessage message)
{
Role = message.Role;
Content = message.Content;
diff --git a/src/Shared/Shared.csproj b/src/Shared/Shared.csproj
index 1c57e16..71757ef 100644
--- a/src/Shared/Shared.csproj
+++ b/src/Shared/Shared.csproj
@@ -6,6 +6,6 @@
Shared
-
+
\ No newline at end of file
diff --git a/src/WebAPI/SignalR/RulesHub.cs b/src/WebAPI/SignalR/RulesHub.cs
index ac84aa7..b9a4022 100644
--- a/src/WebAPI/SignalR/RulesHub.cs
+++ b/src/WebAPI/SignalR/RulesHub.cs
@@ -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;
@@ -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);
diff --git a/src/WebAPI/WebAPI.csproj b/src/WebAPI/WebAPI.csproj
index 9062efe..5034068 100644
--- a/src/WebAPI/WebAPI.csproj
+++ b/src/WebAPI/WebAPI.csproj
@@ -12,7 +12,7 @@
-
+
diff --git a/src/WebUI/Components/RulesBotChat.razor b/src/WebUI/Components/RulesBotChat.razor
index 148116e..a136897 100644
--- a/src/WebUI/Components/RulesBotChat.razor
+++ b/src/WebUI/Components/RulesBotChat.razor
@@ -1,4 +1,3 @@
-@using OpenAI.GPT3.ObjectModels.RequestModels
@using DialogService = WebUI.Services.DialogService;
@inject DataState DataState
diff --git a/src/WebUI/Models/DataState.cs b/src/WebUI/Models/DataState.cs
index 6578a04..418758c 100644
--- a/src/WebUI/Models/DataState.cs
+++ b/src/WebUI/Models/DataState.cs
@@ -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()
{
diff --git a/src/WebUI/Services/ApiKeyValidationService.cs b/src/WebUI/Services/ApiKeyValidationService.cs
index 1bfd6f1..dfee818 100644
--- a/src/WebUI/Services/ApiKeyValidationService.cs
+++ b/src/WebUI/Services/ApiKeyValidationService.cs
@@ -1,10 +1,10 @@
-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;
@@ -12,7 +12,7 @@ public class ApiKeyValidationService
{
public async Task 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
diff --git a/src/WebUI/Services/MessagingService.cs b/src/WebUI/Services/MessagingService.cs
index 58294d1..127da88 100644
--- a/src/WebUI/Services/MessagingService.cs
+++ b/src/WebUI/Services/MessagingService.cs
@@ -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)
diff --git a/src/WebUI/SignalRClient.cs b/src/WebUI/SignalRClient.cs
index 2315567..c1f7c2d 100644
--- a/src/WebUI/SignalRClient.cs
+++ b/src/WebUI/SignalRClient.cs
@@ -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;
@@ -77,12 +76,12 @@ public StatusHubConnectionState GetConnectionState()
public async IAsyncEnumerable RequestNewCompletionMessage(
List 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(
+ var completionResult = _connection.StreamAsync(
"RequestNewCompletionMessage",
mappedList,
apiKey,
diff --git a/src/WebUI/WebUI.csproj b/src/WebUI/WebUI.csproj
index 896a62d..52a6770 100644
--- a/src/WebUI/WebUI.csproj
+++ b/src/WebUI/WebUI.csproj
@@ -5,10 +5,10 @@
enable
-
-
-
-
+
+
+
+
@@ -16,7 +16,7 @@
-
+
diff --git a/src/WebUI/_Imports.razor b/src/WebUI/_Imports.razor
index f0fbf75..122d7d5 100644
--- a/src/WebUI/_Imports.razor
+++ b/src/WebUI/_Imports.razor
@@ -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
diff --git a/tests/Application.IntegrationTests/Application.IntegrationTests.csproj b/tests/Application.IntegrationTests/Application.IntegrationTests.csproj
index e13c8c3..be4a585 100644
--- a/tests/Application.IntegrationTests/Application.IntegrationTests.csproj
+++ b/tests/Application.IntegrationTests/Application.IntegrationTests.csproj
@@ -7,14 +7,14 @@
true
-
+
-
-
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
diff --git a/tests/Application.IntegrationTests/Services/RelevantRulesServiceTests.cs b/tests/Application.IntegrationTests/Services/RelevantRulesServiceTests.cs
index a84ecd0..c30cb90 100644
--- a/tests/Application.IntegrationTests/Services/RelevantRulesServiceTests.cs
+++ b/tests/Application.IntegrationTests/Services/RelevantRulesServiceTests.cs
@@ -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;
@@ -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
diff --git a/tests/Application.UnitTests/Application.UnitTests.csproj b/tests/Application.UnitTests/Application.UnitTests.csproj
index 83086ce..fca3cb4 100644
--- a/tests/Application.UnitTests/Application.UnitTests.csproj
+++ b/tests/Application.UnitTests/Application.UnitTests.csproj
@@ -7,15 +7,15 @@
true
-
+
-
-
-
+
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all