File size: 2,323 Bytes
fe36046
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""
Test script to verify tool integration in the LangGraph agent system
"""

from src.langgraph_system import run_agent_system

def test_retrieval_tools():
    """Test that retrieval tools (Wikipedia, web search, etc.) are working"""
    print("=" * 60)
    print("Testing Retrieval Tools Integration")
    print("=" * 60)
    
    # Test Wikipedia search
    query = "When was Albert Einstein born?"
    print(f"\nTesting query: {query}")
    print("-" * 40)
    
    result = run_agent_system(query, user_id="test_user", session_id="test_session")
    print(f"Result: {result}")
    
    return result

def test_execution_tools():
    """Test that execution tools (Python code execution) are working"""
    print("=" * 60)
    print("Testing Execution Tools Integration")
    print("=" * 60)
    
    # Test code execution
    query = "Calculate the first 10 numbers in the Fibonacci sequence"
    print(f"\nTesting query: {query}")
    print("-" * 40)
    
    result = run_agent_system(query, user_id="test_user", session_id="test_session")
    print(f"Result: {result}")
    
    return result

def test_web_search_tools():
    """Test web search functionality"""
    print("=" * 60)
    print("Testing Web Search Tools Integration")
    print("=" * 60)
    
    # Test web search
    query = "What is the latest news about artificial intelligence?"
    print(f"\nTesting query: {query}")
    print("-" * 40)
    
    result = run_agent_system(query, user_id="test_user", session_id="test_session")
    print(f"Result: {result}")
    
    return result

if __name__ == "__main__":
    print("Starting Tool Integration Tests...")
    
    try:
        # Test retrieval tools
        test_retrieval_tools()
        
        print("\n" + "=" * 60)
        input("Press Enter to continue to execution tools test...")
        
        # Test execution tools
        test_execution_tools()
        
        print("\n" + "=" * 60)
        input("Press Enter to continue to web search tools test...")
        
        # Test web search tools
        test_web_search_tools()
        
        print("\n" + "=" * 60)
        print("Tool integration tests completed!")
        
    except Exception as e:
        print(f"Test failed with error: {e}")
        import traceback
        traceback.print_exc()