-
Notifications
You must be signed in to change notification settings - Fork 5
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
Display values of variables used in a prompt #4
Conversation
danielajass
commented
Oct 31, 2023
- extract jinja variables from a prompt,
- new text area with values of variables from a prompt.
- extract jinja variables from a prompt, - new text area with values of variables from a prompt.
…eamlit has its native toggle now
…pterator into daniela/display_promt_args
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danielajass I refactored my additions. Could you check one last time that all works for you? After that, feel free to merge 🙂
prompterator/main.py
Outdated
env = u.jinja_env() | ||
parsed_content = env.parse(st.session_state.system_prompt) | ||
vars = meta.find_undeclared_variables(parsed_content) | ||
|
||
if len(vars) > 1: | ||
# create text of used prompt's variables and their values | ||
vars_values = "" | ||
for var in vars: | ||
if var != c.TEXT_ORIG_COL: | ||
vars_values = vars_values + var + ":\n" + " " + st.session_state.row[var] + "\n" | ||
|
||
col2_orig.text_area( | ||
label=f"Attributes used in a prompt", | ||
key="attributes", | ||
value=vars_values, | ||
disabled=True, | ||
height=c.DATA_POINT_TEXT_AREA_HEIGHT, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like it should go into a separate function because set_up_ui_labelling
is becoming too big to comprehend 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I moved this part to a separate function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've got several suggestions, including some that I should've noticed in my previous reviews 🙈 Otherwise, this looks good to go 🙂
Co-authored-by: Sam Sucik <[email protected]>
Co-authored-by: Sam Sucik <[email protected]>
Co-authored-by: Sam Sucik <[email protected]>
Co-authored-by: Sam Sucik <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Thanks @samsucik for your inputs in review 🌞 |