UnSearch Python SDK
Comprehensive AI search API with full backend capabilities. Drop-in Tavily replacement with self-hosting and zero-retention options.
Features
- Tavily-compatible - Drop-in replacement for Tavily API
- Exa-compatible - Neural/semantic search endpoints
- RAG-optimized - Built for retrieval augmented generation
- 70+ search engines - Aggregated results from multiple sources
- Topic monitoring - Real-time web monitoring
- Fact verification - AI-powered fact-checking
- Zero-retention - Privacy-first architecture
Installation
pip install unsearch
# With LangChain support
pip install unsearch[langchain]
Quick Start
from unsearch import UnSearchClient
client = UnSearchClient(api_key="your-api-key")
# Basic search
response = client.search("What is machine learning?")
for result in response.results:
print(f"{result.title}: {result.url}")
# Search with AI answer
response = client.search(
"What is RAG?",
include_answer=True,
max_results=5
)
print(response.answer)
# Q&A shortcut
answer = client.qna_search("What is the capital of France?")
print(answer)
Migrate from Tavily
UnSearch is designed as a drop-in replacement for Tavily. Migration is simple:
Option 1: Direct replacement
# Before (Tavily)
from tavily import TavilyClient
client = TavilyClient(api_key="tvly-...")
# After (UnSearch)
from unsearch import UnSearchClient
client = UnSearchClient(api_key="uns-...")
Option 2: Alias (minimal code changes)
# Add this import alias
from unsearch import UnSearchClient as TavilyClient
# Your existing code works unchanged
client = TavilyClient(api_key="uns-...")
response = client.search("query")
LangChain Integration
from unsearch.langchain import UnSearchResults
# Create tool
tool = UnSearchResults(
api_key="your-api-key",
max_results=5,
include_answer=True
)
# Use in agent
results = tool.invoke("What is LangChain?")
Migrate from TavilySearchResults
# Before
from langchain_community.tools import TavilySearchResults
tool = TavilySearchResults(api_key="tvly-...")
# After (option 1)
from unsearch.langchain import UnSearchResults
tool = UnSearchResults(api_key="uns-...")
# After (option 2: alias)
from unsearch.langchain import UnSearchResults as TavilySearchResults
tool = TavilySearchResults(api_key="uns-...")
Self-Hosted Instance
# Point to your self-hosted UnSearch
client = UnSearchClient(
api_key="your-api-key",
base_url="https://your-unsearch-instance.com"
)
# Or use environment variable
# export UNSEARCH_BASE_URL=https://your-unsearch-instance.com
Zero-Retention Mode
For privacy-sensitive applications:
# Enable zero-retention (no data stored on server)
client = UnSearchClient(
api_key="your-api-key",
zero_retention=True
)
# Or per-request via header
# X-Zero-Retention: true
Async Support
from unsearch import AsyncUnSearchClient
async def search():
async with AsyncUnSearchClient(api_key="your-key") as client:
response = await client.search("async search query")
return response.results
API Reference
Agent API (Tavily-compatible)
| Method | Description |
|---|---|
search(query, **options) |
AI-optimized web search |
extract(urls, **options) |
Extract content from URLs |
research(query, **options) |
Multi-step deep research |
qna_search(query) |
Quick Q&A shortcut |
get_search_context(query, max_results) |
Get RAG context |
list_models() |
List available AI models |
Core Search API
| Method | Description |
|---|---|
core_search(query, **options) |
Full-featured search |
batch_search(queries, **options) |
Search multiple queries |
list_engines() |
List search engines |
RAG API
| Method | Description |
|---|---|
rag_research(topic, **options) |
Deep RAG research |
rag_search(query, **options) |
Quick RAG search |
semantic_search(corpus_id, query) |
Semantic search over corpus |
image_search(query) |
Image search |
list_corpora() |
List research corpora |
Neural API (Exa-compatible)
| Method | Description |
|---|---|
neural_search(query, **options) |
Neural/semantic search |
find_similar(url=None, text=None) |
Find similar content |
extract_highlights(query, content) |
Extract key highlights |
predictive_search(context) |
Predict next search |
Topic Monitoring API
| Method | Description |
|---|---|
create_monitor(topic, **options) |
Create topic monitor |
list_monitors() |
List all monitors |
get_monitor(monitor_id) |
Get a monitor |
pause_monitor(monitor_id) |
Pause a monitor |
resume_monitor(monitor_id) |
Resume a monitor |
delete_monitor(monitor_id) |
Delete a monitor |
get_monitor_results(monitor_id) |
Get monitor results |
Enhanced API (Advanced scraping)
| Method | Description |
|---|---|
enhanced_search(query, **options) |
Advanced search with extraction |
enhanced_scrape(urls, **options) |
Direct URL scraping |
enhanced_features() |
List enhanced features |
extract_tables(html_content) |
Extract tables from HTML |
chunk_content(text, strategy) |
Chunk text for RAG |
discover_urls(base_url, source) |
Discover URLs from sitemaps |
Knowledge Graph API
| Method | Description |
|---|---|
knowledge_extract(text) |
Extract entities & relationships |
knowledge_search(query) |
Search knowledge graph |
knowledge_people(query) |
Search for people |
knowledge_get_entity(entity_id) |
Get specific entity |
knowledge_graph() |
Get graph structure |
Agent Registration API
| Method | Description |
|---|---|
register_agent(name) |
Register new AI agent (sandbox) |
agent_status() |
Get agent status |
resend_claim() |
Resend claim link |
Verification API (Fact-checking)
| Method | Description |
|---|---|
verify_claim(claim, **options) |
Verify a claim |
check_source_credibility(url) |
Check source credibility |
batch_verify(claims) |
Batch verify claims |
Extended Examples
Deep Research
# Multi-step research with AI synthesis
research = client.research(
query="Impact of AI on healthcare",
depth="deep", # quick, standard, deep, comprehensive
max_sources=20,
include_analysis=True,
focus_areas=["diagnostics", "drug discovery"]
)
print(research.executive_summary)
print(research.key_findings)
Neural Search (Exa-compatible)
# Semantic search with auto-prompting
results = client.neural_search(
query="innovations in renewable energy",
num_results=10,
use_autoprompt=True, # AI expands query
include_highlights=True,
category="tech"
)
print("Expanded queries:", results.expanded_queries)
for r in results.results:
print(r.title, r.highlights)
Topic Monitoring
# Create a real-time monitor
monitor = client.create_monitor(
topic="artificial intelligence regulations",
keywords=["AI", "regulation", "EU"],
check_interval_minutes=60,
webhook_url="https://your-app.com/webhook",
deep_analysis=True
)
# Get results
results = client.get_monitor_results(monitor["id"], limit=50)
Fact Verification
# Verify a claim
verification = client.verify_claim(
claim="The Earth is approximately 4.5 billion years old",
depth="thorough"
)
print(f"Verdict: {verification.verdict}")
print(f"Confidence: {verification.confidence}%")
print(f"Summary: {verification.summary}")
# Check source credibility
credibility = client.check_source_credibility("https://example-news.com")
print(f"Score: {credibility.credibility_score}")
print(f"Bias: {credibility.bias_rating}")
Why UnSearch over Tavily?
| Feature | Tavily | UnSearch |
|---|---|---|
| Open Source | ❌ | ✅ |
| Self-Hostable | ❌ | ✅ |
| Zero Retention | ❌ | ✅ |
| Cost at Scale | ~$0.0075/query | $0.0003/query |
| Free Tier | 1,000/mo | 5,000/mo |
| Search Engines | Single | 70+ |
| Neural Search | ❌ | ✅ |
| Topic Monitoring | ❌ | ✅ |
| Fact Verification | ❌ | ✅ |
License
Apache 2.0
Metadata
Release files for unsearch 0.2.1
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 | |
|---|---|---|---|---|
| unsearch-0.2.1.tar.gz | 19.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| unsearch-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.1 kB
Release files / unsearch-0.2.1.tar.gz
| Download URL | unsearch-0.2.1.tar.gz |
|---|---|
| Size | 19.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4751e14cc4075811ea7b7d05787965071ae6dc86bbd83b1fd5dea1e7de3ca735
|
|
BLAKE2b-256 checksum How to use checksums |
00c522b333087769573970ee3699d635793326ed8f8ea389c3e79d9d26007f28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / unsearch-0.2.1-py3-none-any.whl
| Download URL | unsearch-0.2.1-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cafc68ff4cbfa1ecf102866469365e06ff9bd5d57ab18636ad6491098cba7dc2
|
|
BLAKE2b-256 checksum How to use checksums |
90f7379c6e92b70e9e5cc894362451f8db767ccc9621ca5f0ffedfb295ab0763
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for unsearch 0.2.1
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.