AI LogMaster
Smart error analysis tool with AI-powered solutions and dynamic documentation retrieval
Wrap any command and get instant, intelligent debugging help powered by AI, dynamic documentation fetching, and pattern-based caching.
โจ Features
- ๐ค AI-Powered Analysis - Uses LangChain and LLMs for intelligent error diagnosis
- ๐๏ธ Visual Config Dashboard - Beautiful web UI to configure everything โ no file editing!
- โก Test Connection - Validate your API key and model before you start
- ๐ Dynamic Documentation Retrieval - Automatically fetches relevant docs based on actual errors
- ๐ฏ Smart Library Detection - Identifies 20+ frameworks/libraries automatically
- ๐ฐ API Quota Optimization - Intelligent agent minimizes API calls (70-80% reduction)
- ๐ง Multi-Provider Support - Works with Groq, OpenAI, Anthropic, Google, NVIDIA
- ๐จ Class-Based Architecture - Clean, modular, and easily extensible
- โ๏ธ JSON Configuration - Customize error solutions and library keywords without code changes
๐ Installation
pip install ai-logmaster
Or install from source:
git clone https://github.com/Divodude/ai-logmaster.git
cd ai-logmaster
pip install -e .
๐ณ Docker
You can also run AI LogMaster in a container instead of installing it locally.
Build the image:
docker compose build
Set your API key (create a .env file in the project root โ this file is
git-ignored, never commit real keys):
GROQ_API_KEY=your-api-key-here
Run a command through logmaster:
docker compose run --rm logmaster run "python your_script.py"
Your current directory is mounted into the container at /workspace, so
logmaster can see and analyze your project's files.
๐ Quick Start
1. Initialize Configuration
logmaster init
This opens a beautiful configuration dashboard in your browser where you can:
- ๐ค Select your AI provider โ Groq, OpenAI, Anthropic, Google, or NVIDIA
- ๐ Enter your API key โ with show/hide toggle
- ๐งช Test Connection โ validates your key, model, and provider with a real API call
- ๐๏ธ Adjust temperature & max tokens โ with a live slider
- ๐ง Toggle agent features โ cached solutions, doc fetching, auto-fix
- ๐ Configure documentation search โ enable/disable web doc lookup
- ๐ Set output verbosity โ control what gets logged to your terminal
Click Save and you're done โ zero file editing required!
Note: You can also set your API key via environment variable:
export GROQ_API_KEY="your-api-key"
2. Run Your Command
logmaster run "python your_script.py"
That's it! The tool will:
- โ Execute your command
- โ Capture output in real-time
- โ Detect errors automatically
- โ Analyze with AI and dynamic documentation
- โ Show solutions with relevant fixes
3. Auto-Fix Mode
logmaster run "python your_script.py" --auto-fix
AI will attempt to automatically fix detected errors in your code!
๐ Example Output
[TRIAGE] Executing: python broken.py
============================================================
[ERROR] TypeError: unsupported operand type(s) for /: 'int' and 'str'
============================================================
[TRIAGE] โ ๏ธ Error detected! Analyzing...
[AGENT] Classifying error type...
[AGENT] Error type: type, Needs docs: True
[AGENT] Detected library: python
[AGENT] Fetching documentation from web...
[AGENT] โ Fetched 1847 chars of documentation
[AGENT] Analyzing with AI...
[AGENT] โ Analysis complete (API calls: 1)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ DIAGNOSIS โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ Type: TypeError โ
โ Confidence: 90% โ
โ Method: AI + Docs โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ ๐ ROOT CAUSE โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ Division operation between integer and string โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ ๐ก RECOMMENDED FIXES โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ 1. Ensure divisor is numeric type โ
โ 2. Convert string to int/float if needed โ
โ 3. Validate inputs before operations โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐๏ธ Architecture
AI LogMaster uses a clean, modular class-based architecture:
Core Components
ai_logmaster/
โโโ core/
โ โโโ classifier.py # ErrorClassifier - Pattern matching
โ โโโ doc_fetcher.py # DocumentationFetcher - Dynamic docs
โ โโโ llm_client.py # LLMClient - AI interactions
โ โโโ llm_manager.py # GlobalLLMManager - Provider routing
โ โโโ agent.py # Agent - LangGraph workflow
โ โโโ analyzer.py # ErrorAnalyzer - Main orchestrator
โ โโโ auto_fixer.py # AutoFixer - AI code fixes
โโโ config/
โ โโโ config.json # Default configuration
โ โโโ cached_solutions.json # Error patterns & solutions
โ โโโ library_keywords.json # Library detection keywords
โโโ dashboard/
โ โโโ server.py # Local HTTP server (stdlib)
โ โโโ index.html # Config dashboard UI
โ โโโ style.css # Dark-theme styling
โ โโโ script.js # Dashboard logic
โโโ cli.py # Command-line interface
โโโ __init__.py
How It Works
Error Detected
โ
ErrorClassifier (Pattern Matching - FREE)
โ
โโโ Common Error? โ Cached Solution (0 API calls) โ
โ
โโโ Complex Error? โ DocumentationFetcher (FREE)
โ
Detect Library (FastAPI, Django, etc.)
โ
Fetch Relevant Docs (DuckDuckGo)
โ
LLMClient Analysis (1 API call) ๐ฐ
โ๏ธ Configuration
Visual Dashboard (Recommended)
logmaster init
Opens a local web dashboard โ configure everything visually and test your connection before saving.
Supported AI Providers
| Provider | Models | Env Variable |
|---|---|---|
| Groq | llama-3.3-70b-versatile, mixtral-8x7b-32768 | GROQ_API_KEY |
| OpenAI | gpt-4o, gpt-4o-mini, gpt-3.5-turbo | OPENAI_API_KEY |
| Anthropic | claude-sonnet-4, claude-3-haiku | ANTHROPIC_API_KEY |
| gemini-2.5-flash, gemini-2.5-pro | GOOGLE_API_KEY |
|
| NVIDIA | meta/llama-3.1-405b-instruct | NVIDIA_API_KEY |
Manual Configuration
Config is stored at ~/.ai-logmaster/config.json:
{
"ai": {
"provider": "groq",
"model": "llama-3.3-70b-versatile",
"api_key": "your-api-key",
"temperature": 0.2,
"max_tokens": 1000
},
"agent": {
"use_cached_solutions": true,
"fetch_documentation": true,
"use_ai_analysis": true,
"auto_fix": true
},
"documentation": {
"enable_search": true,
"search_engine": "duckduckgo"
},
"output": {
"verbose": true,
"show_api_calls": true
}
}
Customizing Error Solutions
Edit ai_logmaster/config/cached_solutions.json to add or modify error patterns and solutions:
{
"error_patterns": {
"your_error": ["YourError", "your error message"]
},
"cached_solutions": {
"your_error": {
"type": "Your Error Type",
"cause": "Root cause explanation",
"fixes": ["Fix 1", "Fix 2", "Fix 3"],
"confidence": 0.80,
"method": "Cached"
}
}
}
Customizing Library Detection
Edit ai_logmaster/config/library_keywords.json to add new libraries:
{
"libraries": {
"your_library": {
"keywords": ["your_lib", "yourlib"],
"description": "Your library description"
}
}
}
Supported Libraries (20+): FastAPI, Django, Flask, Requests, NumPy, Pandas, TensorFlow, PyTorch, SQLAlchemy, Asyncio, LangChain, OpenAI, Scikit-learn, Matplotlib, Selenium, BeautifulSoup, Pytest, Pydantic, Celery, Redis
๐ป Programmatic Usage
Class-Based API
from ai_logmaster import ErrorAnalyzer
# Create analyzer
analyzer = ErrorAnalyzer()
# Analyze error
error_context = """
Traceback (most recent call last):
File "test.py", line 5, in <module>
result = 10 / "invalid"
TypeError: unsupported operand type(s) for /: 'int' and 'str'
"""
result = analyzer.analyze(error_context)
print(f"Type: {result['type']}")
print(f"Cause: {result['cause']}")
print(f"Fixes: {result['fixes']}")
print(f"API Calls: {result.get('api_calls_used', 0)}")
Using Individual Components
from ai_logmaster.core import ErrorClassifier, DocumentationFetcher
# Use classifier standalone
classifier = ErrorClassifier()
error_type, needs_docs = classifier.classify(context)
# Use doc fetcher standalone
doc_fetcher = DocumentationFetcher()
library = doc_fetcher.detect_library("from fastapi import FastAPI")
# Returns: "fastapi"
Backward Compatible API
from ai_logmaster import analyze_error
# Still works!
result = analyze_error(error_context)
๐ API Call Optimization
Without Agent: Every error = 1 API call
With Agent:
- Connection errors: 0 API calls โ
- Import errors: 0 API calls โ
- Memory errors: 0 API calls โ
- Timeout errors: 0 API calls โ
- Permission errors: 0 API calls โ
- Syntax errors: 1 API call ๐ฐ
- Type errors: 1 API call ๐ฐ
- Unknown errors: 1 API call ๐ฐ
Result: 70-80% reduction in API calls!
๐ฏ Usage Examples
Python Script
logmaster run "python app.py"
Node.js Application
logmaster run "node server.js"
Shell Script
logmaster run "bash deploy.sh"
Complex Command
logmaster run "npm run build && npm start"
With Custom Buffer Size
logmaster run "python script.py" --buffer 200
With Auto-Fix
logmaster run "python script.py" --auto-fix
๐งช Development
Install from Source
git clone https://github.com/Divodude/ai-logmaster.git
cd ai-logmaster
pip install -e ".[dev]"
Run Tests
# Run all unit tests
python -m unittest discover -s tests
๐ฆ Requirements
- Python 3.8+
- API key for your chosen AI provider (Groq, OpenAI, Anthropic, Google, or NVIDIA)
Dependencies
langchain>=1.0.0
langchain-community>=0.4.0
langchain-core>=1.2.0
langchain-openai>=1.0.0
langgraph>=1.0.0
duckduckgo-search>=8.0.0
python-dotenv>=1.0.0
pyyaml>=6.0
requests>=2.32.0
๐ค Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
๐ License
MIT License - see LICENSE file for details.
๐ฌ Support
- ๐ง Email: ry604492@gmail.com
- ๐ Issues: https://github.com/Divodude/ai-logmaster/issues
- ๐ Docs: https://github.com/Divodude/ai-logmaster
โ Buy Me a Coffee
If you find AI LogMaster helpful and want to support its development, consider buying me a coffee!
Every contribution, no matter how small, is greatly appreciated! ๐
๐ Acknowledgments
Built with:
- LangChain - LLM framework
- LangGraph - Agent orchestration
- DuckDuckGo Search - Documentation retrieval
๐ฏ What's New in v1.1.0
- ๐๏ธ Visual Config Dashboard โ
logmaster initnow opens a beautiful web UI in your browser - โก Test Connection โ validate your API key and model before saving
- ๐ค Auto Model Suggestions โ dropdown suggestions based on your selected provider
- ๐ API Key Visibility Toggle โ show/hide your key in the dashboard
- ๐๏ธ Temperature Slider โ fine-tune LLM creativity with a live slider
- ๐ง Agent Feature Toggles โ enable/disable cached solutions, doc fetch, auto-fix
- ๐ฆ Zero Extra Dependencies โ dashboard uses Python's built-in HTTP server
Previous: v1.0.1
- โ Class-Based Architecture
- โ Dynamic Documentation Fetching
- โ JSON Configuration
- โ 20+ Library Detection
- โ Auto-Fix Support
Made with โค๏ธ by Divyansh
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_logmaster-1.3.0.tar.gz.
File metadata
- Download URL: ai_logmaster-1.3.0.tar.gz
- Upload date:
- Size: 50.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07aa3379ef3c7b05a2449d3542a08abcb9f402e71c97d68f4432cda38638e825
|
|
| MD5 |
99f54bc3cd89b6fa2a6d3e156d552cdf
|
|
| BLAKE2b-256 |
7f3d67bcb1325c51931f7a4175413cdf78f2918aa822c4c5ea261f4b97726c45
|
File details
Details for the file ai_logmaster-1.3.0-py3-none-any.whl.
File metadata
- Download URL: ai_logmaster-1.3.0-py3-none-any.whl
- Upload date:
- Size: 51.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6310b8fbc5617dc6ddaa78bda1051762c6800d195d3dc60b1f5fbcba9564e4ca
|
|
| MD5 |
e956cb5d9f80ab364ba7a603905ebf7e
|
|
| BLAKE2b-256 |
40aee997256c220c53d8daa704d2a952bc4058a0f743cba1bcbf7bf4c8c53ef4
|