Skip to content

nicodaimus/python-nicodaimus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Async Python client for the nicodAImus API

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages