Aurelio Platform SDK

0.0.19 · active · verified Thu Apr 16

The Aurelio Platform SDK is a Python library (version 0.0.19) that simplifies interaction with the Aurelio Platform for document processing tasks. It enables developers to extract text from various sources (PDFs, URLs), intelligently chunk content, and generate embeddings. The library focuses on abstracting the complexities of AI-powered document pipelines, offering both synchronous and asynchronous clients. Its release cadence appears to be active with regular updates and feature enhancements.

Common errors

Warnings

Install

Imports

Quickstart

Initializes the AurelioClient with an API key from environment variables and demonstrates how to extract text from a URL. It also includes error handling and checks for the extraction status. Remember to replace the URL or use `extract_file` for local documents.

import os
from aurelio_sdk import AurelioClient
from dotenv import load_dotenv

# Load environment variables from a .env file (optional, but good practice for API keys)
load_dotenv()

# Ensure your API key is set as an environment variable or passed directly
api_key = os.environ.get("AURELIO_API_KEY")

if not api_key:
    raise ValueError("AURELIO_API_KEY environment variable not set.")

client = AurelioClient(api_key=api_key)

# Example: Extract text from a URL
# For a real file, replace with client.extract_file(file_path="your_document.pdf")
try:
    print("Attempting to extract text from a URL...")
    response = client.extract_url(
        url="https://www.aurelio.ai/blog/building-with-openai-agents-sdk",
        model="aurelio-base", # Use the new model names
        wait=60 # Wait up to 60 seconds for completion
    )

    if response.status == "completed":
        print(f"Extraction Status: {response.status}")
        print(f"Extracted Document ID: {response.document.id}")
        if response.chunks:
            print("First chunk of extracted text:")
            print(response.chunks[0].text[:500] + "...") # Print first 500 chars
        else:
            print("No chunks extracted.")
    else:
        print(f"Extraction did not complete. Status: {response.status}. Message: {response.message}")

except Exception as e:
    print(f"An error occurred during extraction: {e}")

view raw JSON →