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

Uploaded Source

Built Distribution

nova_client-0.0.5-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

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

Hashes for nova_client-0.0.5.tar.gz
Algorithm Hash digest
SHA256 dac59705b51e85ef5f678ec65a19ae5da484e66ffb835ab8aa43d3ae1f846ed0
MD5 20747c34dcff160488553ebb2a5d90af
BLAKE2b-256 da9bf0d7f410b4a7334ad6fa565d58cb242a0467caf8d3ef9d5d3a19885ba6c3

See more details on using hashes here.

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

Hashes for nova_client-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7d2be4c448d0a8b056ed38d804b63d9f96b1e7e2db9459210ff6b5a8ba854cfc
MD5 91f9308e35e1fdff8afaae6bc208cc09
BLAKE2b-256 9fd71a88dda35c1243d123f0f02db7c9a36083a17ce9641a2c28775f8ecc210a

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