Skip to content

Commit

Permalink
Added prompt templates and project structure overview.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandr Movchan committed Jul 4, 2024
1 parent 8979757 commit aef8621
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@ poetry install

See [Tutorial](https://github.com/mobiusml/aana_sdk/blob/main/docs/tutorial.md) for more information on how to build your application.

## Project structure

```
aana_app_project/ | top level source code directory for the project
├── config/ | various configs, including settings, deployments and endpoints
│ ├── endpoints.py | list of endpoints to deploy
│ ├── deployments.py | list of deployments (models) to deploy
│ └── settings.py | app settings
├── core/ | core models and functionality
│ ├── models/ | data models
│ └── prompts/ | prompt templates for LLMs
├── deployments/ | custom deployments
├── endpoints/ | endpoint classes for the app
├── exceptions/ | custom exception classes
├── utils/ | various utility functionality
└── app.py | main application file
```


## Installation

To install the project, follow these steps:
Expand Down
File renamed without changes.
Empty file.
25 changes: 25 additions & 0 deletions aana_app_project/core/prompts/loader.py
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
1 change: 1 addition & 0 deletions aana_app_project/core/prompts/test.j2
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 }}.
1 change: 1 addition & 0 deletions aana_app_project/exceptions/core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from aana.exceptions.core import BaseException

0 comments on commit aef8621

Please sign in to comment.