Smart error analysis tool with AI-powered solutions
Project description
AI LogMaster
Smart error analysis tool with AI-powered solutions
Wrap any command and get instant, intelligent debugging help powered by AI and documentation retrieval.
Features
- ๐ค AI-Powered Analysis - Uses LangChain and LLMs for intelligent error diagnosis
- ๐ Smart Documentation Retrieval - Automatically fetches relevant docs when needed
- ๐ฐ API Quota Optimization - Intelligent agent minimizes API calls (70-80% reduction)
- โก Zero Setup - Just wrap your command and go
- ๐ง Multi-Provider Support - Works with OpenAI, Anthropic, Google, NVIDIA, and more
- ๐ฏ Pattern-Based Caching - Common errors use cached solutions (no API calls)
Installation
pip install ai-logmaster
Quick Start
1. Initialize Configuration
logmaster init
This creates ~/.ai-logmaster/config.yaml. Edit it to set your API key:
ai:
provider: "nvidia"
api_key: "your-api-key-here"
Or use environment variable:
export NVIDIA_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
- โ Show solutions with documentation references
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] Fetching documentation from web...
[AGENT] โ Fetched 989 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 โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ ๐ DOCUMENTATION SOURCES โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โข https://docs.python.org/3/library/exceptions.html โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Configuration
AI Providers
Edit ~/.ai-logmaster/config.yaml:
NVIDIA (Default - Free Tier Available)
ai:
provider: "nvidia"
model: "mistralai/mistral-small-3.1-24b-instruct-2503"
api_key: "${NVIDIA_API_KEY}"
base_url: "https://integrate.api.nvidia.com/v1"
OpenAI
ai:
provider: "openai"
model: "gpt-4"
api_key: "${OPENAI_API_KEY}"
Anthropic
ai:
provider: "anthropic"
model: "claude-3-opus-20240229"
api_key: "${ANTHROPIC_API_KEY}"
ai:
provider: "google"
model: "gemini-pro"
api_key: "${GOOGLE_API_KEY}"
Agent Optimization
Control when AI is used to minimize API costs:
agent:
use_cached_solutions: true # Use cached solutions for common errors
fetch_documentation: true # Fetch docs from web
# These errors use cached solutions (0 API calls)
cached_error_types:
- connection
- import
- memory
- timeout
- permission
# These errors use AI + docs (1 API call each)
complex_error_types:
- syntax
- type
- value
- unknown
Quota Management
quota:
enabled: true
daily_limit: 100 # Maximum API calls per day
warn_threshold: 0.8 # Warn at 80%
How It Works
Smart Agent Flow
Error Detected
โ
Classify Error (Pattern Matching - FREE)
โ
โโโ Common Error? โ Use Cached Solution (0 API calls)
โ
โโโ Complex/Unknown? โ Fetch Docs (FREE) โ AI Analysis (1 API call)
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
Advanced Features
RAG Support (Optional)
Install with RAG capabilities for enhanced documentation retrieval:
pip install ai-logmaster[rag]
Enable in config:
rag:
enabled: true
vector_store: "faiss"
chunk_size: 1000
top_k: 3
Development
Install from Source
git clone https://github.com/Divodude/ai-logmaster.git
cd ai-logmaster
pip install -e .
Run Tests
python run_agent_tests.py
Requirements
- Python 3.8+
- API key for your chosen AI provider (NVIDIA, OpenAI, Anthropic, or Google)
License
MIT License - see LICENSE file for details.
Contributing
Contributions welcome! Please open an issue or PR.
Support
- ๐ง Email: ry604492@gmail.com
- ๐ Issues: https://github.com/Divodude/ai-logmaster/issues
- ๐ Docs: https://github.com/Divodude/ai-logmaster
Acknowledgments
Built with:
- LangChain - LLM framework
- LangGraph - Agent orchestration
- DuckDuckGo Search - Documentation retrieval
Made with โค๏ธ by Divyansh
Project details
Release history Release notifications | RSS feed
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.0.0.tar.gz.
File metadata
- Download URL: ai_logmaster-1.0.0.tar.gz
- Upload date:
- Size: 18.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5426c1123edcac4fd96d6851937cf4dd52e6f1b47938d8868bea498611573e78
|
|
| MD5 |
40a8e696030bb95bc58916a69b996fbe
|
|
| BLAKE2b-256 |
1a53b46dffb03e0f4a2269007e73b476a73b86df2ce891533789749c2094ff1c
|
File details
Details for the file ai_logmaster-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ai_logmaster-1.0.0-py3-none-any.whl
- Upload date:
- Size: 18.9 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 |
4acd08b3210a83c2716dcd60633a669d0b4bc1f4018d215c5ae7022409d0f7af
|
|
| MD5 |
254bf5f869415ba0317f6988dac67f43
|
|
| BLAKE2b-256 |
7250c5becd4f76f88366a2f0a14bf3c47c09725ec8df68e1f43eab8942446c03
|