Skip to content

Commit

Permalink
added into msg and more info
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-tzayats committed Dec 10, 2024
1 parent 0982a45 commit ff303f3
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions journeys/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,16 @@ def _get_content(
@st.experimental_dialog("Evaluation Tables", width="large")
def evaluation_data_dialog() -> None:
st.markdown("Please select an evaluation table.")
st.markdown("The evaluation table should have the following schema:")
eval_table_schema_explained = pd.DataFrame(
[
["ID", "VARCHAR", "Unique identifier for each row"],
["QUERY", "VARCHAR", "The query to be evaluated"],
["GOLD_SQL", "VARCHAR", "The expected SQL for the query"],
],
columns=["Column", "Type", "Description"],
)
st.dataframe(eval_table_schema_explained, hide_index=True)
table_selector_container(
db_selector={"key": "selected_eval_database", "label": "Evaluation database"},
schema_selector={"key": "selected_eval_schema", "label": "Evaluation schema"},
Expand Down Expand Up @@ -481,14 +491,14 @@ def evaluation_data_dialog() -> None:
or not st.session_state["selected_results_eval_schema"]
or not st.session_state["selected_results_eval_table"]
):
st.error("Please fill in all fields.")
st.error("🚨 Please fill in all fields.")
return

if not validate_table_schema(
table=st.session_state["selected_eval_table"],
schema=EVALUATION_TABLE_SCHEMA,
):
st.error(f"Evaluation table must have schema {EVALUATION_TABLE_SCHEMA}.")
st.error(f"🚨 Evaluation table must have schema {EVALUATION_TABLE_SCHEMA}.")
return

if eval_results_existing_table:
Expand All @@ -497,7 +507,7 @@ def evaluation_data_dialog() -> None:
schema=RESULTS_TABLE_SCHEMA,
):
st.error(
f"Evaluation result table must have schema {RESULTS_TABLE_SCHEMA}."
f"🚨 Evaluation result table must have schema {RESULTS_TABLE_SCHEMA}."
)
return

Expand All @@ -508,7 +518,7 @@ def evaluation_data_dialog() -> None:
"selected_results_eval_new_table_no_schema"
],
):
st.error("Results table already exists")
st.error("🚨 Results table already exists")
return

with st.spinner("Creating table..."):
Expand Down Expand Up @@ -566,9 +576,13 @@ def clear_evaluation_data() -> None:

def evaluation_mode_show() -> None:

if st.button("Set Evaluation Tables", on_click=clear_evaluation_data):
if st.button("Select Evaluation Tables", on_click=clear_evaluation_data):
evaluation_data_dialog()

st.write(
"Welcome!🧪 In the evaluation mode you can evaluate your semantic model against multiple golden queries where the expected SQL is known from **Evaluation Table** and compute accuracy metric. The results of the evaluation run will be stored in **Evaluation Results Table**."
)

# TODO: find a less awkward way of specifying this.
if any(key not in st.session_state for key in ("eval_table", "results_eval_table")):
st.error("Please select evaluation tables.")
Expand Down

0 comments on commit ff303f3

Please sign in to comment.