FLAMEHAVEN FileSearch - Open source semantic document search powered by Google Gemini
Project description
๐ฅ FLAMEHAVEN FileSearch
Open-source semantic document search you can self-host in minutes.
The lightweight RAG stack that makes your documents searchable in minutes
Quick Start โข Features โข Documentation โข API Reference โข Examples
๐ฏ Why Flamehaven?
โก FastFrom zero to production in under 5 minutes. No complex infrastructure. |
๐ Private100% self-hosted. Your data never leaves your servers. |
๐ฐ AffordableLeverages Gemini's generous free tier. Process thousands of docs free. |
๐ Comparison with Alternatives
| Feature | Flamehaven | Pinecone | Weaviate | Custom RAG |
|---|---|---|---|---|
| Setup Time | < 5 min | ~20 min | ~30 min | Days |
| Self-Hosted | โ | โ | โ | โ |
| Free Tier | Generous | Limited | Yes | N/A |
| Code Complexity | Low | Medium | High | Very High |
| Maintenance | Minimal | None | Medium | High |
| Best For | Quick POCs, SMBs | Enterprise scale | ML teams | Full control |
โจ Features
| Feature | Description |
|---|---|
| ๐ Multi-Format | PDF, DOCX, TXT, MD files up to 50MB |
| ๐ Semantic Search | Natural language queries with AI-powered answers |
| ๐ Source Citations | Every answer links back to source documents |
| ๐๏ธ Store Management | Organize documents into separate collections |
| ๐ Dual Interface | Python SDK + REST API with Swagger UI |
| ๐ณ Docker Ready | One-command deployment with persistence |
๐ New in v1.1.0 (Production-Ready)
| Feature | Description | Impact |
|---|---|---|
| โก LRU Caching | 1-hour TTL, 1000 items | 99% faster on cache hits (<10ms) |
| ๐ก๏ธ Rate Limiting | Per-endpoint limits | 10/min uploads, 100/min searches |
| ๐ Prometheus Metrics | 17 metrics exported | Real-time monitoring & alerting |
| ๐ Security Headers | OWASP-compliant | CSP, HSTS, X-Frame-Options |
| ๐ JSON Logging | Structured logs | ELK/Splunk compatible |
| ๐ฏ Request Tracing | X-Request-ID headers | Distributed tracing support |
v1.1.0 Highlights: 40-60% cost reduction โข Zero critical vulnerabilities โข SIDRCE Certified (0.94) โ Full Changelog
โก Quick Start
1๏ธโฃ Install
pip install flamehaven-filesearch[api] # ~30 seconds
2๏ธโฃ Set API Key
export GEMINI_API_KEY="your-google-gemini-key"
๐ก Get your free key at Google AI Studio (2 min signup)
3๏ธโฃ Start Searching
Option A: Python SDK
from flamehaven_filesearch import FlamehavenFileSearch
fs = FlamehavenFileSearch()
fs.upload_file("company-handbook.pdf")
result = fs.search("What is our vacation policy?")
print(result["answer"])
# Expected: "Employees receive 15 days of paid vacation annually..."
print(f"๐ Sources: {result['sources'][0]['filename']}, page {result['sources'][0]['page']}")
Option B: REST API
# Start server
flamehaven-api
# Upload (in new terminal)
curl -X POST "http://localhost:8000/upload" -F "file=@handbook.pdf"
# Search
curl "http://localhost:8000/search?q=vacation+policy"
๐ Interactive Docs: Visit http://localhost:8000/docs
โ ๏ธ Troubleshooting:
ModuleNotFoundError: Runpip install -U pipfirst- API errors: Check your key has no spaces
- More solutions โ
๐ก Usage Examples
Organize Documents by Type
fs = FlamehavenFileSearch()
# Separate stores for different contexts
fs.create_store("hr-docs")
fs.create_store("engineering")
fs.upload_file("handbook.pdf", store="hr-docs")
fs.upload_file("api-spec.md", store="engineering")
# Search specific context
result = fs.search("PTO policy", store="hr-docs")
Batch Upload Directory
import glob
for pdf in glob.glob("./documents/*.pdf"):
print(f"๐ค {pdf}...")
fs.upload_file(pdf, store="company-docs")
โ๏ธ Configuration
Configure via environment variables or .env file:
| Variable | Default | Description |
|---|---|---|
GEMINI_API_KEY |
required | Your Google Gemini API key |
ENVIRONMENT |
production |
Logging mode: production (JSON) or development (readable) |
DATA_DIR |
./data |
Document storage location |
MAX_FILE_SIZE_MB |
50 |
Maximum file size (Gemini limit) |
MAX_SOURCES |
5 |
Number of source citations |
DEFAULT_MODEL |
gemini-2.5-flash |
Gemini model to use |
HOST |
0.0.0.0 |
API server host (v1.1.0+) |
PORT |
8000 |
API server port (v1.1.0+) |
WORKERS |
1 |
Number of workers (v1.1.0+) |
Example .env:
GEMINI_API_KEY=AIza...your-key-here
ENVIRONMENT=production # JSON logs for production
DATA_DIR=/var/flamehaven/data
MAX_SOURCES=3
WORKERS=4 # Production deployment
โ Complete configuration reference
๐ฆ Installation
Prerequisites
- Python 3.8 or higher
- Google Gemini API key (Get it free)
Install from PyPI
# Basic installation
pip install flamehaven-filesearch
# With API Server
pip install flamehaven-filesearch[api]
Development Setup
git clone https://github.com/flamehaven01/Flamehaven-Filesearch.git
cd Flamehaven-Filesearch
pip install -e .[dev,api]
pytest tests/
๐ณ Docker Deployment
Quick Start:
docker run -e GEMINI_API_KEY="your-key" \
-p 8000:8000 \
-v flamehaven-data:/app/data \
flamehaven/filesearch:latest
Docker Compose:
version: '3.8'
services:
flamehaven:
image: flamehaven/filesearch:latest
ports:
- "8000:8000"
environment:
- GEMINI_API_KEY=${GEMINI_API_KEY}
volumes:
- ./data:/app/data
restart: unless-stopped
โ Production deployment guide
๐ก API Reference
Core Endpoints
POST /upload
Upload a document to a store.
Request:
curl -X POST "http://localhost:8000/upload" \
-F "file=@report.pdf" \
-F "store=default"
Response:
{
"filename": "report.pdf",
"store": "default",
"file_id": "abc123...",
"status": "uploaded"
}
GET /search
Search documents with natural language.
Request:
curl "http://localhost:8000/search?q=vacation+policy&store=default&max_sources=3"
Response:
{
"answer": "Employees receive 15 days of paid vacation annually...",
"sources": [
{
"filename": "handbook.pdf",
"page": 42,
"excerpt": "Vacation Policy: All full-time employees..."
}
],
"query": "vacation policy",
"model": "gemini-2.5-flash"
}
GET /stores | DELETE /stores/{name}
Manage document stores.
GET /prometheus (v1.1.0+)
Prometheus metrics endpoint for monitoring.
Exported Metrics:
- HTTP requests, duration, active requests
- Upload/search counts, duration, results
- Cache hits/misses, size
- Rate limit exceeded events
- System metrics (CPU, memory, disk)
Setup Prometheus scraping:
scrape_configs:
- job_name: 'flamehaven'
static_configs:
- targets: ['localhost:8000']
metrics_path: /prometheus
GET /metrics (Enhanced in v1.1.0)
Service metrics with cache statistics.
Response:
{
"stores_count": 3,
"uptime_seconds": 3600,
"system": {"cpu_percent": 25.3, "memory_percent": 45.2},
"cache": {
"search_cache": {
"hits": 89,
"misses": 42,
"hit_rate_percent": 67.94,
"current_size": 127,
"max_size": 1000
}
}
}
Error Handling
All errors return:
{
"error": "Error message",
"code": "ERROR_CODE"
}
| Code | Status | Solution |
|---|---|---|
FILE_TOO_LARGE |
413 | Reduce file size or increase limit |
INVALID_API_KEY |
401 | Check your Gemini API key |
STORE_NOT_FOUND |
404 | Create store first |
RATE_LIMIT_EXCEEDED |
429 | Wait or upgrade API plan |
Python SDK
from flamehaven_filesearch import FlamehavenFileSearch
fs = FlamehavenFileSearch(
api_key="your-key", # Optional if env var set
data_dir="./data", # Custom storage
max_file_size_mb=100 # Override defaults
)
# API methods
fs.create_store(name)
fs.list_stores()
fs.delete_store(name)
fs.upload_file(path, store="default")
fs.search(query, store="default", max_sources=5)
โ Complete API documentation
๐๏ธ Architecture
โโโโโโโโโโโโโโโโ
โ Client โ
โ (SDK/REST) โ
โโโโโโโโฌโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FlamehavenFileSearch Core โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Document Processor โ โ
โ โ โ PDF/DOCX/TXT/MD parsing โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Google Gemini API โ โ
โ โ โ Embedding & Generation โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Store Manager โ โ
โ โ โ SQLite + File System โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Detailed architecture docs
๐ Performance
Test Environment: Ubuntu 22.04, 2 vCPU, 4GB RAM, SSD
| Operation | Time (v1.0.0) | Time (v1.1.0) | Improvement |
|---|---|---|---|
| Upload 10MB PDF | ~5s | ~5s | Same (no cache) |
| Search query (first) | ~2-3s | ~2-3s | Same (cache miss) |
| Search query (repeat) | ~2-3s | <10ms | 99% faster โก |
| Batch 3ร5MB | ~12s | ~12s | Same (sequential) |
v1.1.0 Caching Impact:
- Cache Hit Rate: 40-60% (typical usage)
- Response Time (P50): <100ms (down from 2-3s)
- API Cost Reduction: 40-60% fewer Gemini calls
- Throughput: ~100 cached searches/sec (vs ~10 non-cached)
Throughput: ~100 cached searches/sec โข ~10 API searches/sec โข ~2MB/s processing โ Detailed benchmarks
๐ Security
v1.1.0 Security Features
- โ
Path Traversal Protection: File upload sanitization with
os.path.basename() - โ Rate Limiting: Per-endpoint limits prevent abuse (10/min uploads, 100/min searches)
- โ OWASP Security Headers: CSP, HSTS, X-Frame-Options, X-Content-Type-Options
- โ Input Validation: XSS/SQL injection detection, filename sanitization
- โ Request Tracing: X-Request-ID headers for audit trails
- โ Zero Critical CVEs: Patched CVE-2024-47874, CVE-2025-54121 (Starlette)
Best Practices
- API Keys: Use environment variables, never commit to git
- Data Privacy: All documents stored locally in
DATA_DIR - Network: Run behind reverse proxy with SSL in production
- Encryption: Implement encryption at rest for sensitive docs
- Monitoring: Track
rate_limit_exceededanderrors_totalPrometheus metrics
โ Security guide โข Security audit results
โ Troubleshooting
Common issues:
| Problem | Solution |
|---|---|
ModuleNotFoundError |
pip install flamehaven-filesearch[api] |
| "API key invalid" | Verify key: echo $GEMINI_API_KEY |
| Slow uploads | Check file size, enable debug logs |
| Irrelevant results | Reduce max_sources, lower temperature |
Debug Mode:
export FLAMEHAVEN_DEBUG=1
flamehaven-api
โ Full troubleshooting guide
๐บ๏ธ Roadmap
v1.1.0 (Released 2025-11-13): โ Caching โข Rate limiting โข Security fixes โข Monitoring v1.2.0 (Q1 2025): Authentication โข Batch API โข WebSocket streaming v2.0.0 (Q2 2025): Multi-language โข Analytics โข Custom embeddings
Recent Releases:
- v1.1.0: Production-ready with caching, rate limiting, Prometheus metrics
- v1.0.0: Initial release with core file search capabilities
โ Full changelog โข Roadmap & voting
๐ค Contributing
We welcome contributions!
Quick start:
- Fork & clone the repo
- Install:
pip install -e .[dev,api] - Create branch:
git checkout -b feature/amazing - Add tests & commit changes
- Open Pull Request
โ Contributing guidelines โข Good first issues
๐ Resources
Documentation
- Wiki - Guides, recipes, best practices
- API Docs - Interactive Swagger UI
- Examples - Code samples & use cases
Community
- Discussions - Q&A and ideas
- Issues - Bug reports & features
Contact
- Email: info@flamehaven.space
- Website: www.flamehaven.space
๐ Acknowledgments
Built with: FastAPI โข Google Gemini API โข PyPDF2 โข python-docx
๐ License
MIT License - see LICENSE for details.
If Flamehaven helps you, please โญ the repo!
Made with โค๏ธ by the Flamehaven Team
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flamehaven_filesearch-1.1.0.tar.gz.
File metadata
- Download URL: flamehaven_filesearch-1.1.0.tar.gz
- Upload date:
- Size: 40.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e86223660a837d58c258aef775c6171bd49f68261833897104dabd6143c34e53
|
|
| MD5 |
4f4977ec49a0d79ac1f72af7de028a9c
|
|
| BLAKE2b-256 |
94ee4b01a22452b548add372705e2c3aa1109e975e8023038164750f62aa1245
|
Provenance
The following attestation bundles were made for flamehaven_filesearch-1.1.0.tar.gz:
Publisher:
publish.yml on flamehaven01/Flamehaven-Filesearch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flamehaven_filesearch-1.1.0.tar.gz -
Subject digest:
e86223660a837d58c258aef775c6171bd49f68261833897104dabd6143c34e53 - Sigstore transparency entry: 699554203
- Sigstore integration time:
-
Permalink:
flamehaven01/Flamehaven-Filesearch@b050a0d693725c9d0cd654cb2ac22c627b0907e1 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/flamehaven01
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b050a0d693725c9d0cd654cb2ac22c627b0907e1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file flamehaven_filesearch-1.1.0-py3-none-any.whl.
File metadata
- Download URL: flamehaven_filesearch-1.1.0-py3-none-any.whl
- Upload date:
- Size: 40.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6b19c1829a45dfee5f0cca81edde7baa5daa7a8813c11cb8492b68d4479a6a6
|
|
| MD5 |
791a639baf494290bc14dc4fea04411b
|
|
| BLAKE2b-256 |
47b739cb6bbaa27d8f2277c3eea5cfdf9c4b1e8edf88066d373356c94ea56a07
|
Provenance
The following attestation bundles were made for flamehaven_filesearch-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on flamehaven01/Flamehaven-Filesearch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flamehaven_filesearch-1.1.0-py3-none-any.whl -
Subject digest:
c6b19c1829a45dfee5f0cca81edde7baa5daa7a8813c11cb8492b68d4479a6a6 - Sigstore transparency entry: 699554206
- Sigstore integration time:
-
Permalink:
flamehaven01/Flamehaven-Filesearch@b050a0d693725c9d0cd654cb2ac22c627b0907e1 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/flamehaven01
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b050a0d693725c9d0cd654cb2ac22c627b0907e1 -
Trigger Event:
release
-
Statement type: