A newer version of the Gradio SDK is available:
6.1.0
metadata
title: ReasonaIQ
emoji: π¨
colorFrom: purple
colorTo: pink
sdk: gradio
sdk_version: 5.49.0
app_file: main.py
pinned: false
license: mit
short_description: Advanced AI Reasoning with Multiple Strategies
π¬ ReasonaIQ - Advanced AI Reasoning Research System
An open-source research platform that implements cutting-edge AI reasoning methodologies including Tree of Thoughts, Constitutional AI, and multi-agent debate patterns. Features a modern web interface, real-time streaming, and comprehensive analytics.
π― What This Project Does
- Multi-Strategy Reasoning: Apply different reasoning approaches to the same problem
- Self-Critique System: AI reviews and improves its own responses
- Real-time Analytics: Track reasoning depth, confidence, and performance metrics
- Export & Documentation: Save conversations as PDF, Markdown, or JSON
- Production Ready: Caching, rate limiting, error handling, and automatic backups
π Quick Start (2 Minutes)
Prerequisites
- Python 3.8+
- Groq API key (free at console.groq.com)
Installation
# Clone repository
git clone https://github.com/your-username/ai-reasoning-system.git
cd ai-reasoning-system
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Configure API key
echo "GROQ_API_KEY=your_key_here" > .env
# Launch system
python main.py
Open your browser to http://localhost:7860 and start exploring!
π Reasoning Strategies
| Method | Description | Best For |
|---|---|---|
| Tree of Thoughts | Explores multiple reasoning paths systematically | Complex problems with multiple solutions |
| Chain of Thought | Step-by-step transparent reasoning | Mathematical problems, logic puzzles |
| Self-Consistency | Generates multiple answers and finds consensus | Factual questions, reliability important |
| Reflexion | Self-critique and iterative improvement | Creative writing, analysis tasks |
| Multi-Agent Debate | Presents multiple perspectives | Ethical dilemmas, policy questions |
| Analogical Reasoning | Finds similar problems and adapts solutions | Novel problems, innovation tasks |
π₯ Demo Features
Real-time Interface
- Streaming Responses: Watch reasoning unfold in real-time
- Live Metrics: See inference time, tokens/second, reasoning depth
- Interactive Controls: Switch models, adjust temperature, enable critique
- Modern Design: Clean, responsive interface with dark theme
Analytics Dashboard
- Session performance metrics
- Model usage distribution
- Cache hit rates
- Error tracking and retry statistics
Export Options
- PDF: Professional reports with formatting
- Markdown: GitHub-friendly documentation
- JSON: Machine-readable data
- Plain Text: Simple conversation logs
π§ Configuration
Key settings in config.py:
MAX_HISTORY_LENGTH = 10 # Messages in context
CACHE_SIZE = 100 # Cached responses
RATE_LIMIT_REQUESTS = 50 # Per minute
DEFAULT_TEMPERATURE = 0.7 # Creativity level
MAX_TOKENS = 4000 # Response length
ποΈ Architecture
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Gradio UI β β Core Engine β β Groq API β
β β β β β β
β β’ Chat InterfaceβββββΊβ β’ Reasoning βββββΊβ β’ LLM Models β
β β’ Controls β β β’ Caching β β β’ Streaming β
β β’ Metrics β β β’ Rate Limiting β β β’ Token Count β
β β’ Export β β β’ Error Handlingβ β β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
π Performance
- Cold Start: ~2 seconds
- Time to First Token: 0.3β1.2 seconds
- Throughput: Up to 100 tokens/second
- Memory Usage: ~100MB base + conversation history
- Concurrent Users: Limited by Groq rate limits (50 req/min)
π§ͺ Example Use Cases
Research Analysis
User: "Analyze the impact of remote work on productivity"
System: Uses Tree of Thoughts to explore economic, psychological, and technological factors
Code Review
User: "Review this Python function for errors"
System: Applies Chain of Thought to identify bugs, suggest improvements
Creative Writing
User: "Write a story about AI consciousness"
System: Uses Reflexion to draft, critique, and refine the narrative
Decision Making
User: "Should we implement a four-day work week?"
System: Multi-Agent Debate presents management and employee perspectives
π Research Foundation
Built on seminal papers:
- Tree of Thoughts (Yao et al., 2023) β Systematic exploration
- Constitutional AI (Bai et al., 2022) β Self-critique mechanisms
- Chain of Thought (Wei et al., 2022) β Transparent reasoning
- Reflexion (Shinn et al., 2023) β Iterative improvement
- Self-Consistency (Wang et al., 2022) β Consensus building
π Project Structure
ai-reasoning-system/
βββ main.py # Gradio interface and event handlers
βββ core.py # Business logic and reasoning engine
βββ config.py # Configuration and constants
βββ requirements.txt # Dependencies
βββ README.md # Project documentation
βββ .env # API keys (created by user)
βββ exports/ # Exported conversations
βββ backups/ # Automatic backups
βββ reasoning_system.log # Application logs
π§ͺ Development
Running Tests
# Install test dependencies
pip install pytest pytest-cov
# Run tests
pytest tests/ -v --cov=core
Adding New Reasoning Mode
- Add enum value in
ReasoningMode - Add system prompt in
PromptEngine.SYSTEM_PROMPTS - Add reasoning template in
PromptEngine.REASONING_PROMPTS - Update UI choices in
main.py
Custom Models
Add to ModelConfig enum:
CUSTOM_MODEL = ("custom-model-id", parameters, context_length, "Description")
π§ Troubleshooting
| Issue | Solution |
|---|---|
| API Key Error | Check .env file format: GROQ_API_KEY=gsk_... |
| Rate Limit Hit | Wait 60 seconds or reduce request frequency |
| Memory Issues | Reduce MAX_CONVERSATION_STORAGE in config |
| PDF Export Fails | Install reportlab: pip install reportlab |
| Port Already in Use | Change port: python main.py --port 7861 |
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Academic Use
Perfect for:
- Final year projects
- Research demonstrations
- AI methodology studies
- Human-AI interaction experiments
Citation
@software{ai_reasoning_system_2025,
title = {ReasonaIQ - Advanced AI Reasoning Research System},
year = {2025},
url = {https://huggingface.co/spaces/Dhruv-18/ReasonaIQ}
}
π€ Contributing
- Fork the repository
- Create feature branch:
git checkout -b feature-name - Commit changes:
git commit -m "Add feature" - Push to branch:
git push origin feature-name - Submit Pull Request
π Support
- Create an issue for bugs or features
- Check existing issues before creating new ones
- Include system details and error logs
π Links
- HuggingFace Space: ReasonaIQ
- Configuration Reference: HuggingFace Spaces Config