Quick Start¶
Get Adaptensor running in 5 minutes. This guide covers installation, uploading your first document, and running your first search.
Prerequisites¶
- Python 3.8 or higher
- An Adaptensor API key (sign up here)
Step 1: Install the SDK¶
Step 2: Set Your API Key¶
You can set your API key as an environment variable:
Or pass it directly to the client:
Step 3: Upload a Document¶
from adaptensor import Adaptensor
client = Adaptensor()
# Upload a PDF
doc = client.documents.upload("my-document.pdf")
print(f"Uploaded: {doc.filename}")
print(f"Size: {doc.size_bytes:,} bytes")
print(f"Text extracted: {doc.text_length:,} characters")
Supported formats: PDF, DOCX, TXT, HTML, MD, CSV
Step 4: Build the Search Index¶
After uploading documents, build the search index:
result = client.documents.index()
print(f"Indexed {result.total_chunks} chunks")
print(f"Time: {result.elapsed_seconds:.1f} seconds")
This step: 1. Splits your documents into semantic chunks 2. Generates embeddings using self-hosted AI 3. Compresses vectors with AdaptHex (4x smaller) 4. Builds a searchable vector index
Step 5: Search Your Documents¶
results = client.query("your search query", top_k=5)
print(f"Found {results.count} results in {results.elapsed_ms:.1f}ms\n")
for chunk in results:
print(f"Score: {chunk.score:.3f}")
print(f"Source: {chunk.metadata.get('filename')}")
print(f"Text: {chunk.text[:200]}...")
print("---")
Complete Example¶
Here's everything together:
from adaptensor import Adaptensor
# Initialize
client = Adaptensor()
# Upload documents
print("Uploading documents...")
client.documents.upload("contract.pdf")
client.documents.upload("appendix.pdf")
# List what we have
docs = client.documents.list()
print(f"Total documents: {len(docs)}")
# Build index
print("Building index...")
result = client.documents.index()
print(f"Indexed {result.total_chunks} chunks in {result.elapsed_seconds:.1f}s")
# Search
print("\nSearching for 'termination clause'...")
results = client.query("termination clause", top_k=3)
for i, chunk in enumerate(results, 1):
print(f"\n--- Result {i} (score: {chunk.score:.3f}) ---")
print(chunk.text[:300])
What's Next?¶
Troubleshooting¶
"No documents indexed" error¶
Make sure you've called client.documents.index() after uploading documents.
Timeout during indexing¶
Large documents (>10MB) may take several minutes to index. Increase the timeout:
Connection errors¶
Check that your API key is valid and you have internet connectivity:
Need Help?¶
- Check the API Reference for detailed endpoint documentation
- See Concepts to understand how Adaptensor works
- Email us at hello@adaptensor.com