File size: 3,340 Bytes
c69ba8c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/env python3
"""
Quick AI Demo - Working SmoLagent without large model downloads
"""
import pandas as pd
from smolagents import CodeAgent, DuckDuckGoSearchTool
import warnings
warnings.filterwarnings('ignore')

def quick_demo():
    """Quick demo that works immediately"""
    print("πŸš€ QUICK AI DEMO - No Downloads Required")
    print("=" * 50)
    
    # Load the data first
    csv_file_path = "C:/Users/Cosmo/Desktop/NTU Peak Singtel/outsystems_sample_logs_6months.csv"
    
    try:
        print("πŸ“Š Loading CSV data...")
        df = pd.read_csv(csv_file_path)
        print(f"βœ… Data loaded: {df.shape[0]} rows, {df.shape[1]} columns")
        print(f"πŸ“‹ Columns: {list(df.columns)}")
        
        # Show basic analysis without AI first
        print("\nπŸ“ˆ BASIC DATA ANALYSIS:")
        print("-" * 30)
        
        # Error analysis
        error_df = df[df['LogLevel'] == 'Error']
        info_df = df[df['LogLevel'] == 'Info']
        
        print(f"🚨 Total Error entries: {len(error_df)}")
        print(f"ℹ️  Total Info entries: {len(info_df)}")
        print(f"πŸ“Š Error rate: {len(error_df)/len(df)*100:.1f}%")
        
        # Top modules with errors
        if not error_df.empty:
            top_error_modules = error_df['Module'].value_counts().head(3)
            print(f"\nπŸ” Top 3 modules with errors:")
            for module, count in top_error_modules.items():
                print(f"   β€’ {module}: {count} errors")
        
        # Check for missing data
        missing_data = df.isnull().sum()
        print(f"\n❌ Missing data summary:")
        for col, missing_count in missing_data.items():
            if missing_count > 0:
                print(f"   β€’ {col}: {missing_count} missing ({missing_count/len(df)*100:.1f}%)")
        
        print("\n" + "=" * 50)
        print("βœ… BASIC ANALYSIS COMPLETE!")
        print("πŸ’‘ This shows your data is loading correctly.")
        print("πŸ€– AI features will work once model downloads complete.")
        print("=" * 50)
        
        return df
        
    except Exception as e:
        print(f"❌ Error loading data: {e}")
        return None

def test_simple_agent():
    """Test if we can create an agent without heavy models"""
    print("\nπŸ§ͺ Testing Simple Agent Creation...")
    
    try:
        # Just test the tools without a model first
        search_tool = DuckDuckGoSearchTool()
        print("βœ… DuckDuckGo search tool created successfully")
        
        # Try to create agent (might fail without model, but we can catch it)
        try:
            agent = CodeAgent(tools=[search_tool])
            print("βœ… Agent created (basic setup)")
        except Exception as e:
            print(f"ℹ️  Agent needs model: {e}")
            print("πŸ’‘ This is expected - agent will work once model is ready")
        
    except Exception as e:
        print(f"❌ Tool creation failed: {e}")

if __name__ == "__main__":
    # Run the quick demo
    df = quick_demo()
    
    # Test agent creation
    test_simple_agent()
    
    if df is not None:
        print(f"\nπŸŽ‰ SUCCESS! Your data analysis setup is working!")
        print(f"πŸ“Š Dataset ready: {df.shape[0]} OutSystems log entries")
        print(f"πŸ€– AI features will be available once model download completes")