Skip to main content

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 parameters
  • FileNotFoundError: Raised when specified files don't exist
  • requests.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.7+
  • requests library
  • Valid API credentials

License

MIT License

Support

For support, please contact support@raen.ai or visit sso.raen.ai

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

neoathena-0.0.1.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neoathena-0.0.1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file neoathena-0.0.1.tar.gz.

File metadata

  • Download URL: neoathena-0.0.1.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for neoathena-0.0.1.tar.gz
Algorithm Hash digest
SHA256 81a1c0c030a997b5b1b5c9da59cfdebfbd5cde7e93dfc613298a632434f3af41
MD5 08dd258cdd27daf57ecbf72411bb3ba3
BLAKE2b-256 8e40ab7ad592fa92d8d96ea1c9ec5240bcd03c5c241d4abd3de39c88adf7f3a7

See more details on using hashes here.

File details

Details for the file neoathena-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: neoathena-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for neoathena-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f52e77529168bdec0171a72d83e16583cbe24836a8be5e8366da2f84238ad8b5
MD5 ab83542bb7a629a8d5dd14177753c13d
BLAKE2b-256 b962f4fbcbb1dda790d0e834d93e23d88c10929a1babc19356b13437d7d152c1

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