-
Notifications
You must be signed in to change notification settings - Fork 343
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
[FR]: Support for jinja2 template as prompt templates #1091
Comments
Hi @klcd , It a good suggestion, don't see why we couldn't work on it this week by extending the prompt object. Let me talk to the team tomorrow about it |
Hi @jverre Thanks, happy to help. I believe technically it would be possible to safe it in the meta-data field but I think the property could be worth it to have an actual field in the prompt object. Great Repo by the way, awesome code quality that makes it easy to understand. |
Hi @klcd!
Thank you! |
Hi @alexkuzmik Usage Pattern and some thoughtsFrom the documentation we have this snipped
In python I would use a
or equivalently
The default of the parameter should conform to your standard template e.g. TemplateTypes.OPIK. A similar type probably had to be generated or introduce in the java backend and the typescript frontend. When using the Example Prompt Template
Hope this is helpful, and let me know if you need more information |
Thanks @klcd, we'll look into it |
Great, please note that And in case I can help, I'd be happy to help on the python side. |
Hey @klcd! We are going to add a prompt type field to the |
@klcd we've added a type field for a prompt version on the backend side. We don't have any special processing of that type, it is just being stored for now. However, SDK is now opened for adding A tip that might be useful to figure out the changes needed if you work on that: the |
Hi @alexkuzmik Thanks for the update. I'll try to get to it soon |
Proposal summary
Allow definition of a prompt via a jinja2 file or string that corresponds to the file and add a formatting method to use such prompts in evaluations.
Motivation
Jinja2 and other templating languages allow to separate the data generation and presentation concern when developing prompts. This helps to create more complex prompts where e.g. the memory or another state can be represented without the explicit need for the data.
I've have looked at the code so far and it seems to me that adding a
template_type
parameter would suffice to be able to differentiate to what rendering method would be used to generate the final prompt. Furthermore, this would make the Prompt easily extensible to other templating languages.I would be happy to help with the python part.
The text was updated successfully, but these errors were encountered: