Skip to main content

ibl-data-manager

Project description

iblai

API for ibl.ai — a generative AI backend as a service for educators.

Requirements

Python 3.9+

Installation & Usage

pip install

To install the API client library, simply execute:

pip install iblai

Then import the package:

import iblai

Getting Started

Please follow the installation procedure and then run the following:

Adding LLM credentials

from iblai.helpers import add_llm_credential

base_url = "https://base.manager.iblai.app/"
api_token = "<MY_ACCESS_TOKEN>"

credential_name = "openai"
credential_value = "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
tenant = "new-platform"

add_llm_credential(credential_name, credential_value, tenant, api_token, base_url)

Chatting with a mentor

import asyncio
from iblai.helpers import (
    create_mentor,
    upload_document_to_mentor,
    wait_for_document_training_to_complete,
    create_chat_session,
    chat_with_mentor_async
)

async def main():
    tenant = "new-platform"
    username = "my-user"
    base_url = "https://base.manager.iblai.app/"
    asgi_base_url = "wss://asgi.data.iblai.app"
    api_token = "<MY_ACCESS_TOKEN>"

    mentor_name = "My New Mentor"
    mentor_settings = {
        "new_mentor_name": mentor_name,
        "display_name": mentor_name,
    }

    mentor_data = await create_mentor(tenant, username, mentor_settings, api_token, base_url)
    await upload_document_to_mentor(
        mentor_name=mentor_name,
        file_path="doc.pdf",
        tenant, username, api_token, base_url
    )

    await wait_for_document_training_to_complete(mentor_name, tenant, username, api_token, base_url)

    session_id = await create_chat_session(mentor_name, tenant, username, base_url)

    prompt = "What is the main topic of the document?"
    async for token in chat_with_mentor_async(
        prompt, session_id, mentor_name, tenant, username, api_token, asgi_base_url
    ):
        print(token, end="")

asyncio.run(main())

Inviting a user

from iblai.helpers import invite_user_to_platform

base_url = "https://base.manager.iblai.app/"
api_token = "<MY_ACCESS_TOKEN>"

tenant = "new-platform"
email = "new-student@example.com"

invite_user_to_platform(tenant, email, api_token, base_url)

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

iblai-4.89.4.tar.gz (746.2 kB view details)

Uploaded Source

Built Distribution

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

iblai-4.89.4-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file iblai-4.89.4.tar.gz.

File metadata

  • Download URL: iblai-4.89.4.tar.gz
  • Upload date:
  • Size: 746.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for iblai-4.89.4.tar.gz
Algorithm Hash digest
SHA256 7ca1ce98e0c21f74668564323fdcece1298a754a1faf90a81669a4ca1c4f5ea9
MD5 5060c76485c8a4d414dc56f4f268ce42
BLAKE2b-256 da8e19093948cc53e975834904f825983fdf926c38a7a5f0d41c9065e8f58b44

See more details on using hashes here.

File details

Details for the file iblai-4.89.4-py3-none-any.whl.

File metadata

  • Download URL: iblai-4.89.4-py3-none-any.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for iblai-4.89.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bccc13cb75d597341f33e5b6699c5484aa3330c64bf9b75b2e53ff7bc87911c4
MD5 460656c347bebf538791460344439aa3
BLAKE2b-256 0a3446f75774fd8787affbb24dd1c3b92b00d159ce6e8d22ea16a9da46952fe7

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