Skip to content

Latest commit

 

History

History
119 lines (88 loc) · 2.13 KB

File metadata and controls

119 lines (88 loc) · 2.13 KB

Quick Start Guide

Welcome to AIOps Framework! This guide will help you get started in 5 minutes.

Installation

# Install from source
git clone https://github.com/markl-a/AIOps.git
cd AIOps
pip install -e .

Configuration

# Create .env file
cp .env.example .env

# Add your API key to .env
echo "OPENAI_API_KEY=your_key_here" >> .env
# OR
echo "ANTHROPIC_API_KEY=your_key_here" >> .env

First Steps

1. Code Review

# Create a sample Python file
cat > sample.py << 'EOF'
def process_data(items):
    result = []
    for i in range(len(items)):
        if items[i] != None:
            result.append(items[i] * 2)
    return result
EOF

# Review it
aiops review sample.py

2. Generate Tests

# Generate tests for the same file
aiops generate-tests sample.py --output test_sample.py

# View the generated tests
cat test_sample.py

3. Analyze Logs

# Create sample log file
cat > app.log << 'EOF'
2024-01-10 10:15:23 ERROR Failed to connect to database
2024-01-10 10:15:24 WARN Retrying connection
2024-01-10 10:15:29 ERROR Failed to connect to database
2024-01-10 10:15:41 CRITICAL Database connection failed
EOF

# Analyze logs
aiops analyze-logs app.log

4. Use Python SDK

# Create example.py
import asyncio
from aiops.agents.code_reviewer import CodeReviewAgent

async def main():
    agent = CodeReviewAgent()

    code = """
    def hello_world():
        print("Hello, World!")
    """

    result = await agent.execute(code=code, language="python")
    print(f"Score: {result.overall_score}/100")

asyncio.run(main())

Run it:

python example.py

5. Start API Server

# Start server
python -m aiops.api.main

# In another terminal, test it
curl -X POST http://localhost:8000/api/v1/code/review \
  -H "Content-Type: application/json" \
  -d '{"code": "def hello(): pass", "language": "python"}'

Next Steps

Need Help?

Happy automating! 🚀