aqoon
Python SDK for aqoon — make your knowledge available to any AI.
Installation
pip install aqoon
Quick Start
from aqoon import Aqoon
client = Aqoon(api_key="aqn_your_api_key")
# Search your knowledge base
results = client.search("machine learning basics")
for r in results["results"]:
print(f"{r['title']} (score: {r['score']:.3f})")
print(f" {r['content'][:100]}...")
Usage
Search
# Search all collections
results = client.search("your query")
# Search a specific collection
results = client.search("your query", collection="my-docs")
# Limit results
results = client.search("your query", limit=10)
Collections
# List your collections
collections = client.list_collections()
# Get collection details
collection = client.get_collection("collection-uuid")
# Subscribe to a public collection
client.subscribe("collection-slug")
# Unsubscribe
client.unsubscribe("collection-slug")
Documents
# List documents (with optional filters)
docs = client.list_documents()
docs = client.list_documents(collection="my-docs")
docs = client.list_documents(tag="important")
# Get document with content and chunks
doc = client.get_document("document-uuid")
print(doc["content_text"])
for chunk in doc["chunks"]:
print(f" Chunk {chunk['chunk_index']}: {chunk['content'][:50]}...")
API Keys
# List keys
keys = client.list_keys()
# Create a full-access key
new_key = client.create_key("My New Key", is_full_access=True)
print(f"Key: {new_key['key']}") # Only shown once!
# Create a scoped key
new_key = client.create_key("Scoped Key", collections=["docs", "policies"])
# Revoke a key
client.revoke_key("key-uuid")
# Rotate a key
rotated = client.rotate_key("key-uuid")
print(f"New key: {rotated['key']}")
Usage Stats
# Aggregate usage across all keys
stats = client.usage(days=7)
print(f"Total requests: {stats['total_requests']}")
# Per-key usage
key_stats = client.key_usage("key-uuid", days=30)
Error Handling
from aqoon import Aqoon, NotFoundError, RateLimitError, AuthenticationError
client = Aqoon(api_key="aqn_your_key")
try:
doc = client.get_document("nonexistent-uuid")
except NotFoundError:
print("Document not found")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after}s")
except AuthenticationError:
print("Invalid API key")
Context Manager
with Aqoon(api_key="aqn_your_key") as client:
results = client.search("your query")
# Connection automatically closed
Configuration
client = Aqoon(
api_key="aqn_your_key",
base_url="https://aqoon.ai", # default
timeout=30.0, # seconds, default
)
Requirements
- Python 3.10+
- An aqoon account with an API key (get one here)
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aqoon-0.1.1.tar.gz
(9.1 kB
view details)
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
aqoon-0.1.1-py3-none-any.whl
(10.9 kB
view details)
File details
Details for the file aqoon-0.1.1.tar.gz.
File metadata
- Download URL: aqoon-0.1.1.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
010c5e568231c2e0dba9283222f0afd9aadfbfc0a8405cab52b4855cb36bb788
|
|
| MD5 |
1a0adc956437765550ffb807092ff5d8
|
|
| BLAKE2b-256 |
283d3dca3b1288966598b3e3bbaa3f3f045d8cccfe5383bbdf67a0925728669e
|
File details
Details for the file aqoon-0.1.1-py3-none-any.whl.
File metadata
- Download URL: aqoon-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3f59c567eb908ca61aac110a58fb80dc19a184d735a28bc978e9de4a6f49048
|
|
| MD5 |
73331c1e11fc030f331ed09864e133e6
|
|
| BLAKE2b-256 |
eeaf813ad22cb1e182465075f4169e43633709c2eed60fc688f1e2f8043d2933
|