add feature to fomrat note and save top local directory
This commit is contained in:
39
chat_tools.py
Normal file
39
chat_tools.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import bot_util
|
||||
tools = [
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "write_file",
|
||||
"description": "write content to a file, creating directories if they do not exist. If the file already exists, it will be overwritten.",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"file_path": {
|
||||
"type": "string",
|
||||
"description": "the path with file name to write to. it can be relative path. e.g. 'test_data/output/test.md'",
|
||||
},
|
||||
"content": {
|
||||
"type": "string",
|
||||
"description": "the content to write to the file.",
|
||||
},
|
||||
},
|
||||
"required": ["location"]
|
||||
},
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
class ChatTools:
|
||||
def __init__(self, tools, util):
|
||||
self.tools = tools
|
||||
self.names = util.__all__
|
||||
self.util = util
|
||||
|
||||
def get_tools(self):
|
||||
return self.tools
|
||||
|
||||
|
||||
|
||||
def get_chat_tools():
|
||||
chat_tools = ChatTools(tools, bot_util)
|
||||
return chat_tools
|
||||
Reference in New Issue
Block a user