From 13ffd610be70917ed8eb7d19177e552f9b2a9925 Mon Sep 17 00:00:00 2001 From: NICK BRAIN Date: Sun, 8 Dec 2024 16:47:31 +0200 Subject: [PATCH] + update OpenAI Version=2.1.0 --- My1kWordsEe/Components/Pages/FavoritesPage.razor | 2 +- My1kWordsEe/My1kWordsEe.csproj | 2 +- My1kWordsEe/Services/Ai/OpenAiClient.cs | 8 +++----- My1kWordsEe/Services/Cqs/AddSampleWordCommand.cs | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/My1kWordsEe/Components/Pages/FavoritesPage.razor b/My1kWordsEe/Components/Pages/FavoritesPage.razor index 87c32e71..08a70299 100644 --- a/My1kWordsEe/Components/Pages/FavoritesPage.razor +++ b/My1kWordsEe/Components/Pages/FavoritesPage.razor @@ -85,7 +85,7 @@
@word.EeWord
- +
diff --git a/My1kWordsEe/My1kWordsEe.csproj b/My1kWordsEe/My1kWordsEe.csproj index f48cd649..9584b703 100644 --- a/My1kWordsEe/My1kWordsEe.csproj +++ b/My1kWordsEe/My1kWordsEe.csproj @@ -17,7 +17,7 @@ - + diff --git a/My1kWordsEe/Services/Ai/OpenAiClient.cs b/My1kWordsEe/Services/Ai/OpenAiClient.cs index 1b8872e3..15a3b400 100644 --- a/My1kWordsEe/Services/Ai/OpenAiClient.cs +++ b/My1kWordsEe/Services/Ai/OpenAiClient.cs @@ -50,8 +50,8 @@ public async Task> CompleteJsonAsync(string instructions, string in { var response = await this.CompleteAsync(instructions, input, new ChatCompletionOptions { - ResponseFormat = ChatResponseFormat.JsonObject, - Temperature = temperature + ResponseFormat = ChatResponseFormat.CreateJsonObjectFormat(), + Temperature = temperature, }); if (response.IsFailure) @@ -102,10 +102,8 @@ public static async Task> GetDallEPrompt(this OpenAiClient openAi return await openAiClient.CompleteAsync(prompt, sentence, new ChatCompletionOptions { - ResponseFormat = ChatResponseFormat.Text, + ResponseFormat = ChatResponseFormat.CreateTextFormat(), Temperature = (float)Math.PI / 2, - // limit the number of tokens to avoid long prompts that crush stability ai - MaxTokens = 400, }); } } diff --git a/My1kWordsEe/Services/Cqs/AddSampleWordCommand.cs b/My1kWordsEe/Services/Cqs/AddSampleWordCommand.cs index e1e717f5..04643db0 100644 --- a/My1kWordsEe/Services/Cqs/AddSampleWordCommand.cs +++ b/My1kWordsEe/Services/Cqs/AddSampleWordCommand.cs @@ -91,7 +91,7 @@ private async Task> GetWordMetadata( input, new ChatCompletionOptions { - ResponseFormat = ChatResponseFormat.JsonObject, + ResponseFormat = ChatResponseFormat.CreateJsonObjectFormat(), Temperature = 0.333f });