ZeroEntropy Rust SDK
Rust client library for the ZeroEntropy API - a powerful semantic search and document retrieval service.
Features
This library provides a complete implementation of all ZeroEntropy API endpoints. It uses strong typing with comprehensive error handling and is built on Tokio for async operations. The client includes configurable retry logic with exponential backoff and provides an ergonomic API with builder patterns.
Installation
Add this to your Cargo.toml:
[]
 = "0.1.0"
 = {  = "1.0",  = ["full"] }
Quick Start
use Client;
async 
Configuration
Environment Variables
- ZEROENTROPY_API_KEY- Your API key (required)
- ZEROENTROPY_BASE_URL- Custom API base URL (optional)
Client Builder
For advanced configuration, use the client builder:
use Client;
use Duration;
let client = builder
    .api_key
    .timeout
    .max_retries
    .build?;
Usage Examples
Collections
// Create a collection
client.collections.add.await?;
// List all collections
let collections = client.collections.get_list.await?;
for name in collections.collections 
// Delete a collection
client.collections.delete.await?;
Documents
Adding Text Documents
client.documents.add_text.await?;
Adding Documents with Metadata
use HashMap;
use MetadataValue;
let mut metadata = new;
metadata.insert;
client.documents.add_text.await?;
Adding PDF Documents
// From base64 encoded data
client.documents.add_pdf.await?;
// Directly from file
client.documents.add_pdf_file.await?;
Managing Documents
// Get document info
let info = client.documents.get_info.await?;
// Update document metadata
client.documents.update.await?;
// Delete document
client.documents.delete.await?;
Queries
Top Documents
let results = client.queries.top_documents.await?;
for doc in results.results 
Top Snippets
let results = client.queries.top_snippets.await?;
for snippet in results.results 
Top Pages
let results = client.queries.top_pages.await?;
for page in results.results 
Filtering
Use metadata filters to narrow down search results:
use json;
let filter = json!.as_object.unwrap.clone;
let results = client.queries.top_snippets.await?;
Reranking
Improve search result quality with reranking:
use RerankDocument;
let documents = vec!;
let results = client.models.rerank.await?;
for result in results.results 
Error Handling
The SDK provides specific error types for different failure scenarios:
use Error;
match client.collections.add.await 
Examples
Check out the examples directory for more complete examples:
- basic.rs - Complete workflow from collection creation to search
- arxiv_search.rs - Download and search arXiv papers with PDF support
Run an example:
API Documentation
For detailed API documentation, visit:
Development
Building
Running Tests
Running Examples
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
Support
- Documentation: docs.zeroentropy.dev
- Email: founders@zeroentropy.dev
- Issues: GitHub Issues