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
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 instabase-aihub-0.13.0.tar.gz.
File metadata
- Download URL: instabase-aihub-0.13.0.tar.gz
- Upload date:
- Size: 84.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a30d40d9a0a081c141534fee6495f3e222fc8816e2c7c9a6a1bd99ed17ecc790
|
|
| MD5 |
0215201c7ffc7b1d384d2ae26e665cb8
|
|
| BLAKE2b-256 |
f9a22421a30055a186598699159b050c67b734185e338b88293a8e11c1507ad8
|
File details
Details for the file instabase_aihub-0.13.0-py3-none-any.whl.
File metadata
- Download URL: instabase_aihub-0.13.0-py3-none-any.whl
- Upload date:
- Size: 187.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 |
9fc58d889dedc73d528c2b682ec40b9e338f39c6e95500259aefb54667aa6c90
|
|
| MD5 |
b27304a62812a5e4bfbfc9630bf44e01
|
|
| BLAKE2b-256 |
a1136d8e5d60b567d4301fb5b6aedcfc19e6f29bec4fb1fbbb61703d547a8fdf
|