NOVA Machine to Machine Client
Project description
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
Project details
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.4.tar.gz
(7.7 kB
view details)
Built Distribution
File details
Details for the file nova_client-0.0.4.tar.gz
.
File metadata
- Download URL: nova_client-0.0.4.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88b0743db4ec211459418ff3fa74cce6599e54d426175cb9af5845411c8a7f18 |
|
MD5 | b3bc5d996406ea4ff5050037b79abf9f |
|
BLAKE2b-256 | 6e46d3508b755f6f722c5d93b24b7854c3b8f2c325a6a3ec84ba952be438cf7d |
File details
Details for the file nova_client-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: nova_client-0.0.4-py3-none-any.whl
- Upload date:
- Size: 7.6 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 | 58f9e208b4fab99c992fcf4d2d00030b5fdf16ca66ee7a94d4d04d73275dd9aa |
|
MD5 | fcc912d424803bc3ef93c661ad7851d0 |
|
BLAKE2b-256 | 9e60c141581e3980dd5ae87c6798d2beaa4f0f5622292add32f37411b60db8b7 |