Skip to content

Fix subtle bug in openai and anthropic runners #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 30, 2025
Merged
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
4 changes: 2 additions & 2 deletions runners/anthropic_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def run_anthropic_eval(args):
db_name = row["db_name"]
db_type = row["db_type"]
try:
is_correct = compare_query_results(
exact_match, correct = compare_query_results(
query_gold=expected_query,
query_gen=query_gen,
db_name=db_name,
Expand All @@ -199,7 +199,7 @@ def run_anthropic_eval(args):
query_category=row["query_category"],
decimal_points=args.decimal_points,
)
if is_correct:
if correct:
total_correct += 1
row["is_correct"] = 1
row["error_msg"] = ""
Expand Down
12 changes: 4 additions & 8 deletions runners/openai_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ def generate_prompt(
db_type,
instructions="",
k_shot_prompt="",
glossary="",
table_metadata_string="",
prev_invalid_sql="",
prev_error_msg="",
public_data=True,
shuffle=True,
):
Expand Down Expand Up @@ -88,6 +85,7 @@ def generate_prompt(
table_metadata_string=pruned_metadata_str,
k_shot_prompt=k_shot_prompt,
)

return prompt


Expand All @@ -100,10 +98,7 @@ def process_row(row, model_name, args):
db_type=args.db_type,
instructions=row["instructions"],
k_shot_prompt=row["k_shot_prompt"],
glossary=row["glossary"],
table_metadata_string=row["table_metadata_string"],
prev_invalid_sql=row["prev_invalid_sql"],
prev_error_msg=row["prev_error_msg"],
public_data=not args.use_private_data,
shuffle=args.shuffle_metadata,
)
Expand Down Expand Up @@ -195,7 +190,7 @@ def run_openai_eval(args):
db_name = row["db_name"]
db_type = row["db_type"]
try:
is_correct = compare_query_results(
exact_match, correct = compare_query_results(
query_gold=expected_query,
query_gen=query_gen,
db_name=db_name,
Expand All @@ -204,14 +199,15 @@ def run_openai_eval(args):
query_category=row["query_category"],
db_creds=db_creds_all[db_type],
)
if is_correct:
if correct:
total_correct += 1
row["is_correct"] = 1
row["error_msg"] = ""
else:
row["is_correct"] = 0
row["error_msg"] = "INCORRECT RESULTS"
except Exception as e:
row["is_correct"] = 0
row["error_db_exec"] = 1
row["error_msg"] = f"EXECUTION ERROR: {str(e)}"
output_rows.append(row)
Expand Down