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.4.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.4-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ailibrary-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 2fae6f083af4e95fd805eb3b2117107508a0920414e047abf535d4eb2431a54e
MD5 0854e0abd4a296d31e7e65576e522a55
BLAKE2b-256 1f57ede0a68609aae8cd214f1c3813f7885df9104c72138a7635e7b661c1c6f8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ailibrary-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0438a0cce8339c271aaa642f02cc42161872a4660aed05eeebf9a123af4095ef
MD5 fa0cec044b8911255c70f84208249467
BLAKE2b-256 db21c8e8ac43896145982db2d9ed9da8b4d8bb1906f1791e30d7a6d57059eea0

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