Personal · AI search · 2025Prototype
AI answer engine
A Perplexity-style answer engine: a FastAPI server searches the web, ranks pages against the question and streams a cited answer to a Flutter app over a WebSocket.
- Flutter app sends the query
- Tavily search + full text
- Rank pages by embedding similarity
- Sources sent first
- Gemini answer streamed, citing Source N
How it works
Tavily returns up to ten results, and trafilatura pulls the full text of each page. A small sentence-embedding model scores every page against the question and keeps the close ones. Gemini gets the best excerpts labelled Source 1, Source 2 and so on, and its answer streams back word by word, with the sources sent first so the app can show them straight away.
What I'd fix
Rereading it, the ranking step has an indentation bug that throws away every page with content, so the answer currently relies on the raw search order. It's a one-line fix, and it's the first test I'd write.
Next
Fix the ranking bug, add an example environment file, make the server address configurable and deploy the server.