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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: nova_client-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 9f5f05e475b7de096306fd72adef5daef6fa89245b6e0626253a74b1aca2c42e
MD5 2a5cbe85221da911e15cba742d0094d7
BLAKE2b-256 84912ceaa5f0555301a096f21a311c6da39ef1e6cf933f1d20c7ae9e224c49f6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nova_client-0.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 87ab85a343a1227617f680f8a8fe02e02501b909e4e03b602589aca8e53614dc
MD5 0030d4f8db8840f5d59017c6c5c4d36b
BLAKE2b-256 cf470b29be3b68cbad2f826b7b52bf83b34b54a8d0609c99c2a245d2abf11c23

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