Metadata-Version: 2.1
Name: nova-client
Version: 0.0.4
Summary: NOVA Machine to Machine Client
Author-email: Serapion GmbH <dev@serapion.net>
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic<3.0.0,>=2.0.0
Requires-Dist: aiohttp<4.0.0,>=3.8.5
Provides-Extra: dev
Requires-Dist: pytest<8.0.0,>=7.4.2; extra == "dev"
Requires-Dist: pytest-asyncio<1.0.0,>=0.21.0; extra == "dev"
Requires-Dist: pytest-cov<5.0.0,>=4.1.0; extra == "dev"
Requires-Dist: pre-commit<4.0.0,>=3.6.0; extra == "dev"
Requires-Dist: python-dotenv<2.0.0,>=1.0.1; extra == "dev"
Provides-Extra: ci
Requires-Dist: flake8<8.0.0,>=7.0.0; extra == "ci"
Requires-Dist: pytest<8.0.0,>=7.4.4; extra == "ci"
Requires-Dist: pytest-asyncio<1.0.0,>=0.21.0; extra == "ci"
Requires-Dist: pytest-cov<5.0.0,>=4.1.0; extra == "ci"

# NOVA Machine to Machine Client

The NOVA client allows to you interact with the NOVA Machine to Machine API to create chat completions and manage sessions.

## Installation

```bash
pip install nova-client
```
## Usage

```python
from nova_client import NOVAClient

async def main():
    client = NOVAClient(api_key="...")

    session = await client.client_sessions.create_session(bot_id="bot-...")
    token = session.session_token
    # The session token can be shared with an end device (e.g. website, mobile app).

    # To create completions directly:
    stream = session.send_message("Tell me a joke!")

    async for event in stream:
        print("event:", event)
```

### Cancellation

The NOVA Api supports interruptions of completions. To cancel a completion, you can cancel the asyncio task that is running the completion.

```python
import asyncio
from nova_client import NOVAClient

async def run_completion():
    client = NOVAClient(api_key="...")
    session = await client.client_sessions.create_session(bot_id="bot-...")

    stream = session.send_message("Tell me a joke!")

    async for event in stream:
        print("event:", event)


async def main():
    task = asyncio.create_task(run_completion())
    await asyncio.sleep(5)
    task.cancel()
    await task
```
