The official Python library for the AIssociate API.
Project description
AI:ssociate Python API Library
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)
asynciolibrary installed (install usingpip 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 ishttps://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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf8622cbc39a01aa9d33553cdc88d40cda32a4fa8e3e2b6bfa00e3add9442457
|
|
| MD5 |
280a73758dccde72285702bd09f8c63f
|
|
| BLAKE2b-256 |
ea110cfea99fcb6ee34894d378c0542d15f17922cece3510aa836455c86eb96d
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f0bd149aaabe79156f8de2c1200d72b6b36b4f9573975c5d781941e407a10b6
|
|
| MD5 |
4287b4f8e593a9e64e7d7705ebd12ba9
|
|
| BLAKE2b-256 |
adcd878d63591e45bb856da2a436504830962e3dba22723361fdaa00fcceed80
|