-
Notifications
You must be signed in to change notification settings - Fork 2
handle prompts, templating, etc. #77
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
base: main
Are you sure you want to change the base?
Conversation
|
|
||
| # Load the prompt using Prompt.load | ||
| puts "\nLoading prompt..." | ||
| prompt = Braintrust::Prompt.load(project: project_name, slug: prompt_slug) |
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.
I wonder if now when we load prompts we may need to check what templating language the prompt was using and fail to load the prompt if the templating language isn't available in a specific sdk.
| private | ||
|
|
||
| # Render Mustache template with variables | ||
| def render_template(text, variables, strict:) |
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.
Did we want to support the no template so people don't have to escape double braces in their prompts if they have any?
Technically you can work around it in mustache by doing something like changing the delimiters by doing {{=<% %>=}} but might be nice to have no template option as well.
| end | ||
| end | ||
|
|
||
| Mustache.render(text, variables) |
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.
I recently found out we have custom escape logic for mustache.
It exists here in python and here in typescript.
We should move that custom escaping over to make the experience consistent.
Addresses #70