Skip to content

Commit

Permalink
make previous changes more consistent with existing code
Browse files Browse the repository at this point in the history
  • Loading branch information
samsucik committed Oct 17, 2023
1 parent cb44442 commit 2cc50e4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion prompterator/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def call(self, input, **kwargs):
RESPONSE_DATA_COL: object,
LABEL_COL: bool,
}
# these are the columns that users won't be able to show or inject into their prompts
COLS_NOT_FOR_PROMPT_INTERPOLATION = [
TEXT_GENERATED_COL,
SYSTEM_PROMPT_TEMPLATE_COL,
Expand All @@ -91,7 +92,7 @@ def call(self, input, **kwargs):
]
LABEL_GOOD = "good"
LABEL_BAD = "bad"
COLS_TO_SHOW = [TEXT_ORIG_COL, TEXT_GENERATED_COL, LABEL_COL]
DUMMY_DATA_COLS = [TEXT_ORIG_COL, TEXT_GENERATED_COL, LABEL_COL]
LABEL_VALUE_COLOURS = {
LABEL_GOOD: "#56E7AB",
LABEL_BAD: "#FE8080",
Expand Down
10 changes: 5 additions & 5 deletions prompterator/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,12 +514,12 @@ def set_up_ui_labelling():

def show_col_selection():
if st.session_state.get("df") is not None:
columns_sel = st.session_state.df.columns.tolist()
columns_sel.remove(c.TEXT_GENERATED_COL)
columns_sel.remove(c.LABEL_COL)
columns_sel.remove(c.RESPONSE_DATA_COL)
available_columns = st.session_state.df.columns.tolist()
available_columns = [
col for col in available_columns if col not in c.COLS_NOT_FOR_PROMPT_INTERPOLATION
]
st.session_state["columns_to_show"] = st.multiselect(
"Columns to show", columns_sel, [c.TEXT_ORIG_COL]
"Columns to show", options=available_columns, default=[c.TEXT_ORIG_COL]
)


Expand Down
2 changes: 1 addition & 1 deletion prompterator/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,6 @@ def get_dummy_dataframe():
)

# to fail if the list of required columns changes; we'll then update the hard-coded dict above
assert set(df.columns) == set(c.COLS_TO_SHOW)
assert set(df.columns) == set(c.DUMMY_DATA_COLS)

return df

0 comments on commit 2cc50e4

Please sign in to comment.