Skip to main content

AI Library REST API for any Python 3.8+ application.

Project description

AI Library Python API Library

The AI Library Python library provides convenient access to the AI Library REST API from any Python 3.8+ application. The library includes type definitions for all request params and response fields, and offers both synchronous and asynchronous clients.

Installation

pip install ailibrary

Usage

import os
import ailibrary as ai
client = ai.AILibrary(
    api_key=os.environ.get("AI_LIBRARY_KEY"),
    domain="https://api.ailibrary.ai/" // only required for self-hosted AI Library instances
)

Creating your first agent

Initialise your agent

sales_agent = client.agent.create(
    title = "Sales Agent"
    instructions="You are a sales agent trying to qualify a lead. You are receiving this "
    )

Add training files

client.files.upload(
    files = ['/local/path/to/file.pdf'], //txt, pdf, pptx, docx, xlsx
    knowledge_id = sales_agent.knowledge_id
)

Check status of the agent knowledge

print(client.knowledge_base.get_status())

Chat with agent

completion = agent.chat(
    messages = [
        {
            "role": "assistant",
            "content": "Hey, are you looking to buy?"
        },
        {
            "role": "user",
            "content": "Yes, I want to know more first"
        }
    ]
)

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

ailibrary-0.1.3.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

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

ailibrary-0.1.3-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file ailibrary-0.1.3.tar.gz.

File metadata

  • Download URL: ailibrary-0.1.3.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for ailibrary-0.1.3.tar.gz
Algorithm Hash digest
SHA256 8727f08ec21579071c807ca9e5067f968c61c8b8dfd29126fb96ea201e3edbbb
MD5 93812fd8b08555e4523af2db106ce229
BLAKE2b-256 6591062794a89f959ec9f6200d1471a6d24b5fb3c3def02a35ca241d04f6be0b

See more details on using hashes here.

File details

Details for the file ailibrary-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: ailibrary-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for ailibrary-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ae1f31460dc8c323edcaab426d6f045fda830528c6d0a5aa77495e8f21fe2836
MD5 bc7d039c0edea8aa4bc8dcd59576d9db
BLAKE2b-256 090848eb656b25cac31e369ea1ad82a69d2f5dbd26e4258d7dacc5f4ea6cace4

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