Metadata-Version: 2.1
Name: yapr
Version: 0.1.1
Summary: Yet another prompt
License: Apache 2.0
Author: Patrick Barker
Author-email: patrickbarkerco@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: litellm (>=1.35.29,<2.0.0)
Requires-Dist: tenacity (>=8.2.3,<9.0.0)
Requires-Dist: threadmem (>=0.2.24,<0.3.0)
Description-Content-Type: text/markdown

# yapr

yapr (Yet Another Prompt)

## Installation

```sh
pip install yapr
```

## Usage

A complete chat example

```python
from yapr import LLMProvider, RoleThread

# Create an LLM provider from the API keys found in the current system env vars
llm_provider = LLMProvider.from_env()

# Create a new role based chat thread
thread = RoleThread()
thread.post(role="user", msg="How are you?")

# Chat with the LLM, store the prompt data in the namespace "foo"
response = llm_provider.chat(thread, namespace="foo")

# Add the response message to the thread
thread.add_msg(response.msg)

# Ask for a structured response
from pydantic import BaseModel

class Foo(BaseModel):
    bar: str
    baz: int

thread.post(role="user", msg="Given the {...} can you return that in JSON?")

# Chat with the LLM, requiring the output be parsable into the Foo object
response = llm_provider.chat(thread, namespace="foo", response_schema=Foo)

# Get the parsed response
foo_parsed = response.parsed
```

