Reformat.

This commit is contained in:
Cristiano Ferreira
2024-01-07 19:38:24 +00:00
parent 75df686cd1
commit e7a96c6880

View File

@@ -42,7 +42,10 @@ tools = [{
}, },
} }
}] }]
### ###
def process_response(input_string, quotation_check_field): def process_response(input_string, quotation_check_field):
if '{' in input_string: if '{' in input_string:
try: try:
@@ -71,6 +74,7 @@ def process_response(input_string, quotation_check_field):
else: else:
return input_string return input_string
def parse_string(to_parse: str): def parse_string(to_parse: str):
parsed_string = to_parse.replace("\"", "\\\"") parsed_string = to_parse.replace("\"", "\\\"")
pattern = r"(?<!\w)'|'(?!\w)" pattern = r"(?<!\w)'|'(?!\w)"
@@ -107,6 +111,7 @@ def parse_string_2(to_parse: str):
to_parse = to_parse.replace(":", ": ") to_parse = to_parse.replace(":", ": ")
return to_parse return to_parse
def remove_special_chars_and_escapes(input_string): def remove_special_chars_and_escapes(input_string):
parsed_string = input_string.replace("\\\"", "'") parsed_string = input_string.replace("\\\"", "'")
parsed_string = parsed_string.replace("\n\n", " ") parsed_string = parsed_string.replace("\n\n", " ")
@@ -149,6 +154,7 @@ def make_openai_call(model, messages, token_count, fields_to_check, temperature)
try_count = 0 try_count = 0
return processed_response return processed_response
def make_openai_instruct_call(model, message: str, token_count, fields_to_check, temperature): def make_openai_instruct_call(model, message: str, token_count, fields_to_check, temperature):
global try_count global try_count
response = openai.Completion.create( response = openai.Completion.create(