Aurelio SDK
The Aurelio Platform SDK. API references
Installation
To install the Aurelio SDK, use pip or poetry:
pip install aurelio-sdk
Authentication
The SDK requires an API key for authentication. Get key from Aurelio Platform. Set your API key as an environment variable:
export AURELIO_API_KEY=your_api_key_here
Usage
See examples for more details.
Initializing the Client
from aurelio_sdk import AurelioClient
import os
client = AurelioClient(api_key=os.environ["AURELIO_API_KEY"])
or use asynchronous client:
from aurelio_sdk import AsyncAurelioClient
client = AsyncAurelioClient(api_key="your_api_key_here")
Chunk
from aurelio_sdk import ChunkingOptions, ChunkResponse
# All options are optional with default values
chunking_options = ChunkingOptions(
chunker_type="semantic", max_chunk_length=400, window_size=5
)
response: ChunkResponse = client.chunk(
content="Your text here to be chunked", processing_options=chunking_options
)
Extracting Text from Files
PDF Files
from aurelio_sdk import ExtractResponse
# From a local file
file_path = "path/to/your/file.pdf"
response_pdf_file: ExtractResponse = client.extract_file(
file_path=file_path, quality="low", chunk=True, wait=-1
)
Video Files
from aurelio_sdk import ExtractResponse
# From a local file
file_path = "path/to/your/file.mp4"
response_video_file: ExtractResponse = client.extract_file(
file_path=file_path, quality="low", chunk=True, wait=-1
)
Extracting Text from URLs
PDF URLs
from aurelio_sdk import ExtractResponse
# From URL
url = "https://arxiv.org/pdf/2408.15291"
response_pdf_url: ExtractResponse = client.extract_url(
url=url, quality="low", chunk=True, wait=-1
)
Video URLs
from aurelio_sdk import ExtractResponse
# From URL
url = "https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4"
response_video_url: ExtractResponse = client.extract_url(
url=url, quality="low", chunk=True, wait=-1
)
Waiting for completion and checking document status
# Set wait time for large files with `high` quality
# Wait time is set to 10 seconds
response_pdf_url: ExtractResponse = client.extract_url(
url="https://arxiv.org/pdf/2408.15291", quality="high", chunk=True, wait=10
)
# Get document status and response
document_response: ExtractResponse = client.get_document(
document_id=response_pdf_file.document.id
)
print("Status:", document_response.status)
# Use a pre-built function, which helps to avoid long hanging requests (Recommended)
document_response = client.wait_for(
document_id=response_pdf_file.document.id, wait=300
)
Embeddings
from aurelio_sdk import EmbeddingResponse
response: EmbeddingResponse = client.embedding(
input="Your text here to be embedded",
model="bm25")
# Or with a list of texts
response: EmbeddingResponse = client.embedding(
input=["Your text here to be embedded", "Your text here to be embedded"]
)
Response Structure
The ExtractResponse object contains the following key information:
status: The current status of the extraction taskusage: Information about token usage, pages processed, and processing timemessage: Any relevant messages about the extraction processdocument: The extracted document information, including its IDchunks: The extracted text, divided into chunks if chunking was enabled
The EmbeddingResponse object contains the following key information:
message: Any relevant messages about the embedding processmodel: The model name used for embeddingusage: Information about token usage, pages processed, and processing timedata: The embedded documents
Best Practices
- Use appropriate wait times based on your use case and file sizes.
- Use async client for better performance.
- For large files or when processing might take longer, enable polling for long-hanging requests.
- Always handle potential exceptions and check the status of the response.
- Adjust the
qualityparameter based on your needs. "low" is faster but less accurate, while "high" is slower but more accurate.
Metadata
Release files for aurelio-sdk 0.0.19
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aurelio_sdk-0.0.19.tar.gz | 15.3 kB | Without provenance | Details for aurelio_sdk-0.0.19.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aurelio_sdk-0.0.19-py3-none-any.whl | Python 3 | none | any | Details for aurelio_sdk-0.0.19-py3-none-any.whl |
Total release size: 32.6 kB
Release files / aurelio_sdk-0.0.19.tar.gz
| Download URL | aurelio_sdk-0.0.19.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
14107e7440ff2efd0b4a08c52fb595e7680bd4bc973a0ddfb3b64157c6666b91
|
|
BLAKE2b-256 checksum How to use checksums |
270ec2e369ad173fb3d76448e46d10beb3dcc53388318933ddf8169a3f21a810
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.12.9 Linux/6.8.0-1021-azure
|
Release files / aurelio_sdk-0.0.19-py3-none-any.whl
| Download URL | aurelio_sdk-0.0.19-py3-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
390c0212b59ce99116df8722d3badced88c5ef0bb742a6222d479ceed0ed3948
|
|
BLAKE2b-256 checksum How to use checksums |
a21faa74b23b6eea4cf9b79ace914df59123c4c8e7e4bd32dd22d09c126422d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.12.9 Linux/6.8.0-1021-azure
|
Security for aurelio-sdk 0.0.19
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.