-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added prompt templates and project structure overview.
- Loading branch information
Aleksandr Movchan
committed
Jul 4, 2024
1 parent
8979757
commit aef8621
Showing
6 changed files
with
46 additions
and
0 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
File renamed without changes.
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from jinja2 import Environment, PackageLoader, Template | ||
|
||
|
||
def get_prompt_template(name: str) -> Template: | ||
"""Load a prompt template by name. | ||
Use this function to load a prompt templates for LLMs: | ||
```python | ||
from aana_app_project.prompts.loader import get_prompt_template | ||
template = get_prompt_template("test") | ||
prompt = template.render(your_variable="your_value") | ||
``` | ||
Args: | ||
name (str): The name of the prompt template. | ||
Returns: | ||
Template: The prompt template. | ||
""" | ||
env = Environment(loader=PackageLoader( | ||
"aana_app_project", "core", "prompts")) | ||
template = env.get_template(f"{name}.j2") | ||
return template |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Define your prompts for LLMs here. Use jinja2 templating to include variables like {{ your_variable }}. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from aana.exceptions.core import BaseException |