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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ailibrary-0.1.1.tar.gz
  • Upload date:
  • Size: 6.8 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.1.tar.gz
Algorithm Hash digest
SHA256 d79ce6386ba8845feb6f2882e14db4fd80cc6875e51dcbc1a706125ede384ef3
MD5 6b52bf9faf79e843a1d564d81cf0e0a6
BLAKE2b-256 ec6a655d4b7d8a2d82bf8f72f128885bcecaf589b464f1a43d3885cfb841779c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ailibrary-0.1.1-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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d1488cb7bbf94f4704011f316eb00c233d00f6f85a28982dc8eca3427b7c682c
MD5 380d0cb02688fb18e354091d61ee8275
BLAKE2b-256 501370f67392b03e2ca398f2c3fe15129857082bb4b1f5b228709df62a4f4b5c

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