Skip to main content

Aisberg SDK for Python - A simple and powerful SDK to interact with the Aisberg API

Project description

Aisberg Python SDK

Python Version License

Aisberg SDK for Python is a robust and easy-to-use library for interacting with the Aisberg API.
It provides synchronous and asynchronous clients, advanced module abstractions, and built-in support for conversational LLM workflows, collections, embeddings, and more.


Features

  • Sync & Async clients: Use with regular scripts or async frameworks
  • Auto tool execution for LLM flows (tool calls, results integration)
  • Modular architecture: Collections, chat, models, workflows, embeddings, and more
  • Strong typing via Pydantic models
  • Environment-based configuration (supports .env files and system environment variables)
  • Context manager support for easy resource management
  • Custom tool registration: Easily extend LLM capabilities with your own functions
  • Document Parsing: Parse documents into structured data (e.g., JSON, CSV, PNG, PDF, etc.)

Installation

pip install aisberg

Or, for local development:

git clone https://your.git.repo/aisberg.git
cd aisberg
pip install -e .

Quickstart

1. Configure your API key and base URL

You can set them as environment variables, or in a .env file:

AISBERG_API_KEY=...
AISBERG_BASE_URL=https://url
AISBERG_TIMEOUT=...  # Optional, default is 180 seconds (3 minutes)

In order to use the Document Parsing feature, you also need to set the S3 credentials - ask the FreePro team for these:

S3_ACCESS_KEY_ID=...
S3_SECRET_ACCESS_KEY=...
S3_ENDPOINT=https://s3.endpoint

2. Synchronous Usage

from aisberg import AisbergClient

with AisbergClient() as client:
    me = client.me.info()
    print(me)

    chat_response = client.chat.complete(
        input="Bonjour, qui es-tu ?",
        model="llm-aisberg",
    )
    print(chat_response.choices[0].message.content)

3. Asynchronous Usage

import asyncio
from aisberg import AisbergAsyncClient


async def main():
    async with AisbergAsyncClient() as client:
        await client.initialize()
        me = await client.me.info()
        print(me)

        chat_response = await client.chat.complete(
            input="Hello, who are you?",
            model="llm-aisberg",
        )
        print(chat_response.choices[0].message.content)


asyncio.run(main())

Modules

  • client.me — User/account info
  • client.chat — Conversational LLM completions and streaming
  • client.collections — Manage data collections
  • client.embeddings — Encode texts to embeddings
  • client.models — Model discovery & info
  • client.workflows — Workflow management & execution
  • client.tools — Register and execute tools for LLM tool calls
  • client.documents — Document parsing and management

Each module is available both in the sync and async clients with similar APIs.


Tool Calls and Automatic Execution

The SDK supports tool-augmented LLM workflows. Register your own functions for use in chat:

def my_tool(args):
    # Custom business logic
    return {"result": "tool output"}


client.tools.register("my_tool", my_tool)
response = client.chat.complete(
    input="Use the tool please.",
    model="llm-aisberg",
    tools=[{"name": "my_tool", ...}],
    auto_execute_tools=True,
)

Advanced Usage

Custom Configuration

You can override configuration when instantiating the client:

client = AisbergClient(
    api_key="...",
    base_url="https://url",
    timeout=60,
)

Environment Variables Supported

  • AISBERG_API_KEY
  • AISBERG_BASE_URL
  • AISBERG_TIMEOUT (optional)
  • S3_ACCESS_KEY_ID (for document parsing)(optional)
  • S3_SECRET_ACCESS_KEY (for document parsing)(optional)
  • S3_ENDPOINT (for document parsing)(optional)

Using in a Context Manager

Both clients are context manager compatible:

with AisbergClient() as client:
    # Sync usage
    ...

async with AisbergAsyncClient() as client:
    # Async usage
    ...

License

Private License — Not for public distribution or resale.

For enterprise/commercial use, please contact Mathis Lambert or Free Pro.


Authors

  • Mathis Lambert
  • Free Pro

Support

For support, bug reports, or feature requests, please contact your technical representative.

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

aisberg-0.2.12.tar.gz (30.8 kB view details)

Uploaded Source

Built Distribution

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

aisberg-0.2.12-py3-none-any.whl (41.0 kB view details)

Uploaded Python 3

File details

Details for the file aisberg-0.2.12.tar.gz.

File metadata

  • Download URL: aisberg-0.2.12.tar.gz
  • Upload date:
  • Size: 30.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for aisberg-0.2.12.tar.gz
Algorithm Hash digest
SHA256 38e0ccd83b85e076493c1785bb09962bd285b32d2339ed886f37edfa55314a97
MD5 1fa3d29f5aa278bdf5e6d7121893a145
BLAKE2b-256 56d6100c012ff3cdd3ee7346cc67bde1ed7c0d3191f0f5c03e83e88f39df6b2b

See more details on using hashes here.

File details

Details for the file aisberg-0.2.12-py3-none-any.whl.

File metadata

  • Download URL: aisberg-0.2.12-py3-none-any.whl
  • Upload date:
  • Size: 41.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for aisberg-0.2.12-py3-none-any.whl
Algorithm Hash digest
SHA256 5d6e10e4217a490d11f1803427ce4940b18edd52fe3d66afd10c4ba12e8f3353
MD5 55444a415ee20990660a963c88674cc8
BLAKE2b-256 b93611732975824ce907d7fc9931e559a21b79ff219433fe52e800ee78c6ecb4

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