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
Metadata
Release files for aqoon 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aqoon-0.1.1.tar.gz | 9.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aqoon-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.1 kB
Release files / aqoon-0.1.1.tar.gz
| Download URL | aqoon-0.1.1.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
010c5e568231c2e0dba9283222f0afd9aadfbfc0a8405cab52b4855cb36bb788
|
|
BLAKE2b-256 checksum How to use checksums |
283d3dca3b1288966598b3e3bbaa3f3f045d8cccfe5383bbdf67a0925728669e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Release files / aqoon-0.1.1-py3-none-any.whl
| Download URL | aqoon-0.1.1-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a3f59c567eb908ca61aac110a58fb80dc19a184d735a28bc978e9de4a6f49048
|
|
BLAKE2b-256 checksum How to use checksums |
eeaf813ad22cb1e182465075f4169e43633709c2eed60fc688f1e2f8043d2933
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|