Catalog PyPI
Back to packageRELEASE DETAILS

0.2.0

PyPI

adaptensor

Private Document AI Platform with AdaptHex compression

aidocument-aiembeddingsmachine-learningnlpprivate-airagsemantic-searchvector-search
Published2 Dec 2025
Direct dependencies6
Transitive dependenciesNot calculated

README

Version 0.2.0 documentation

Adaptensor Python SDK

PyPI version Python 3.8+ License: MIT

Private Document AI Platform — Upload, index, and search your documents with AI. 100% self-hosted, no external APIs.

Features

  • 🔒 100% Private — Your data never leaves your infrastructure
  • ⚡ Fast Search — Sub-150ms semantic queries across thousands of documents
  • 📦 AdaptHex Compression — 4-8x smaller vectors with 99.6% accuracy
  • 🔌 Simple API — Upload, index, search in 3 lines of code
  • 🚀 TPU Accelerated — 25% cheaper than GPU clouds

Installation

pip install adaptensor

Quick Start

from adaptensor import Adaptensor

# Initialize client
client = Adaptensor(api_key="your-api-key")

# Upload documents
client.documents.upload("contract.pdf")
client.documents.upload("report.docx")

# Build search index
result = client.documents.index()
print(f"Indexed {result.total_chunks} chunks")

# Search
results = client.query("liability clauses", top_k=5)

for chunk in results:
    print(f"[{chunk.score:.2f}] {chunk.text[:100]}...")

Authentication

Set your API key via environment variable or pass directly:

# Environment variable
export ADAPTENSOR_API_KEY="your-api-key"
# Or pass directly
client = Adaptensor(api_key="your-api-key")

Upload Documents

Single File

doc = client.documents.upload("report.pdf")
print(f"Uploaded: {doc.doc_id} ({doc.size_bytes:,} bytes)")

Multiple Files

docs = client.documents.upload_many([
    "doc1.pdf",
    "doc2.pdf",
    "doc3.pdf"
], on_progress=lambda c, t, d: print(f"{c}/{t}: {d.filename}"))

Supported Formats

  • PDF (.pdf)
  • Word (.docx)
  • Text (.txt)
  • HTML (.html)
  • Markdown (.md)
  • CSV (.csv)

Build Index

After uploading documents, build the search index:

result = client.documents.index()

print(f"Status: {result.status}")
print(f"Documents: {result.documents_processed}")
print(f"Chunks: {result.total_chunks}")
print(f"Time: {result.elapsed_seconds:.1f}s")
results = client.query("contract termination", top_k=5)

for chunk in results:
    print(f"Score: {chunk.score:.3f}")
    print(f"Text: {chunk.text}")
    print(f"Source: {chunk.metadata.get('filename')}")
    print("---")

Search Result Object

results = client.query("machine learning")

print(f"Query: {results.query}")
print(f"Results: {results.count}")
print(f"Time: {results.elapsed_ms:.1f}ms")

# Iterate through results
for chunk in results:
    print(chunk.text)

Embeddings

Generate embeddings with optional AdaptHex compression:

# With compression (default)
result = client.embed("machine learning algorithms")
print(f"Dimensions: {result.dimensions}")
print(f"Hex: {result.hex_embedding[:50]}...")

# Without compression
result = client.embed("machine learning", quantize=False)
print(f"Vector: {result.embedding[:5]}...")

Compression Modes

ModeCompressionAccuracy
hex84x99.6%
hex48x95.8%
binary32x~85%
# Use different compression modes
result = client.embed("text", mode="hex4")  # 8x compression

RAG Chat (Coming Soon)

response = client.chat("What are the key terms in the contract?")
print(response)

Error Handling

from adaptensor import (
    Adaptensor,
    AdaptensorError,
    AuthenticationError,
    DocumentNotFoundError,
    APIError
)

try:
    client = Adaptensor(api_key="invalid-key")
    client.query("test")
except AuthenticationError:
    print("Invalid API key")
except APIError as e:
    print(f"API error: {e} (status: {e.status_code})")
except AdaptensorError as e:
    print(f"General error: {e}")

Configuration

client = Adaptensor(
    api_key="your-api-key",
    base_url="https://your-instance.adaptensor.com",  # Custom endpoint
    timeout=600  # Request timeout in seconds
)

Health Check

if client.health():
    print("API is healthy")
else:
    print("API is down")

Usage Statistics

stats = client.stats()
print(f"Documents: {stats['documents']}")
print(f"Chunks: {stats['chunks']}")
print(f"Queries: {stats['queries']}")

Full Example

from adaptensor import Adaptensor

# Initialize
client = Adaptensor()

# Upload a batch of legal documents
docs = client.documents.upload_many([
    "contracts/agreement_2024.pdf",
    "contracts/amendment_1.pdf",
    "contracts/amendment_2.pdf",
])
print(f"Uploaded {len(docs)} documents")

# Index everything
result = client.documents.index()
print(f"Indexed {result.total_chunks} chunks in {result.elapsed_seconds:.1f}s")

# Search for specific clauses
results = client.query("indemnification obligations", top_k=10)

print(f"\nFound {results.count} results in {results.elapsed_ms:.1f}ms:\n")
for i, chunk in enumerate(results, 1):
    print(f"{i}. [{chunk.score:.2f}] {chunk.metadata.get('filename')}")
    print(f"   {chunk.text[:150]}...")
    print()

Requirements

  • Python 3.8+
  • requests >= 2.25.0

License

MIT License - see LICENSE for details.


Adaptensor — Your Data. Your Infrastructure. Your AI.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 6

Native requirements
6 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
requests
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
requests>=2.25.0runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pytest>=7.0.0; extra == "dev"runtime
pytest-cov
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pytest-cov>=4.0.0; extra == "dev"runtime
black
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
black>=23.0.0; extra == "dev"runtime
mypy
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
mypy>=1.0.0; extra == "dev"runtime
ruff
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
ruff>=0.1.0; extra == "dev"runtime

Distribution files

2 collected
adaptensor-0.2.0-py3-none-any.whl

bdist_wheel · 16.85 KB · Python py3

Source file
adaptensor-0.2.0.tar.gz

sdist · 13.05 KB · Python source

Source file

Repository

PENDING
adaptensor/adaptensor-python

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:04 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:4b19089e17f228bf2e3adb1996e99fad75f5dfd19467aa85c698a0d71a2fd0bf

Other collected versions

View all collected versions →