GPTQuery – Modular Tool Framework
GPTQuery is a modular Python framework for building, orchestrating, and deploying AI-powered tools across domains. It provides a clear, scalable architecture for integrating multiple AI providers (OpenAI, Perplexity, Claude, etc.) while maintaining robust error handling, throttling, and dynamic prompting.
📋 Project Description
The goal of this project is for researchers (or anyone) to create AI-powered tools using custom prompts that can be easily integrated into reserach pipelines. In theory, you can equally use the libraries provided by openai, anthropic, or perplexity. However, the adavantages of this framework is that it handles throttling, logging and task specific post-processing. That is, when you create a tool following the proposed tool architecture you ensure robustness and transparency for sharing you specific tool\prompt with other researchers in a reliable way.
🏗️ Architecture Overview
GPTQuery is organized into three main layers:
-
Core Infrastructure (
core/)- Clients, logging, and utilities.
-
Processing Utilities (
processing/)- Helpers for throttling, token management, and miscellaneous runtime functions.
-
Task-Specific Tools (
tools/)- Each tool lives in its own namespace (e.g.,
tool_name). - Tools are subdivided into submodules/steps:
task.py→ user-facing functions (run_*)prompt.py→ AI prompt definitionslog.py→ logging utilities
- The tool’s
__init__.pyexposes the main public API.
- Each tool lives in its own namespace (e.g.,
Example: A generic AI tool (tool_example)
tool_example/
├── step_one/
│ ├── task.py # run_step_one
│ ├── prompt.py
│ └── log.py
├── step_two/
│ ├── task.py # run_step_two
│ ├── prompt.py
│ └── log.py
└── init.py # exposes run_step_one, run_step_two
🚀 Features
- Multi-Provider Support: Unified interface for OpenAI, Perplexity, Claude, and other AI APIs.
- Modular Tool Design: Organize AI functionality into independent, reusable tool families.
- Task Step Separation: Each tool can have multiple steps or functional modules.
- Smart Defaults: Automatically selects optimal models or parameters per provider.
- Safe Data Operations: Uses
@requires_columnsfor safe DataFrame operations. - Advanced Throttling: Token bucket and adaptive rate-limiters for API management.
- Robust Error Handling: Preserves partial results and gracefully handles failures.
- Cost Optimization: Integrates token management to reduce API costs.
🛠️ Installation
Option 1: Install from PyPI (recommended) Install the latest stable release directly from PyPI using pip:
pip install gptquerytools
Option 2: Clone the repository (for development and custom tools) If you want to contribute or build custom tools based on GPTQuery, clone the repo and install dependencies:
# 1. Clone the repo:
git clone https://github.com/mauriciomm7/gptquery.git
cd gptquery
# 2. Install dependencies:
pip install -r requirements.txt
🎓 Citation
If you use this framework in academic research, please cite:
Mandujano Manríquez, M. (2025). GPTQuery: Modular framework for building and orchestrating AI-powered research tools. GitHub: https://github.com/mauriciomm7/gptquery
@misc{mandujano2025gptquery,
author = {Mauricio Mandujano Manríquez},
title = {GPTQuery: Modular framework for building and orchestrating AI-powered research tools},
year = {2025},
howpublished = {\url{https://github.com/mauriciomm7/gptquery}},
note = {GitHub repository}
}
🤝 Contrubuting
To integrate your tool into GPTQuery, please:
-
Place your tool inside the
tools/directory following the existing modular structure. -
Organize your tool with submodules for each step or feature, including:
task.pyfor core functionality.prompt.pyfor AI prompts.log.pyfor logging.
-
Expose your tool’s API in its
__init__.py. -
Write tests and update documentation as needed.
-
Submit a pull request with clear explanations of your additions.
Thank you for contributing to GPTQuery!
🙏 Acknowledgments
- CI/CD automation using GitHub Actions — Automating build, test, and deployment workflows
- tokencost — Token cost estimation for language models
- tiktoken — Tokenization library used for accurate token counts
- IPython — Interactive computing environment and enhanced Python shell
📄 License
This project is licensed under the MIT License.
✅ TODO
- ADD GPTVisionClient that handles files.
- ADD Example of GPTVisionClient.
- ADD COL paramters to facing api such that it renames columns and never breaks contract?
- DOCS - UPDATE the codeblocks aesthetics, better spacing.
- DOCS - ADD copy-paste to codeblocks.
- UPDATE logger to make column naming easier.
Useful commands:
# Build Docs
mkdocs build
mkdocs serve
# Build Package
rm -rf dist build *.egg-info
python -m build
twine upload dist/*
Metadata
Release files for gptquerytools 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gptquerytools-0.0.3.tar.gz | 61.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gptquerytools-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 148.2 kB
Release files / gptquerytools-0.0.3.tar.gz
| Download URL | gptquerytools-0.0.3.tar.gz |
|---|---|
| Size | 61.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd17d91fb7e2373cd28767a5a7d13ff0be10ea35835e6306d0a23d9e1c01c9f4
|
|
BLAKE2b-256 checksum How to use checksums |
654a3c9960d158c735d27c4c199c536a073a67e54ef9a42ea535cae2e133f630
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Release files / gptquerytools-0.0.3-py3-none-any.whl
| Download URL | gptquerytools-0.0.3-py3-none-any.whl |
|---|---|
| Size | 87.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9e68eb3605be564fa69737e2aa9a7e7f569f5dd32f5b5a95fab8e841c27ea9e5
|
|
BLAKE2b-256 checksum How to use checksums |
072e4f1acef8b81dcb25eaffe1e2127f056399c925e5e10a3ecb5bcee969bbf8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|