From 64a4759fbc59bda4635c0158068bc83cb9b2bb1b Mon Sep 17 00:00:00 2001 From: Cristiano Ferreira Date: Tue, 23 Jan 2024 22:22:21 +0000 Subject: [PATCH] Improve correction to not add anything to the answer. --- helper/openai_interface.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/helper/openai_interface.py b/helper/openai_interface.py index af2d343..1058ea3 100644 --- a/helper/openai_interface.py +++ b/helper/openai_interface.py @@ -250,14 +250,16 @@ def extract_existing_sections_from_body(my_dict, keys_to_extract): def get_fixed_text(text): - message = ('Fix the errors in the given text and put it in a JSON. Sample JSON: {"fixed_text": "fixed test with no ' + message = ('Fix the errors in the given text and put it in a JSON. Do not complete the answer, only replace what ' + 'is wrong. Sample JSON: {"fixed_text": "fixed test with no ' 'misspelling errors"}] \n The text: "' + text + '"') token_count = count_tokens(message)["n_tokens"] response = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, message, token_count, ["fixed_text"], 0.2) return response["fixed_text"] def get_speaking_corrections(text): - message = ('Fix the errors in the provided transcription and put it in a JSON. Sample JSON: {"fixed_text": "fixed ' + message = ('Fix the errors in the provided transcription and put it in a JSON. Do not complete the answer, only ' + 'replace what is wrong. Sample JSON: {"fixed_text": "fixed ' 'transcription with no misspelling errors"}] \n The text: "' + text + '"') token_count = count_tokens(message)["n_tokens"] response = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, message, token_count, ["fixed_text"], 0.2)