Skip to main content

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.2.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

nova_client-0.0.2-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file nova_client-0.0.2.tar.gz.

File metadata

  • Download URL: nova_client-0.0.2.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.3 keyring/23.7.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.9.19

File hashes

Hashes for nova_client-0.0.2.tar.gz
Algorithm Hash digest
SHA256 f7929c2b346fdb07f3fa7c686fa6db8991d230d6f1df4db5e72a888e1b677f81
MD5 8806ad2bbca17c402073d51e8acd63a3
BLAKE2b-256 11c0c25067a4fe254e1b2ea00f5a247e764ee305fc056bc42ec588944d9ae8e7

See more details on using hashes here.

File details

Details for the file nova_client-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: nova_client-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.3 keyring/23.7.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.9.19

File hashes

Hashes for nova_client-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 89202fffba2d20834971ad2162d536861751b438b8fbb127079c5592d3ce08f3
MD5 784cc9928fa791feab703ab376f6f696
BLAKE2b-256 8213dc41540f1a27cbdca042c23427b7c6d74bd39617a7d1f3f428d964a03077

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page