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
pip install nova-client
Usage
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.
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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nova_client-0.0.5.tar.gz
(10.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nova_client-0.0.5.tar.gz.
File metadata
- Download URL: nova_client-0.0.5.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/5.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dac59705b51e85ef5f678ec65a19ae5da484e66ffb835ab8aa43d3ae1f846ed0
|
|
| MD5 |
20747c34dcff160488553ebb2a5d90af
|
|
| BLAKE2b-256 |
da9bf0d7f410b4a7334ad6fa565d58cb242a0467caf8d3ef9d5d3a19885ba6c3
|
File details
Details for the file nova_client-0.0.5-py3-none-any.whl.
File metadata
- Download URL: nova_client-0.0.5-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/5.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d2be4c448d0a8b056ed38d804b63d9f96b1e7e2db9459210ff6b5a8ba854cfc
|
|
| MD5 |
91f9308e35e1fdff8afaae6bc208cc09
|
|
| BLAKE2b-256 |
9fd71a88dda35c1243d123f0f02db7c9a36083a17ce9641a2c28775f8ecc210a
|