File size: 611 Bytes
873d0cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from langchain.tools import tool

try:
    from .utils.db import load_api_key
    from .llm import get_model
    from .top_bar_wrapper import wrapper
except ImportError:
    from top_bar_wrapper import wrapper


def Tool(func):
    """
    A decorator function to register a tool with the custom tools list.

    Parameters:
    - func (callable): The function to be registered as a tool.

    Returns:
    - callable: The input function `func` unchanged.
    """
    from .agent.agent import custom_tools_

    global custom_tools_
    func = wrapper(func)
    custom_tools_.append(tool(func))
    return func