A Python client for the NeoAthena API
Project description
NeoAthena Python Client
A Python client library for interacting with the NeoAthena API, providing functionality to create and manage collections, upload files, and perform document retrieval operations.
Installation
pip install neoathena
Quick Start
from neoathena import NeoAthenaClient
# Initialize the client
client = NeoAthenaClient(api_key="your-api-key")
# Check if the collection exists, create it if it doesn't, and upload the file to the collection
results =client.upload_to_collection(collection_name="your-collection-name",filepath="path/to/your/file")
# Retrieve documents based on a query
results = client.retrieve_from_collection(collection_name="your-collection-name", query="your search query", top_k=4)
# List your collections
result=client.get_collections()
Features
- Create collection and upload files with automatic content type detection
- Perform semantic search queries
- Delete individual documents or entire collections
- List all user collections
- Built-in error handling and validation
API Reference
Create a Collection and Upload Files
client = NeoAthenaClient(api_key="your-api-key")
results =client.upload_to_collection(
collection_name="your-collection-name",
filepath="path/to/your/file"
)
Retrieving Documents
results = client.retrieve_from_collection
(
collection_name="your-collection-name",
query="your search query",
top_k=4
)
Deleting Documents
Delete a specific document:
response = client.delete_from_collection(
collection_name="your-collection-name",
doc_id=123
)
Delete all documents:
response = client.delete_from_collection(
collection_name="your-collection-name",
doc_id=0,
delete_all=True
)
Deleting a Collection
response = client.delete_collection(collection_name="your-collection-name")
List user collection
response = client.get_collections()
Error Handling
The client includes comprehensive error handling for common scenarios:
ValueError: Raised for invalid input parametersFileNotFoundError: Raised when specified files don't existrequests.exceptions.RequestException: Raised for network-related errors
Example error handling:
try:
response = client.upload_to_collection(api_key, "file.pdf")
except FileNotFoundError:
print("File not found")
except ValueError as e:
print(f"Invalid input: {e}")
except requests.exceptions.RequestException as e:
print(f"API request failed: {e}")
Requirements
- Python 3.8+
- requests library
- Valid API credentials
License
GNU General Public License v3.0
Support
For support, please contact support@raen.ai
Project details
Release history Release notifications | RSS feed
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 neoathena-0.0.2.tar.gz.
File metadata
- Download URL: neoathena-0.0.2.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4a9e88eead8eb222d3fccabcf43edac2a8bf0359a44bd96e0d61e823a254d93
|
|
| MD5 |
7942c0611f9b58cca5a6ca7aeccfe627
|
|
| BLAKE2b-256 |
1e68364a49753fdff7ab58214682d6416f87f3a470af8bdfddb7e4c0b6783a0e
|
File details
Details for the file neoathena-0.0.2-py3-none-any.whl.
File metadata
- Download URL: neoathena-0.0.2-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53160517e262249883592ab8a85bd0926529c298ef039956618736e0a1c762ef
|
|
| MD5 |
d0c06c07dc3da5345adb2a6485c0fa60
|
|
| BLAKE2b-256 |
f097e084640206f2b388cb247bbed4f0fe8bd7187e6a6e1a98c4c0919608e714
|