Skip to main content

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:

  1. Changes that only affect static types, without breaking runtime behavior.
  2. 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).
  3. 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.

Release files for instabase-aihub 0.14.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for instabase-aihub 0.14.0
File Size Uploaded
instabase_aihub-0.14.0.tar.gz 76.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for instabase-aihub 0.14.0
File Interpreter ABI Platform
instabase_aihub-0.14.0-py3-none-any.whl Python 3 none any Details

Total release size: 260.1 kB

Release files / instabase_aihub-0.14.0.tar.gz

Download URL instabase_aihub-0.14.0.tar.gz
Size 76.9 kB
Tags Source
SHA-256 checksum
How to use checksums
96664a81282152243b55ca6561a5d49cf38564cd64ebc25c8f0e0c753ce17dbe
BLAKE2b-256 checksum
How to use checksums
2d87c6366db437863342c375b22857d3bb5e679bab2d57a1ac1550edefbfd739
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / instabase_aihub-0.14.0-py3-none-any.whl

Download URL instabase_aihub-0.14.0-py3-none-any.whl
Size 183.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da3d0c8b6d03983e7e425d9893b5567f1c9db1789f0679f4ee9df87916239516
BLAKE2b-256 checksum
How to use checksums
5b0f071d8270bfe22b0bb10d84a7e4cba4b8c4360bbdd21baf663cc7b0a7b974
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.14.0 This release

2 release files

0.13.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page