Skip to content

Repository files navigation

QuerySynth — Hybrid AI+RAG Assistant (Tkinter Desktop)

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.

🚀 Features

  • 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

🖼️ Demo

  • Demo Screenshot

📦 Installation

  1. Clone the repository:

    git clone https://github.com/YOUR_USERNAME/querysynth.git
    cd querysynth
  2. Install dependencies (Python 3.8+ recommended):

    pip install -r requirements.txt
  3. Install Ollama for LLM local chat:

  4. Configure API keys (see below):

🔑 API Key Setup

To use all features, API keys are required for several external services.

One Time Setup:

  1. Copy the example config file:
    cp config.example.json config.json
  2. 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.

⚡️ How to Use the Frontend

  1. Start Ollama server:
    (ensure a supported model like llama2 or mistral is downloaded in Ollama)

    ollama serve
  2. Launch QuerySynth:

    python ai_cnv.py
  3. 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.
  4. Conversation history is saved in conversation_history.json (auto-managed).

📚 Technologies & Sources

  • 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

🛠️ Requirements

  • Python 3.8+
  • Dependencies from requirements.txt (see file for details).
    • E.g.: nltk, requests, markdown2, tkhtmlview, pygame, pillow, yt-dlp, beautifulsoup4, StackAPI, etc.

Install all requirements via:

pip install -r requirements.txt

🙋 FAQ/Troubleshooting

  • 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.
  • 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.json in your project directory.
  • How do I reset/clear chat?

    • Click the "🔄 Refresh Chat" button.

📝 License

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.

About

A desktop AI assistant that combines local LLM chat (Ollama) with retrieval-augmented answers from live web sources, code, images, and more — all via a smart Tkinter GUI. Works both online and offline for research, coding, and factual Q&A.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages