-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
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
[BUG] Need to escape or ignore curly braces in prompts #968
Comments
@yavisht thanks for the workaround! will come up with a proper fix |
Signed-off-by: Carson Yang <yangchuansheng33@gmail.com>
You can use double curly brackets to escape JSON You may want to consider that as the encoding like This works with the "Chat Prompt Template" but not the "Prompt Template" because it attempts to validate the data. You do have to remove the unwanted Prompt Value inputs though from the "Format Prompt Values" popup. This is because Langchain JS re-implements the Python f-strings syntax - see prompt.ts and template.ts As for the validation the "Prompt Template" causes, that should be fixed or removed. It's located in LLMChain.ts. Same as below this is a case of inconsistent parsing. It could be an idea to move to the mustache template syntax, which Langchain JS supports, would be more familiar to JS developers and perhaps more powerful/flexible than f-strings. Huge change though so 🤷 This also brings up an interesting bug in the prompt values section - the following template creates the following variables:
![]() This is a case of inconsistent template parsing, I didn't track that one down. Hope all that helps! |
PR #3901 opened to solve this. Fix: Identify if there is a colon : within the curly brackets, if yes, we will not extract the value as variable. |
@HenryHengZJ , seeing this error crop up again in version 2.2.5 -- FYI. |
Okay, so previously, I had all my prompts encased in |
Okay, URL encoding is my only option -- frustrating but doable for now... |
Describe the bug
Need to be able to escape curly braces so that JSON can be used in prompts. Either that, or have Flowise ignore all text it perceives as variables so long as there isn't a corresponding variable.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I would expect Flowise to ignore any {values} that don't have a corresponding variable, or give me a facility to escape the value. Instead it prints Please provide Prompt Values for: ...
Flow
If applicable, add exported flow in order to help replicating the problem.
Setup
npx flowise start
,yarn start
]Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: