Skip to content

Commit

Permalink
use json serialize in check en command
Browse files Browse the repository at this point in the history
  • Loading branch information
NicklausBrain committed Dec 8, 2024
1 parent 13ffd61 commit 9f2d405
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions My1kWordsEe/Services/Cqs/CheckEnTranslationCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using System.Text.Json;
using System.Text.Json.Serialization;

using CSharpFunctionalExtensions;

Expand Down Expand Up @@ -30,7 +31,11 @@ public async Task<Result<EnTranslationCheckResult>> Invoke(string eeSentence, st
"\"match_level\": <correctes level in integer from 0 to 5>\n" +
"}\n```\n";

var input = "{\"ee_sentence\": \"" + eeSentence + "\", \"en_user_sentence\": \"" + enSentence + "\"}";
var input = JsonSerializer.Serialize(new
{
ee_sentence = eeSentence,
en_user_sentence = enSentence
});

var result = await this.openAiClient.CompleteJsonAsync<EnTranslationCheckResult>(prompt, input);

Expand Down

0 comments on commit 9f2d405

Please sign in to comment.