diff --git a/README.md b/README.md index 286b62a..5d8155a 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/aana_app_project/models/__init__.py b/aana_app_project/core/models/__init__.py similarity index 100% rename from aana_app_project/models/__init__.py rename to aana_app_project/core/models/__init__.py diff --git a/aana_app_project/core/prompts/__init__.py b/aana_app_project/core/prompts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/aana_app_project/core/prompts/loader.py b/aana_app_project/core/prompts/loader.py new file mode 100644 index 0000000..5aeee8e --- /dev/null +++ b/aana_app_project/core/prompts/loader.py @@ -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 diff --git a/aana_app_project/core/prompts/test.j2 b/aana_app_project/core/prompts/test.j2 new file mode 100644 index 0000000..ce86fac --- /dev/null +++ b/aana_app_project/core/prompts/test.j2 @@ -0,0 +1 @@ +Define your prompts for LLMs here. Use jinja2 templating to include variables like {{ your_variable }}. \ No newline at end of file diff --git a/aana_app_project/exceptions/core.py b/aana_app_project/exceptions/core.py new file mode 100644 index 0000000..9693de9 --- /dev/null +++ b/aana_app_project/exceptions/core.py @@ -0,0 +1 @@ +from aana.exceptions.core import BaseException