f3fe13c60e18c59b366f6d7f3b758f26a214ab11
- Flask web app with Perplexity-style search + synthesis pipeline - Degoog → SearXNG → DuckDuckGo cascading search backends - Gemini LLM for query expansion + answer synthesis with citations - MCP server exposing search tools via stdio - 57 unit tests covering all modules
🔮 Sibilla
L'oracolo AI che cerca nel web e risponde alle tue domande. Self-hosted Perplexity-like search engine.
Sibilla è un motore di ricerca AI self-hosted che combina:
- 🧠 Google Gemini — LLM per sintesi e query expansion
- 🔍 Degoog — metasearch engine self-hosted (primary) con MCP nativo
- 🔄 SearXNG + DuckDuckGo — fallback a cascata se Degoog non risponde
- 🔧 MCP (Model Context Protocol) — server stdio per agent AI esterni
- 🖥️ Flask web app — interfaccia pulita e reattiva
Tu chiedi → Query expansion → Degoog search → Fetch pagine → Gemini sintesi → Risposta con fonti
Architettura
sibilla/
├── src/sibilla/
│ ├── app.py # Flask app factory + pipeline /api/ask
│ ├── cli.py # Entry point server web
│ ├── search.py # DegoogClient, SearXNGClient, DuckDuckGoClient, PageFetcher
│ ├── ai.py # GeminiClient (sintesi + query rewriting)
│ ├── mcp.py # MCP server su stdio (per agent AI esterni)
│ └── prompts.py # System prompt stile Perplexity
├── templates/
│ └── index.html # Interfaccia di ricerca
├── static/
│ ├── style.css # Stili dark theme
│ └── app.js # Logica frontend
└── tests/
Pipeline di ricerca
POST /api/ask {query: "..."}
│
├─ 1. Gemini riscrive la query in 3 varianti (query expansion)
├─ 2. Multi-query search: Degoog → SearXNG → DuckDuckGo (cascading)
├─ 3. PageFetcher scarica il contenuto completo delle top pagine
├─ 4. Prompt assembly con fonti numerate
├─ 5. Gemini sintesi con citazioni [1], [2], ...
└─ 6. JSON {answer, sources[], model, search_engine, tokens_used}
Setup
cd sibilla
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
Prerequisiti
- Google API Key — https://aistudio.google.com/apikey
- Degoog (consigliato) — motore di ricerca primary:
docker run -d --name degoog -p 4444:4444 ghcr.io/degoog-org/degoog:latest - SearXNG (opzionale, fallback) — se vuoi un secondo motore di backup:
docker run -d -p 8080:8080 searxng/searxng
Crea un file .env:
GOOGLE_API_KEY=la-tua-api-key
DEGOOG_URL=http://localhost:4444
Senza Degoog, Sibilla userà automaticamente SearXNG e DuckDuckGo come fallback.
Uso
# Avvia la web app
sibilla
# → http://127.0.0.1:5000
# Avvia il server MCP (per agent AI esterni)
sibilla-mcp
Sviluppo
pip install -e ".[dev,mcp]"
ruff check src tests
pytest
Licenza
MIT
Description
Self-hosted Perplexity-like AI search engine with Gemini + Degoog/SearXNG + MCP, built with Flask
121 KiB
0 Stars
1 Watchers
0 Forks
Languages
Python
82.8%
CSS
10.9%
JavaScript
4.7%
HTML
1.6%