Skip to main content

Async Python client for the nicodAImus API

Project description

python-nicodaimus

Async Python client for the nicodAImus API.

Installation

pip install python-nicodaimus

Usage

import aiohttp
from nicodaimus import NicodaimusClient

async with aiohttp.ClientSession() as session:
    client = NicodaimusClient(
        api_key="sk-your-api-key",
        session=session,
    )

    # Validate your API key
    await client.validate_connection()

    # Non-streaming chat completion
    response = await client.chat_completion(
        messages=[{"role": "user", "content": "Hello!"}],
    )
    print(response.choices[0].message.content)

    # Streaming chat completion
    async for chunk in client.chat_completion_stream(
        messages=[{"role": "user", "content": "Tell me a story"}],
    ):
        if chunk.choices[0].delta.content:
            print(chunk.choices[0].delta.content, end="")

Home Assistant

This library powers the nicodAImus Home Assistant integration.

License

Apache License 2.0

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

python_nicodaimus-0.1.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_nicodaimus-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file python_nicodaimus-0.1.0.tar.gz.

File metadata

  • Download URL: python_nicodaimus-0.1.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for python_nicodaimus-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5a576e1e7d5ee3be63eff17d69d0178739f9a1b05e0c781cbcbf3e02f5eac2bc
MD5 5edeb277fc7fe3dfc5a76245d3378705
BLAKE2b-256 150f99ee4d4c9fcb5fa9990fbbf3211e53e6fe1ea51e6d250a2b88322d6ab265

See more details on using hashes here.

File details

Details for the file python_nicodaimus-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for python_nicodaimus-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dd76cdd0e4268a58a38914a3ed8c0e53532c272285aeb41502a10c0890e12166
MD5 5548442ca7d2002f8d1fd6293b2ebcab
BLAKE2b-256 c6aabf10e7746a4329cc9d98733c2d10f9e01f1ec21686db910781d94b1e179e

See more details on using hashes here.

Supported by

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