You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please provide a unit test that demonstrates the bug.
prompt = PromptPattern.from_str("{{context}}\nquestion: {{question}}\nanswer:")
prompt.sub("context", "Copy the file to \Conf")
Other notes on how to reproduce the issue?
The above code causes re.sub() to raise an exception as it attempts to interpret the \C as a regex meta-character.
The user isn't aware of prompt.sub() using re.sub() so he/she is not aware of the need to escape backslashes.
Any possible solutions?
In prompt_template.py, line 204, add escaping of backslashes as described at the bottom of the documentation of re.escape() in the Python docs .
Version Information
What is the expected behavior?
Support for backslashes in prompt field values
What is the actual behavior?
Backslashes are unsupported
Please provide a unit test that demonstrates the bug.
Other notes on how to reproduce the issue?
The above code causes re.sub() to raise an exception as it attempts to interpret the \C as a regex meta-character.
The user isn't aware of prompt.sub() using re.sub() so he/she is not aware of the need to escape backslashes.
Any possible solutions?
In prompt_template.py, line 204, add escaping of backslashes as described at the bottom of the documentation of re.escape() in the Python docs .
This means that line 204:
Should be changed into:
Can you identify the location in the GENAI source code where the problem exists?
In prompt_template.py, line 204
If the bug is confirmed, would you be willing to submit a PR?
Yes
The text was updated successfully, but these errors were encountered: