AI Library REST API for any Python 3.9+ 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ailibrary-0.1.5.tar.gz.
File metadata
- Download URL: ailibrary-0.1.5.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca2ca5067f49a187715eb68e4d860ac9103d9d749a9dd9ca741e3807bce5a267
|
|
| MD5 |
393cae6b9dbeb5219c08f19c2bb3364d
|
|
| BLAKE2b-256 |
47e34c0467df4b90170dbf612f465d9f5f981403a5fc9b14c0705e1ce9061f84
|
File details
Details for the file ailibrary-0.1.5-py3-none-any.whl.
File metadata
- Download URL: ailibrary-0.1.5-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa56d205a19af87e84042ae8914af259d4ef50623cb3d7a56dad5dd0e8fcac62
|
|
| MD5 |
e69029fd8232f8264b29a4b1eaae04b3
|
|
| BLAKE2b-256 |
6f4f28a806926131770de4c5cf4cfeab5e1929050ef8a107075432ffc5448c20
|