Spaces:
Runtime error
Runtime error
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()
|