Skip to main content

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.

PyPI version License: MIT Python 3.8+

โœจ 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:

  1. โœ… Execute your command
  2. โœ… Capture output in real-time
  3. โœ… Detect errors automatically
  4. โœ… Analyze with AI and dynamic documentation
  5. โœ… 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
Google 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:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿ’ฌ Support

โ˜• Buy Me a Coffee

If you find AI LogMaster helpful and want to support its development, consider buying me a coffee!

buymeacoffee.com/divodude

Every contribution, no matter how small, is greatly appreciated! ๐Ÿ™

๐Ÿ™ Acknowledgments

Built with:

๐ŸŽฏ What's New in v1.1.0

  • ๐ŸŽ›๏ธ Visual Config Dashboard โ€” logmaster init now 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

ai_logmaster-1.3.0.tar.gz (50.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_logmaster-1.3.0-py3-none-any.whl (51.5 kB view details)

Uploaded Python 3

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

Hashes for ai_logmaster-1.3.0.tar.gz
Algorithm Hash digest
SHA256 07aa3379ef3c7b05a2449d3542a08abcb9f402e71c97d68f4432cda38638e825
MD5 99f54bc3cd89b6fa2a6d3e156d552cdf
BLAKE2b-256 7f3d67bcb1325c51931f7a4175413cdf78f2918aa822c4c5ea261f4b97726c45

See more details on using hashes here.

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

Hashes for ai_logmaster-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6310b8fbc5617dc6ddaa78bda1051762c6800d195d3dc60b1f5fbcba9564e4ca
MD5 e956cb5d9f80ab364ba7a603905ebf7e
BLAKE2b-256 40aee997256c220c53d8daa704d2a952bc4058a0f743cba1bcbf7bf4c8c53ef4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page