File size: 2,323 Bytes
9a6a4dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
Simple base tool class for enhanced research tools.
This provides a minimal interface compatible with AGNO without requiring agno.tools.base
"""

from typing import Any, Dict, Optional
from abc import ABC, abstractmethod


class BaseTool(ABC):
    """
    Simple base class for tools that can be used with AGNO.
    
    This provides the minimal interface needed for AGNO compatibility
    without requiring complex dependencies.
    """
    
    def __init__(self, name: str, description: str):
        """
        Initialize the base tool.
        
        Args:
            name: Tool name
            description: Tool description
        """
        self.name = name
        self.description = description
    
    def __str__(self) -> str:
        """String representation of the tool."""
        return f"{self.__class__.__name__}(name='{self.name}')"
    
    def __repr__(self) -> str:
        """Detailed representation of the tool."""
        return f"{self.__class__.__name__}(name='{self.name}', description='{self.description}')"
    
    def get_info(self) -> Dict[str, Any]:
        """Get tool information."""
        return {
            'name': self.name,
            'description': self.description,
            'class': self.__class__.__name__
        }


class SimpleAGNOTool(BaseTool):
    """
    Simple AGNO-compatible tool that can be used directly with AGNO agents.
    
    This class provides the interface that AGNO expects while keeping
    the implementation simple and dependency-free.
    """
    
    def __init__(self, name: str, description: str):
        """Initialize the AGNO-compatible tool."""
        super().__init__(name, description)
        
        # AGNO expects these attributes
        self._name = name
        self._description = description
    
    @property
    def tool_name(self) -> str:
        """Get the tool name (AGNO compatibility)."""
        return self.name
    
    @property
    def tool_description(self) -> str:
        """Get the tool description (AGNO compatibility)."""
        return self.description
    
    def to_dict(self) -> Dict[str, Any]:
        """Convert tool to dictionary (AGNO compatibility)."""
        return {
            'name': self.name,
            'description': self.description,
            'type': 'function'
        }