An Open Query Platform that lets you ask any question using voice or text and receive answers in text or cloned voice. It supports querying uploaded files (PDF, DOCX, XLSX, TXT, CSV, Markdown, code), live web search, and general knowledge, with Indian English speech synthesis and OpenVoice V2 voice cloning.
- Backend: Python, FastAPI, Uvicorn
- File Parsing: PyPDF2, python-docx, openpyxl
- Embeddings & Vector Search: sentence-transformers (
all-MiniLM-L6-v2), FAISS (IndexFlatIP) - Web Search: ddgs with Wikipedia Search API fallback
- LLM: Google Gemini (
gemini-3.6-flashwith fallback togemini-3.8-flash/gemini-3.5-flash-lite) - Speech-to-Text: faster-whisper (
base, CPUint8) - Text-to-Speech & Voice Cloning: MeloTTS (
EN_INDIA) + OpenVoice V2 (ToneColorConverter) - Frontend: HTML, CSS, JavaScript (Web Audio API 16 kHz WAV recording)
OpenQuery/
├── app/
│ ├── __init__.py
│ ├── main.py # FastAPI routes and request handling
│ ├── pdf_processor.py # Multi-format file text extraction and chunking
│ ├── vector_store.py # FAISS vector store and similarity search
│ ├── web_search.py # Web search and query mode routing
│ ├── qa_engine.py # Prompt building, Gemini calls, speech text cleanup
│ ├── voice_engine.py # STT, voice training, MeloTTS + OpenVoice V2 cloning
│ └── static/
│ └── index.html # Web UI
├── uploads/ # Uploaded files (in-memory index)
├── voices/ # Saved voice profiles and embeddings
├── audio_output/ # Temporary generated audio
├── setup.sh # Automated environment setup script (macOS/Linux)
├── requirements.txt
├── .env.example
└── README.md
- Python 3.10+ (tested on Python 3.13)
- Git
- A Google Gemini API key from https://aistudio.google.com/app/apikey
git clone https://github.com/yq-keys/OpenQuery.git
cd OpenQuery
chmod +x setup.sh
./setup.shThen open .env and add your API key:
GOOGLE_API_KEY=your-key-here
- Clone the repository and external voice repositories:
git clone https://github.com/yq-keys/OpenQuery.git
cd OpenQuery
git clone https://github.com/myshell-ai/OpenVoice.git
git clone https://github.com/myshell-ai/MeloTTS.git- Create a virtual environment and install dependencies:
macOS / Linux:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtWindows (PowerShell):
python -m venv venv
.\venv\Scripts\Activate.ps1
pip install -r requirements.txt- Configure your Gemini API key:
cp .env.example .envEdit .env and set:
GOOGLE_API_KEY=your-key-here
uvicorn app.main:app --reload --port 8000Open http://localhost:8000 in your browser.
Notes:
- On first speech generation or voice training, OpenVoice V2 (
myshell-ai/OpenVoiceV2), MeloTTS,faster-whisper, and Silero VAD models download automatically. An internet connection is required for the first run. - You can ask questions right away without uploading files, or upload
.pdf,.docx,.xlsx,.txt,.md,.csv,.json, or code files in the sidebar. - Use Mode (
Auto,Always Files + Web,Web Search Only,Uploaded Files Only) in the header to control where answers are sourced from. - Upload one or more 10–30 second audio clips under Voice Profiles to train or expand a custom voice profile.
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Serves the web UI |
| POST | /upload |
Upload and index a supported document or file |
| POST | /ask |
Ask a question (files, web search, or both) with optional voice output |
| POST | /transcribe |
Transcribe microphone audio to text |
| POST | /ask/voice |
Voice-in, Q&A, and voice-out in one request |
| POST | /voices/train |
Train or add clips to a voice profile |
| GET | /voices |
List trained voice profiles |
| DELETE | /voices/{name} |
Delete a voice profile |
| GET | /status |
List uploaded files and chunk count |
| DELETE | /reset |
Clear uploaded files and reset the vector store |