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
11 changes: 10 additions & 1 deletion eval/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,17 @@ def get_all_minimal_queries(query: str) -> "list[str]":
left = query[:start]
column_str = ", ".join(column_tuple)
right = query[end + 1 :]
g_column_str = column_str
len_tuple = len(column_tuple)
# check if the column str contains columns defined with alias AS ...
if " as " in column_str.lower() and "group by {}" in right.lower():
g_column_str = ""
for i, column in enumerate(column_tuple):
as_index = column.lower().find(" as ") + 4
g_column_str += column[as_index:] if as_index - 3 else column
g_column_str += ", " if i != len_tuple - 1 else ""
# change group by size dynamically if necessary
right = right.replace("GROUP BY {}", f"GROUP BY {column_str}")
right = right.replace("GROUP BY {}", f"GROUP BY {g_column_str}")
result_queries.append(left + column_str + right)
return result_queries

Expand Down
1 change: 1 addition & 0 deletions runners/anthropic_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from utils.llm import chat_anthropic
import json


def generate_prompt(
prompt_file,
question,
Expand Down