Skip to main content

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:

  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.

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

instabase_aihub-0.14.0.tar.gz (76.9 kB view details)

Uploaded Source

Built Distribution

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

instabase_aihub-0.14.0-py3-none-any.whl (183.2 kB view details)

Uploaded Python 3

File details

Details for the file instabase_aihub-0.14.0.tar.gz.

File metadata

  • Download URL: instabase_aihub-0.14.0.tar.gz
  • Upload date:
  • Size: 76.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for instabase_aihub-0.14.0.tar.gz
Algorithm Hash digest
SHA256 96664a81282152243b55ca6561a5d49cf38564cd64ebc25c8f0e0c753ce17dbe
MD5 7484558f3446d2bedc3639a36553ebbf
BLAKE2b-256 2d87c6366db437863342c375b22857d3bb5e679bab2d57a1ac1550edefbfd739

See more details on using hashes here.

File details

Details for the file instabase_aihub-0.14.0-py3-none-any.whl.

File metadata

File hashes

Hashes for instabase_aihub-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da3d0c8b6d03983e7e425d9893b5567f1c9db1789f0679f4ee9df87916239516
MD5 e55965b04836996600dfe5c5e2c0f8b5
BLAKE2b-256 5b0f071d8270bfe22b0bb10d84a7e4cba4b8c4360bbdd21baf663cc7b0a7b974

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