Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions task_eval/claude_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
CONV_START_PROMPT = "Below is a conversation between two people: {} and {}. The conversation takes place over multiple days and the date of each conversation is wriiten at the beginning of the conversation.\n\n"


def process_ouput(text):
def process_output(text):

# single_quote_count = text.count("'")
# double_quote_count = text.count('"')
Expand Down Expand Up @@ -217,14 +217,14 @@ def get_claude_answers(in_data, out_data, prediction_key, args):
# try:
# answers = json.loads(answer.strip())
# except:
answers = process_ouput(answer.strip())
answers = process_output(answer.strip())
break
except json.decoder.JSONDecodeError:
pass

for k, idx in enumerate(include_idxs):
try:
answers = process_ouput(answer.strip())
answers = process_output(answer.strip())
# answers = json.loads(answer.strip())
# data['qa'][idx]['%s_prediction' % args.model] = answers[k]['answer'].strip()
if k in cat_5_idxs:
Expand Down
6 changes: 3 additions & 3 deletions task_eval/gemini_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
CONV_START_PROMPT = "Below is a conversation between two people: {} and {}. The conversation takes place over multiple days and the date of each conversation is wriiten at the beginning of the conversation.\n\n"


def process_ouput(text):
def process_output(text):

single_quote_count = text.count("'")
double_quote_count = text.count('"')
Expand Down Expand Up @@ -233,14 +233,14 @@ def get_gemini_answers(model, in_data, out_data, prediction_key, args):
# try:
# answers = json.loads(answer.strip())
# except:
answers = process_ouput(answer.strip())
answers = process_output(answer.strip())
break
except json.decoder.JSONDecodeError:
pass

for k, idx in enumerate(include_idxs):
try:
answers = process_ouput(answer.strip())
answers = process_output(answer.strip())
# answers = json.loads(answer.strip())
# data['qa'][idx]['%s_prediction' % args.model] = answers[k]['answer'].strip()
if k in cat_5_idxs:
Expand Down
6 changes: 3 additions & 3 deletions task_eval/gpt_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
CONV_START_PROMPT = "Below is a conversation between two people: {} and {}. The conversation takes place over multiple days and the date of each conversation is wriiten at the beginning of the conversation.\n\n"


def process_ouput(text):
def process_output(text):

single_quote_count = text.count("'")
double_quote_count = text.count('"')
Expand Down Expand Up @@ -311,7 +311,7 @@ def get_gpt_answers(in_data, out_data, prediction_key, args):
use_16k=True if any([k in args.model for k in ['16k', '12k', '8k', '4k']]) else False,
temperature=0, wait_time=2)
answer = answer.replace('\\"', "'").replace('json','').replace('`','').strip().replace("\\'", "")
answers = process_ouput(answer.strip())
answers = process_output(answer.strip())
break

except Exception as e:
Expand All @@ -320,7 +320,7 @@ def get_gpt_answers(in_data, out_data, prediction_key, args):

for k, idx in enumerate(include_idxs):
try:
answers = process_ouput(answer.strip())
answers = process_output(answer.strip())
# answers = json.loads(answer.strip())
# data['qa'][idx]['%s_prediction' % args.model] = answers[k]['answer'].strip()
if k in cat_5_idxs:
Expand Down