-
Notifications
You must be signed in to change notification settings - Fork 166
/
base.py
45 lines (35 loc) · 1.07 KB
/
base.py
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
class BaseTool:
"""Base class for calling tools
"""
def __init__(self) -> None:
pass
def run(self, params) -> None:
pass
def get_tool_call_format(self) -> dict:
"""Get tool calling format following the function calling from OpenAI: https://platform.openai.com/docs/guides/function-calling
"""
pass
class BaseRapidAPITool(BaseTool):
"""Base class for calling tools from rapidapi hub: https://rapidapi.com/hub
"""
def __init__(self):
super().__init__()
self.url: str = None
self.host_name: str = None
self.api_key: str = None
def run(self, params: dict):
pass
def get_tool_call_format(self) -> dict:
pass
class BaseHuggingfaceTool(BaseTool):
"""Base class for calling models from huggingface
"""
def __init__(self):
super().__init__()
self.url: str = None
self.host_name: str = None
self.api_key: str = None
def run(self, params: dict):
pass
def get_tool_call_format(self) -> dict:
pass