AI Hub API
Project description
Instabase AI Hub Python Library
The AI Hub Python library provides convenient access to the AI Hub REST API from any Python 3.7+ application. The library includes type definitions for all request params and response fields.
The SDK is automatically from an OpenAPI specification using the OpenAPI Generator.
Documentation
The REST API documentation is available at AI Hub docs.
Installation
# install from PyPI
pip install instabase-aihub
Usage
Here is a simple example that creates a batch by uploading a single file and runs an app to summarize it.
from aihub import AIHub
import os
import time
# Initializes the client. Set the API token.
client = AIHub(api_key="<API-TOKEN>")
# Creates a batch and adds files.
batch = client.batches.create(name='<BATCH-NAME>')
file_paths = ['<inner/folder/sample1.pdf>', '<.../sample2.docx>', '<.../sample3.png>']
for file_path in file_paths:
with open(file_path, "rb") as file:
client.batches.add_file(id=batch.id, file_name=os.path.basename(file_path), file=file)
# Runs an app and gets the results when the app run is complete.
run = client.apps.runs.create(app_name='<APP-NAME>', owner=None, batch_id=batch.id)
# Continuously checks the run status until it's done.
while True:
status = client.apps.runs.status(run.id)
if status.status == 'COMPLETE':
break
time.sleep(5) # Polling interval
results = client.apps.runs.results(run.id)
Versioning
This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:
- Changes that only affect static types, without breaking runtime behavior.
- Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals).
- Changes that we do not expect to impact the vast majority of users in practice.
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
We are keen for your feedback; please open an issue with questions, bugs, or suggestions.
Requirements
Python 3.7 or higher.
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
File details
Details for the file instabase-aihub-0.11.0.tar.gz
.
File metadata
- Download URL: instabase-aihub-0.11.0.tar.gz
- Upload date:
- Size: 71.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
3dc3f77c8fcdc19a79105fcf25b31e8b9f60d2205af92bb2f859c66bc0cb2134
|
|
MD5 |
a63d330ec5a88925540b0642ca9536e5
|
|
BLAKE2b-256 |
70fccdd8f61d3ee3d24ada0b42020b15bb8bd3d96e68422d1f89f0b0d3df846e
|
File details
Details for the file instabase_aihub-0.11.0-py3-none-any.whl
.
File metadata
- Download URL: instabase_aihub-0.11.0-py3-none-any.whl
- Upload date:
- Size: 162.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
edfe8478f64dd0034302a90f2caecc7885946d90656ff3758465a425c9e7875e
|
|
MD5 |
5bd3dc42ed2174d367ee24fbd25d4348
|
|
BLAKE2b-256 |
0b744a9fa9463e10690325256efb6c9251665a6712d53aca1c5f1ff0fe907a7b
|