Upload rt_tools.py with huggingface_hub
Browse files- rt_tools.py +23 -0
rt_tools.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
|
| 3 |
+
class RTTools:
|
| 4 |
+
# 简化版工具:函数名和参数极短,最大化体现速度优势
|
| 5 |
+
CONTACT_TOOL = {
|
| 6 |
+
"type": "function",
|
| 7 |
+
"function": {
|
| 8 |
+
"name": "add_contact",
|
| 9 |
+
"description": "Add a contact.",
|
| 10 |
+
"parameters": {
|
| 11 |
+
"type": "object",
|
| 12 |
+
"properties": {
|
| 13 |
+
"name": {"type": "string", "description": "Name"},
|
| 14 |
+
"phone": {"type": "string", "description": "Phone"}
|
| 15 |
+
},
|
| 16 |
+
"required": ["name", "phone"]
|
| 17 |
+
}
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
@classmethod
|
| 22 |
+
def get_all(cls):
|
| 23 |
+
return "\n".join([json.dumps(cls.CONTACT_TOOL)])
|