-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
Escape double curly braces in prompt template strings #43
Escape double curly braces in prompt template strings #43
Conversation
variable = scanner[1].strip | ||
input_variables << variable unless variable.empty? | ||
input_variables << variable unless variable.empty? || variable[0] == "{" |
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.
Nitpicking: variable.start_with?("{")
to improve the readability perhaps.
@timrwilliams Just 1 comment. Could you please upmerge your branch and also fix the failing specs? I think it's just the Also -- would you please add some code comments referencing the intention behind this fix? Thank you! |
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.
@timrwilliams Looks great, thank you!!
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.
@timrwilliams Looks great, thank you!!
Resolves #42
Simple approach to not include input variables denoted by double curly braces. As per the f-string syntax double curly braces are replaces by single curly braces in the output.
Tested via new spec and also ran against all current Prompt examples on langchain-hub to ensure compatibility with wider ecosystem.