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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: nova_client-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 e4308d6f9f80fc5e8a5493422a9eaf8b3f21b80a5fad4721b10a6dbb6c18f94d
MD5 f5efffd14d414c63df9259de5f98cb66
BLAKE2b-256 e65db08cb9bf02978a7a57d94297b60dfb55914e376028d3d81bc888b50f00c3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nova_client-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2b60eabfed6929d69a6cb5e497564a8e9f0413f581dbd72c879fd6772a2b102b
MD5 34c3bdb7457bf208d8caa794ba240777
BLAKE2b-256 a2a0b090bc8fc1f445982ccd7d211c52776d13f33182ebea4c8f880b7ea3dd84

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