File size: 2,750 Bytes
d6f13c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
94
95
96
"""
Demo script to showcase the AI Project Assistant capabilities.
"""
import os
from pathlib import Path
from dotenv import load_dotenv
from src.rag import ProjectRAG
from src.agent import ProjectAgent

# Load environment variables
load_dotenv()


def main():
    """Run the demo."""
    print("=" * 60)
    print("AI Project Assistant - Demo")
    print("=" * 60)
    
    # Check for API key
    if not os.getenv("GOOGLE_API_KEY"):
        print("\n⚠️  ERROR: GOOGLE_API_KEY not found!")
        print("Please create a .env file with your Google API key:")
        print("  GOOGLE_API_KEY=your_key_here")
        print("\nGet your API key from: https://aistudio.google.com/apikey")
        return
    
    # Initialize RAG system
    print("\n📁 Initializing RAG system...")
    data_dir = Path("./data")
    rag = ProjectRAG(data_dir)
    rag.load_and_index()
    
    if not rag.meetings:
        print("\n⚠️  No meetings found!")
        print("Please add meeting notes to the data directory.")
        return
    
    print(f"✅ Loaded {len(rag.meetings)} meetings")
    print(f"✅ Projects: {', '.join(rag.get_all_projects())}")
    
    # Initialize agent
    print("\n🤖 Initializing AI Agent...")
    agent = ProjectAgent(rag)
    print("✅ Agent ready!")
    
    # Demo queries
    demo_queries = [
        "What are all the open action items?",
        "What blockers do we have across all projects?",
        "What is the status of the AI model training project?",
        "What should the team focus on next for the mobile app redesign?",
    ]
    
    print("\n" + "=" * 60)
    print("Running Demo Queries")
    print("=" * 60)
    
    for i, query in enumerate(demo_queries, 1):
        print(f"\n📝 Query {i}: {query}")
        print("-" * 60)
        
        answer = agent.query(query)
        print(answer)
        print()
    
    # Interactive mode
    print("\n" + "=" * 60)
    print("Interactive Mode - Ask your own questions!")
    print("(Type 'quit' or 'exit' to end)")
    print("=" * 60)
    
    while True:
        try:
            user_query = input("\n💬 Your question: ").strip()
            
            if user_query.lower() in ['quit', 'exit', 'q']:
                print("\n👋 Thanks for using AI Project Assistant!")
                break
            
            if not user_query:
                continue
            
            print("\n🤖 Assistant:", end=" ")
            answer = agent.query(user_query)
            print(answer)
            
        except KeyboardInterrupt:
            print("\n\n👋 Thanks for using AI Project Assistant!")
            break
        except Exception as e:
            print(f"\n❌ Error: {e}")


if __name__ == "__main__":
    main()