QuerySynth is a local/online retrieval-augmented AI assistant (RAG) with a powerful Tkinter-based desktop frontend.
It combines chat from a local Large Language Model (LLM) (via Ollama) with live search and retrieval of facts, code, images, audio, translations, and more using real web APIs and knowledge sources.
- Hybrid Offline/Online Chat: Chat with a local LLM or answer with live data.
- Multiple Modes: "Chat", "Search", and "AI+RAG" (real-world grounded QA).
- Rich Natural Language Retrieval:
- Wikipedia summaries & articles
- News aggregation (NewsAPI, Guardian, GNews, NYTimes)
- Pexels image search
- YouTube audio download & playback
- StackExchange code and Q&A
- Government data, World Bank info
- Wolfram Alpha queries (math, science, stats)
- Weather lookups
- Code snippet/algorithm search
- Definitions, translation (multi-lingual), and more
- Tkinter GUI: Markdown rendering, clickable sources/links, image display, integrated audio player
- Automatic Conversation History
- One-click Chat Reset: "Refresh Chat" button for quick conversation reset
-
Clone the repository:
git clone https://github.com/YOUR_USERNAME/querysynth.git cd querysynth -
Install dependencies (Python 3.8+ recommended):
pip install -r requirements.txt
-
Install Ollama for LLM local chat:
- Download from ollama.com/download and install per your OS.
-
Configure API keys (see below):
To use all features, API keys are required for several external services.
One Time Setup:
- Copy the example config file:
cp config.example.json config.json
- Register for free developer keys using the following links, paste them into your
config.json:
| Key | Where to get/register |
|---|---|
news_api_key |
NewsAPI.org |
guardian_api_key |
The Guardian Open Platform |
pexels_api_key |
Pexels API |
gnews_api_key |
GNews API |
weather_api_key |
WeatherAPI.com |
wolfram_app_id |
Wolfram Alpha |
config.json should look like:
{
"news_api_key": "your_news_api_key_here",
"guardian_api_key": "your_guardian_api_key_here",
"pexels_api_key": "your_pexels_api_key_here",
"gnews_api_key": "your_gnews_api_key_here",
"weather_api_key": "your_weather_api_key_here",
"wolfram_app_id": "your_wolfram_app_id_here"
}Do NOT upload your filled-out config.json! Only share config.example.json.
-
Start Ollama server:
(ensure a supported model likellama2ormistralis downloaded in Ollama)ollama serve
-
Launch QuerySynth:
python ai_cnv.py
-
Interact via the GUI:
- Enter your question and press "Send" (or press
Enter). - Switch between Chat, Search, or AI+RAG (retrieval + LLM) modes.
- View sources, formatted answers, code, images, and audio in the right panel.
- Double-click any link to open in your web browser.
- Use the 🔄 Refresh Chat button any time to clear the chat/session.
- Enter your question and press "Send" (or press
-
Conversation history is saved in
conversation_history.json(auto-managed).
- Languages/Frameworks: Python 3.x, Tkinter
- NLP: NLTK
- LLM Backend: Ollama (local server)
- APIs: NewsAPI, Guardian, GNews, NYTimes, Pexels, WeatherAPI, WolframAlpha
- Data: Wikipedia, StackAPI, World Bank, Government open data, more
- Python Libraries: Pillow, pygame, requests, beautifulsoup4, markdown2, tkhtmlview, yt-dlp, StackAPI
- Python 3.8+
- Dependencies from
requirements.txt(see file for details).- E.g.:
nltk,requests,markdown2,tkhtmlview,pygame,pillow,yt-dlp,beautifulsoup4,StackAPI, etc.
- E.g.:
Install all requirements via:
pip install -r requirements.txt-
Nothing happens when I click Send?
- Ensure Ollama is running and a model is ready (
ollama list). - Check your API keys are set and valid.
- Ensure Ollama is running and a model is ready (
-
API error: invalid key?
- Make sure you copied each API key exactly and that your account is active.
-
Where is conversation history stored?
- All saved locally to
conversation_history.jsonin your project directory.
- All saved locally to
-
How do I reset/clear chat?
- Click the "🔄 Refresh Chat" button.
MIT License — Free for research, interviews, and educational use.
Always attribute sources if you reuse or redistribute this codebase.
Built and maintained with ❤️ for open AI tools and knowledge search.
