File size: 2,631 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
"""
Simple SmoLagent Test
====================

Test the basic SmoLagent setup with just CodeAgent and DuckDuckGoSearchTool
"""

from smolagents import CodeAgent, DuckDuckGoSearchTool

def test_basic_agent():
    """Test basic SmoLagent setup without language model"""
    print("πŸ€– TESTING BASIC SMOLAGENT SETUP")
    print("=" * 35)
    
    try:
        # Create agent with just tools (no language model)
        agent = CodeAgent(tools=[DuckDuckGoSearchTool()])
        print("βœ… Basic SmoLagent created successfully!")
        print(f"πŸ“‹ Agent has {len(agent.tools)} tool(s) available")
        
        # List available tools
        for i, tool in enumerate(agent.tools, 1):
            print(f"   {i}. {tool.__class__.__name__}")
        
        # Test basic functionality
        print("\nπŸ§ͺ Testing agent functionality...")
        
        # Note: Without a language model, we can't run complex queries
        # But we can verify the agent structure is correct
        print("βœ… Agent structure is valid")
        print("⚠️  Note: Full AI analysis requires a language model")
        
        return agent
        
    except Exception as e:
        print(f"❌ Basic agent setup failed: {e}")
        return None

def test_with_search():
    """Test the search functionality"""
    print("\nπŸ” TESTING SEARCH FUNCTIONALITY")
    print("=" * 30)
    
    try:
        # Create search tool directly
        search_tool = DuckDuckGoSearchTool()
        print("βœ… DuckDuckGo search tool created")
        
        # Test search (if possible)
        print("πŸ” Search tool ready for use")
        return search_tool
        
    except Exception as e:
        print(f"❌ Search tool failed: {e}")
        return None

def main():
    """Main test function"""
    print("πŸš€ SMOLAGENT BASIC SETUP TEST")
    print("=" * 30)
    
    # Test 1: Basic agent
    agent = test_basic_agent()
    
    # Test 2: Search tool
    search_tool = test_with_search()
    
    # Summary
    print("\nπŸ“Š TEST SUMMARY")
    print("=" * 15)
    print(f"Basic Agent: {'βœ… Working' if agent else '❌ Failed'}")
    print(f"Search Tool: {'βœ… Working' if search_tool else '❌ Failed'}")
    
    if agent:
        print("\nπŸ’‘ Your basic SmoLagent is ready!")
        print("   To add AI capabilities, configure a language model")
        print("   Options: Ollama (free), OpenAI (paid), Hugging Face (free)")
    else:
        print("\n❌ Basic setup failed. Check SmoLagents installation.")
    
    print("\nπŸš€ Next: Run 'python upload.py' to use enhanced data analysis!")

if __name__ == "__main__":
    main()