-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make funtion templates real functions
Prompts remplates are currently contained in the docstring of decorated functions. The main issue with this is that prompt templates cannot be composed. In this commit we instead require users to return the prompt template from the function. The template will then automatically be rendered using the values passed to the function. This is very flexible: some variables can be used inside the functions and not be present in the Jinja2 template that is returned, for instance: ```python import prompts @prompts.template def my_template(a, b): prompt = f'This is a first variable {a}' return prompt + "and a second {{b}}" ```
- Loading branch information
Showing
4 changed files
with
36 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters