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: prompts with JinJa2 templates get their format changed #1912
Comments
Thanks for reporting. As a temporary workaround you can use prompt.prompt directly and add variables yourself |
Thanks for your report, @ajram23 ! Our application logic is treating handling all variables in double curly braces as langfuse variables and converts them to single curly braced variables when using If you have Jinja2 templates in there as well (which happen to be demarcated by double curly braces as well), you can escape this behavior by adding an additional curly brace:
Please be careful though that when you use this escaping and not call |
@hassiebp While this is the work around I am using, expecting all of your users to do this is weird. Adds an additional step to move prompts in and out of your system. |
@ajram23 Could you please share a full prompt with Langfuse variables + Jinja2 templates and the workflow you are using? Maybe I am missing the point here :) |
Will DM you the information. Give me sometime, have a lot to dig into given OpenAI announcements. |
We just discussed this and consider changing the behavior of Does this solve the issue for you or do you have some templates which are only alphabetical characters or underscores? This'd be a quick fix. |
@marcklingen might make sense. Meanwhile not sure what you mean by this "Does this solve the issue for you or do you have some templates which are only alphabetical characters or underscores? " |
Do the parts of your Jinja templates that you want Langfuse to leave unchanged all include spaces, numbers, or special characters (such as the example |
Hi @ajram23 - I've opened a PR to skip the langchain variable transformation for all double curly braces variables that are not valid Langfuse variables. This should hopefully fix the issue for your use-case 👍🏾 |
@hassiebp thank you! |
Describe the bug
get_langchain_prompt() removes "{{" in the Jinja2 template not just the variables!
To reproduce
Use this jinja2 template {{ handle_text(payload['Name'], "Name is") }}
Additional information
No response
The text was updated successfully, but these errors were encountered: