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.0.2.tar.gz (6.7 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.0.2-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ailibrary-0.0.2.tar.gz
Algorithm Hash digest
SHA256 edc5dd1217ee80f9f943c486cdf0f59693bd278fbdee5b6c6d955534584ceaf0
MD5 0fb1e1d9c251345dd9651ed8e2262a02
BLAKE2b-256 48844ab5249603f514411cc56816e6aab385341f31df1a06098bd0c3f519ec81

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ailibrary-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.5 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.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a90fe2f1e5994b04c8e27a2365c49445089e47a1370d565281679f360ead711c
MD5 d429ade2762b81f64115cb1b6792fffa
BLAKE2b-256 25a9bb90c9bede962291c775144bdc130cedaa42e0f120f427b223d6440d6268

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