Skip to content

Commit

Permalink
Adjust selectbox to right and add query tag for usage tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jsummer committed Dec 10, 2024
1 parent 23db36e commit b936ed0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
14 changes: 10 additions & 4 deletions journeys/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
table_selector_container,
validate_table_exist,
validate_table_schema,
set_sit_query_tag,
)
from semantic_model_generator.data_processing.proto_utils import proto_to_yaml
from semantic_model_generator.snowflake_utils.snowflake_connector import (
Expand Down Expand Up @@ -411,7 +412,7 @@ def _get_content(

@st.experimental_dialog("Evaluation Tables", width="large")
def evaluation_data_dialog() -> None:
st.markdown("Please select an evaluation table")
st.markdown("Please select an evaluation table.")
table_selector_container(
db_selector={"key": "selected_eval_database", "label": "Evaluation database"},
schema_selector={"key": "selected_eval_schema", "label": "Evaluation schema"},
Expand All @@ -420,7 +421,7 @@ def evaluation_data_dialog() -> None:

st.divider()

st.markdown("Please select a results table")
st.markdown("Please select a results table.")
eval_results_existing_table = st.checkbox(
"Use existing table", key="use_existing_eval_results_table"
)
Expand All @@ -439,7 +440,7 @@ def evaluation_data_dialog() -> None:

original_new_table_name = st.text_input(
key="selected_results_eval_new_table_no_schema",
label="Enter the table name to upload evaluation results",
label="Enter the table name to upload evaluation results.",
)
if original_new_table_name:
schema_name = st.session_state.get("selected_results_eval_schema")
Expand Down Expand Up @@ -563,7 +564,7 @@ def evaluation_mode_show() -> None:

# 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 set evaluation tables.")
st.error("Please select evaluation tables.")
return

summary_stats = pd.DataFrame(
Expand All @@ -578,6 +579,11 @@ def evaluation_mode_show() -> None:
st.dataframe(summary_stats, hide_index=True)

if st.button("Run Evaluation"):
set_sit_query_tag(
get_snowflake_connection(),
vendor="",
action="evaluation_run",
)
current_hash = generate_hash(st.session_state["working_yml"])
model_changed_test = ("semantic_model_hash" in st.session_state) and (
current_hash != st.session_state["semantic_model_hash"]
Expand Down
15 changes: 9 additions & 6 deletions journeys/iteration.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,11 +477,6 @@ def yaml_editor(yaml_str: str) -> None:
}
"""

st.session_state["app_mode"] = st.selectbox(
label="App Mode",
options=["Chat", "Evaluation", "Preview YAML"],
)

# Style text_area to mirror st.code
with stylable_container(key="customized_text_area", css_styles=css_yaml_editor):
content = st.text_area(
Expand Down Expand Up @@ -677,7 +672,15 @@ def show() -> None:
# If coming from the builder flow, there's no need to collect this information until the user wants to upload.
set_up_requirements()
else:
return_home_button()
home, mode = st.columns(2)
with home:
return_home_button()
with mode:
st.session_state["app_mode"] = st.selectbox(
label="App Mode",
label_visibility="collapsed",
options=["Chat", "Evaluation", "Preview YAML"],
)
if "yaml" not in st.session_state:
# Only proceed to download the YAML from stage if we don't have one from the builder flow.
yaml = download_yaml(
Expand Down

0 comments on commit b936ed0

Please sign in to comment.