Improve correction to not add anything to the answer.

This commit is contained in:
Cristiano Ferreira
2024-01-23 22:22:21 +00:00
parent 54950e11d2
commit 64a4759fbc

View File

@@ -250,14 +250,16 @@ def extract_existing_sections_from_body(my_dict, keys_to_extract):
def get_fixed_text(text): 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 + '"') 'misspelling errors"}] \n The text: "' + text + '"')
token_count = count_tokens(message)["n_tokens"] token_count = count_tokens(message)["n_tokens"]
response = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, message, token_count, ["fixed_text"], 0.2) response = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, message, token_count, ["fixed_text"], 0.2)
return response["fixed_text"] return response["fixed_text"]
def get_speaking_corrections(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 + '"') 'transcription with no misspelling errors"}] \n The text: "' + text + '"')
token_count = count_tokens(message)["n_tokens"] token_count = count_tokens(message)["n_tokens"]
response = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, message, token_count, ["fixed_text"], 0.2) response = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, message, token_count, ["fixed_text"], 0.2)