Semantic search and RAG for documents. Use when user needs to index PDF/DOCX/text files, perform semantic search, extract relevant content from document corpuses, or build RAG applications...
Invoke SEAR when the user wants to:
Convert PDF and DOCX files to LLM-optimized markdown:
# Basic conversion
sear convert document.pdf
# Custom output directory
sear convert report.docx --output-dir docs/
# OCR for scanned documents with language hints
sear convert scanned.pdf --force-ocr --lang heb+eng
# Keep original formatting (niqqud, etc.)
sear convert hebrew.pdf --no-normalize
Features:
Create searchable FAISS indices from text files:
# Basic indexing
sear index document.txt my_corpus
# With GPU acceleration (5-10x faster on large datasets)
sear index large_doc.txt production_corpus --gpu
# Check GPU availability
sear gpu-info
Index locations: faiss_indices/<corpus_name>/
Project Structure: SEAR uses a standard Python src-layout:
src/sear/ - Main package directorycli.py - CLI interfacecore.py - Core library functions__init__.py - Public API exportssrc/doc_converter/ - Document conversion moduletests/ - Test suiteexamples/ - Example codeSearch and get LLM-synthesized answers with citations:
# Basic search (uses local Ollama by default)
sear search "how does authentication work?" --corpus my_corpus
# With Anthropic Claude (higher quality)
export ANTHROPIC_API_KEY=sk-ant-xxx
sear search "explain the security model" --corpus my_corpus --provider anthropic
# Multi-corpus search
sear search "query" --corpus docs --corpus code --corpus wiki
Output: Synthesized answer with line-level citations: [corpus_name] file.txt:42-45
Retrieve relevant chunks without generation (pure retrieval):
# Extract matching chunks
sear extract "security vulnerabilities" --corpus codebase
# Adjust similarity threshold (default: 0.30)
sear extract "query" --corpus docs --min-score 0.40
# Limit results
sear extract "query" --corpus docs --top-k 5
Use case: When you need raw content for further processing, not LLM answers.
# Step 1: Convert PDF to markdown
sear convert research_paper.pdf
# Step 2: Index the converted markdown
sear index converted_md/research_paper.md research_corpus
# Step 3: Search with questions
sear search "what were the main findings?" --corpus research_corpus
# Index different sources
sear index documentation.txt docs_corpus
sear index codebase.txt code_corpus
sear index articles.txt articles_corpus
# Search across all corpuses
sear search "how to implement feature X?" \
--corpus docs_corpus \
--corpus code_corpus \
--corpus articles_corpus
# Extract relevant chunks for manual review
sear extract "security concerns" --corpus audit_corpus > security_findings.txt
# Use extracted content in further analysis
# (No LLM generation, just pure retrieval)
--no-gpu (CPU is faster)# Let SEAR decide automatically (recommended)
sear index large.txt corpus
# Force GPU
sear index large.txt corpus --gpu
# Force CPU
sear index large.txt corpus --no-gpu
SEAR uses empirical similarity thresholds (default: 0.30) to filter low-quality matches:
# Adjust threshold for stricter matching
sear search "query" --corpus docs --min-score 0.40
# Lower threshold for broader matching
sear search "query" --corpus docs --min-score 0.20
When results are insufficient (<2 matches), SEAR prompts for query refinement instead of generating answers from noise.
# Uses qwen2.5:0.5b by default
sear search "query" --corpus docs
# Fast (~5s), adequate quality, $0 cost
# Set API key
export ANTHROPIC_API_KEY=sk-ant-xxx
# Use Claude 3.5 Sonnet
sear search "query" --corpus docs --provider anthropic
# Better reasoning, structured output, ~10s, ~$0.01/query
# List all available corpuses
sear list
# Delete a corpus
sear delete corpus_name
Document Preparation:
sear convert before indexinggitingest or concatenate filesIndexing Strategy:
project_docs, codebase_v2)Search Quality:
GPU Usage:
--gpu on small datasetssear gpu-infoCost Optimization:
extract command when you don't need LLM synthesisDocuments (PDF/DOCX/TXT)
↓
[src/doc_converter] ← PDF/DOCX → Markdown (with OCR)
↓
Text Files
↓
[Embedding: all-minilm via Ollama] ← 384-dimensional vectors
↓
[FAISS Index] ← CPU or GPU acceleration
↓
[Query Embedding]
↓
[Similarity Search] ← Quality filtering (threshold: 0.30)
↓
Top-k Relevant Chunks
↓
[LLM Synthesis: Ollama/Anthropic] ← Optional (skip for extract)
↓
Answer + Line-Level Citations
vs AWS NOVA/Titan Embeddings:
vs Traditional RAG:
SEAR must be installed in the user's environment:
# Basic installation
pip install -e .
# With document conversion (PDF/DOCX)
pip install -e ".[converter]"
# With GPU support
pip install -e ".[gpu]"
# With Anthropic Claude
pip install -e ".[anthropic]"
# Install everything
pip install -e ".[all]"
# Install Ollama models
ollama pull all-minilm
ollama pull qwen2.5:0.5b
Issue: "ModuleNotFoundError: No module named 'doc_converter'"
Solution: Install converter dependencies: pip install -e ".[converter]"
Issue: GPU not detected
Solution: Check CUDA toolkit: sear gpu-info, install faiss-gpu if needed
Issue: Low-quality results
Solution: Adjust threshold: --min-score 0.40 or refine query
Issue: Slow search on small corpus
Solution: Use CPU mode: --no-gpu