Metadata-Version: 2.1
Name: toucans
Version: 0.0.11
Summary: 
Author: Kasper Junge
Requires-Python: >=3.11,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: aiohttp (>=3.8.5,<4.0.0)
Requires-Dist: asyncio (>=3.4.3,<4.0.0)
Requires-Dist: jinja2 (>=3.1.2,<4.0.0)
Requires-Dist: litellm (>=1.12.0,<2.0.0)
Requires-Dist: openai (>=1.3.7,<2.0.0)
Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
Requires-Dist: requests (>=2.31.0,<3.0.0)
Description-Content-Type: text/markdown


<h1 align="center">
<img src="static/img/logo.png" width="250">
</h1>

Toucans is a streamlined library designed for agile and flexible prompt engineering, leveraging jinja2 for dynamic prompt templating and litellm to seamlessly connect with a wide range of language model providers.

## Getting Started
### Installation
````
pip install toucans
````

### Initialize Prompt Function
To initialize a PromptFunction:

````python
from toucans import PromptFunction

prompt_func = PromptFunction(
    model="gpt-4",
    temperature=0.7,
    messages=[
        {"role": "system", "content": "You are a helpful {{ role }}."},
        {"role": "user", "content": "Answer the following question: {{ question }}"},
    ],
)
````

### Generate Completion
Generate a completion by calling the PromptFunction with the desired role and question:

````python
completion = prompt_func(
    role="Software Developer", 
    question="What is clean code?"
)
````

### Save Prompt Function
To save the initialized PromptFunction to a directory:

````python
prompt_func.push_to_dir("./prompt_save_dir/")
````

### Load Saved Prompt Function
To load a saved PromptFunction from a directory:

````python
prompt_func = PromptFunction.from_dir("./prompt_save_dir/")
````

By following these steps, you can easily initialize, save, and load a PromptFunction for your needs.
