From e3d47d9d4d1f0ca5b1306c1280c523da2a18943b Mon Sep 17 00:00:00 2001 From: HavenDV Date: Sat, 13 Jul 2024 20:34:40 +0400 Subject: [PATCH] test: Fixed. --- README.md | 2 +- src/libs/Directory.Build.props | 2 +- .../OpenAI.Generators.IntegrationTests/Tests.Functions.cs | 3 +-- src/tests/OpenAI.IntegrationTests/Tests.Chat.cs | 6 ++---- src/tests/OpenAI.IntegrationTests/Tests.Embeddings.cs | 4 +--- src/tests/OpenAI.IntegrationTests/Tests.Moderation.cs | 6 ++---- 6 files changed, 8 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 13772e1f..b9efd911 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ var messages = new List "You are a helpful weather assistant.".AsSystemMessage(), "What is the current temperature in Dubai, UAE in Celsius?".AsUserMessage(), }; -var model = ChatModels.Gpt35Turbo.Id; +var model = CreateChatCompletionRequestModel.Gpt35Turbo; var result = await api.Chat.CreateChatCompletionAsync( messages, model: model, diff --git a/src/libs/Directory.Build.props b/src/libs/Directory.Build.props index 890f291d..f863f6b4 100644 --- a/src/libs/Directory.Build.props +++ b/src/libs/Directory.Build.props @@ -16,7 +16,7 @@ - 3.0.0 + 3.0.1 true true tryAGI and contributors diff --git a/src/tests/OpenAI.Generators.IntegrationTests/Tests.Functions.cs b/src/tests/OpenAI.Generators.IntegrationTests/Tests.Functions.cs index 080ace8f..9e6234ba 100755 --- a/src/tests/OpenAI.Generators.IntegrationTests/Tests.Functions.cs +++ b/src/tests/OpenAI.Generators.IntegrationTests/Tests.Functions.cs @@ -3,7 +3,6 @@ using System.Linq; using System.Threading.Tasks; using OpenAI; -using OpenAI.Constants; namespace H.Ipc.Generator.IntegrationTests; @@ -19,7 +18,7 @@ public async Task SimpleMethod() "You are a helpful weather assistant.".AsSystemMessage(), "What is the current temperature in Dubai, UAE in Celsius?".AsUserMessage(), }; - var model = ChatModels.Gpt35Turbo.Id; + var model = CreateChatCompletionRequestModel.Gpt35Turbo; try { diff --git a/src/tests/OpenAI.IntegrationTests/Tests.Chat.cs b/src/tests/OpenAI.IntegrationTests/Tests.Chat.cs index d2242b9a..91bf2df3 100755 --- a/src/tests/OpenAI.IntegrationTests/Tests.Chat.cs +++ b/src/tests/OpenAI.IntegrationTests/Tests.Chat.cs @@ -1,5 +1,3 @@ -using OpenAI.Constants; - namespace OpenAI.IntegrationTests; public partial class Tests @@ -14,7 +12,7 @@ public async Task CreateChatCompletion() "You are a helpful weather assistant.".AsSystemMessage(), "What's the weather like today?".AsUserMessage(), }, - model: ChatModels.Gpt35Turbo.Id, + model: CreateChatCompletionRequestModel.Gpt35Turbo, user: "tryAGI.OpenAI.IntegrationTests.Tests.CreateChatCompletion"); response.Choices.ElementAt(0).Message.Content.Should().NotBeEmpty(); @@ -31,7 +29,7 @@ public async Task CreateChatCompletionAsStreamAsync() "You are a helpful weather assistant.".AsSystemMessage(), "What's the weather like today?".AsUserMessage(), }, - model: ChatModels.Gpt35Turbo.Id, + model: CreateChatCompletionRequestModel.Gpt35Turbo, user: "tryAGI.OpenAI.IntegrationTests.Tests.CreateChatCompletion"); await foreach (var response in enumerable) diff --git a/src/tests/OpenAI.IntegrationTests/Tests.Embeddings.cs b/src/tests/OpenAI.IntegrationTests/Tests.Embeddings.cs index 023a7680..0550d6fb 100755 --- a/src/tests/OpenAI.IntegrationTests/Tests.Embeddings.cs +++ b/src/tests/OpenAI.IntegrationTests/Tests.Embeddings.cs @@ -1,5 +1,3 @@ -using OpenAI.Constants; - namespace OpenAI.IntegrationTests; public partial class Tests @@ -10,7 +8,7 @@ public async Task CreateEmbedding() var api = GetAuthorizedApi(); var response = await api.Embeddings.CreateEmbeddingAsync( input: "Hello, world", - model: EmbeddingModels.Version3Small.Id, + model: CreateEmbeddingRequestModel.TextEmbedding3Small, user: "tryAGI.OpenAI.IntegrationTests.Tests.CreateEmbedding"); response.Data.ElementAt(0).Embedding1.Should().NotBeEmpty(); diff --git a/src/tests/OpenAI.IntegrationTests/Tests.Moderation.cs b/src/tests/OpenAI.IntegrationTests/Tests.Moderation.cs index eebaa480..6274bb2e 100755 --- a/src/tests/OpenAI.IntegrationTests/Tests.Moderation.cs +++ b/src/tests/OpenAI.IntegrationTests/Tests.Moderation.cs @@ -1,5 +1,3 @@ -using OpenAI.Constants; - namespace OpenAI.IntegrationTests; public partial class Tests @@ -10,7 +8,7 @@ public async Task CreateModeration() var api = GetAuthorizedApi(); var response = await api.Moderations.CreateModerationAsync( input: "Hello, world", - model: ModerationModels.Latest.Id); + model: CreateModerationRequestModel.TextModerationLatest); response.Results.First().Flagged.Should().BeFalse(); } @@ -21,7 +19,7 @@ public async Task CreateModeration_Flagged() var api = GetAuthorizedApi(); var response = await api.Moderations.CreateModerationAsync( input: "Fuck you", - model: ModerationModels.Latest.Id); + model: CreateModerationRequestModel.TextModerationLatest); response.Results.First().Flagged.Should().BeTrue(); } }