File size: 1,088 Bytes
9b674e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
try:
    from ..utils.db import *
    from ..tooler import *
    from ..display_tools import *
    from ..teams import *
except ImportError:

    from utils.db import *

    from tooler import *
    from display_tools import *
    from teams import *



custom_tools = []



def load_tiger_tools():
    try:
        from upsonic import Tiger
        tools = Tiger()
        tools.enable_auto_requirements = True
        tools = tools.langchain()
        return tools
    except:
        return False


def load_default_tools():
    from ..standard_tools import get_standard_tools
    return get_standard_tools()




cached_tiger_tools = None

def get_tiger_tools():
    global cached_tiger_tools
    if cached_tiger_tools is None:
        cached_tiger_tools = load_tiger_tools()
    return cached_tiger_tools

if is_online_tools_setting_active():
    get_tiger_tools()

def get_tools():
    if is_online_tools_setting_active():
        tools = get_tiger_tools()
        if not tools:
            tools = load_default_tools()
    else:
        tools = load_default_tools()
    return tools