Skip to main content

The official Python library for the AIssociate API.

Project description

AI:ssociate Python API Library

Dynamic TOML Badge

aissociate is a Python package that provides an interface for interacting with the AI:ssociate API. It currently only supports asynchronous clients, making it suitable for a variety of use cases.

Installation

You can install aissociate using pip by creating a virtual environment and installing it with

pip install aissociate

Prerequisites

  • Python >=3.8 installed
  • A valid API key (request one by contacting sales@aissociate.at)
  • asyncio library installed (install using pip install asyncio)

Usage

Asynchronous Client

AIssociate provides an AsyncAIssociateClient for interacting with the streaming API asynchronously. Below is an example of how you can use it:

import asyncio
from aissociate import AsyncAIssociateClient


client = AsyncAIssociateClient(
    api_key="<AISSOCIATE_API_KEY>",
)

async def main():
    stream = client.ask("Fasse die Judikatur des OGH zur Mietzinsminderung in der Covid-Pandemie zusammen.")
    async for event in stream:
        print(event.text, end="")


if __name__ == "__main__":
    asyncio.run(main())

Note that instead of explicitly setting the API Key, we recommend setting the AISSOCIATE_API_KEY as an environment variable either by exporting it export AISSOCIATE_API_KEY=<your-key> or by loading it from the .env file.

Parameters

  • api_key: Your API key for authentication.
  • base_url: The base URL of the API server (The default is https://aissociate.at).

Notes

The provided API key in the script is for demonstration purposes and should be replaced with a valid key. Ensure that your API key remains confidential and is not shared publicly.

Troubleshooting

If you receive a 401 Unauthorized response, ensure your API key is correct and active. If the request times out, check your internet connection and API availability.

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

aissociate-0.1.3.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

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

aissociate-0.1.3-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file aissociate-0.1.3.tar.gz.

File metadata

  • Download URL: aissociate-0.1.3.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for aissociate-0.1.3.tar.gz
Algorithm Hash digest
SHA256 cf8622cbc39a01aa9d33553cdc88d40cda32a4fa8e3e2b6bfa00e3add9442457
MD5 280a73758dccde72285702bd09f8c63f
BLAKE2b-256 ea110cfea99fcb6ee34894d378c0542d15f17922cece3510aa836455c86eb96d

See more details on using hashes here.

File details

Details for the file aissociate-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: aissociate-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for aissociate-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9f0bd149aaabe79156f8de2c1200d72b6b36b4f9573975c5d781941e407a10b6
MD5 4287b4f8e593a9e64e7d7705ebd12ba9
BLAKE2b-256 adcd878d63591e45bb856da2a436504830962e3dba22723361fdaa00fcceed80

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