Skip to content
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

Merged
merged 18 commits into from
Nov 14, 2023

Conversation

danielajass
Copy link
Collaborator

  • 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.
Copy link
Collaborator

@samsucik samsucik left a 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 🙂

Comment on lines 462 to 479
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,
)
Copy link
Collaborator

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 🙂

Copy link
Collaborator Author

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

prompterator/main.py Show resolved Hide resolved
Copy link
Collaborator

@samsucik samsucik left a 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 🙂

prompterator/main.py Outdated Show resolved Hide resolved
prompterator/main.py Outdated Show resolved Hide resolved
prompterator/main.py Show resolved Hide resolved
prompterator/main.py Outdated Show resolved Hide resolved
prompterator/main.py Outdated Show resolved Hide resolved
prompterator/main.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@samsucik samsucik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@danielajass
Copy link
Collaborator Author

🚀

Thanks @samsucik for your inputs in review 🌞

@danielajass danielajass merged commit f4aface into main Nov 14, 2023
1 check passed
@danielajass danielajass deleted the daniela/display_promt_args branch November 14, 2023 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants