|
| 1 | + |
| 2 | +var tools = map[string]types.Tool{ |
| 3 | + "sys.time.now": { |
| 4 | + ToolDef: types.ToolDef{ |
| 5 | + Parameters: types.Parameters{ |
| 6 | + Description: "Returns the current date and time in RFC3339 format", |
| 7 | + }, |
| 8 | + BuiltinFunc: SysTimeNow, |
| 9 | + }, |
| 10 | + }, |
| 11 | + "sys.ls": { |
| 12 | + ToolDef: types.ToolDef{ |
| 13 | + Parameters: types.Parameters{ |
| 14 | + Description: "Lists the contents of a directory", |
| 15 | + Arguments: types.ObjectSchema( |
| 16 | + "dir", "The directory to list"), |
| 17 | + }, |
| 18 | + BuiltinFunc: SysLs, |
| 19 | + }, |
| 20 | + }, |
| 21 | + "sys.read": { |
| 22 | + ToolDef: types.ToolDef{ |
| 23 | + Parameters: types.Parameters{ |
| 24 | + Description: "Reads the contents of a file", |
| 25 | + Arguments: types.ObjectSchema( |
| 26 | + "filename", "The name of the file to read"), |
| 27 | + }, |
| 28 | + BuiltinFunc: SysRead, |
| 29 | + }, |
| 30 | + }, |
| 31 | + "sys.write": { |
| 32 | + ToolDef: types.ToolDef{ |
| 33 | + Parameters: types.Parameters{ |
| 34 | + Description: "Write the contents to a file", |
| 35 | + Arguments: types.ObjectSchema( |
| 36 | + "filename", "The name of the file to write to", |
| 37 | + "content", "The content to write"), |
| 38 | + }, |
| 39 | + BuiltinFunc: SysWrite, |
| 40 | + }, |
| 41 | + }, |
| 42 | + "sys.append": { |
| 43 | + ToolDef: types.ToolDef{ |
| 44 | + Parameters: types.Parameters{ |
| 45 | + Description: "Appends the contents to a file", |
| 46 | + Arguments: types.ObjectSchema( |
| 47 | + "filename", "The name of the file to append to", |
| 48 | + "content", "The content to append"), |
| 49 | + }, |
| 50 | + BuiltinFunc: SysAppend, |
| 51 | + }, |
| 52 | + }, |
| 53 | + "sys.http.get": { |
| 54 | + ToolDef: types.ToolDef{ |
| 55 | + Parameters: types.Parameters{ |
| 56 | + Description: "Download the contents of a http or https URL", |
| 57 | + Arguments: types.ObjectSchema( |
| 58 | + "url", "The URL to download"), |
| 59 | + }, |
| 60 | + BuiltinFunc: SysHTTPGet, |
| 61 | + }, |
| 62 | + }, |
| 63 | + "sys.http.html2text": { |
| 64 | + ToolDef: types.ToolDef{ |
| 65 | + Parameters: types.Parameters{ |
| 66 | + Description: "Download the contents of a http or https URL returning the content as rendered text converted from HTML", |
| 67 | + Arguments: types.ObjectSchema( |
| 68 | + "url", "The URL to download"), |
| 69 | + }, |
| 70 | + BuiltinFunc: SysHTTPHtml2Text, |
| 71 | + }, |
| 72 | + }, |
| 73 | + "sys.abort": { |
| 74 | + ToolDef: types.ToolDef{ |
| 75 | + Parameters: types.Parameters{ |
| 76 | + Description: "Aborts execution", |
| 77 | + Arguments: types.ObjectSchema( |
| 78 | + "message", "The description of the error or unexpected result that caused abort to be called", |
| 79 | + ), |
| 80 | + }, |
| 81 | + BuiltinFunc: SysAbort, |
| 82 | + }, |
| 83 | + }, |
| 84 | + "sys.chat.finish": { |
| 85 | + ToolDef: types.ToolDef{ |
| 86 | + Parameters: types.Parameters{ |
| 87 | + Description: "Concludes the conversation. This can not be used to ask a question.", |
| 88 | + Arguments: types.ObjectSchema( |
| 89 | + "return", "The instructed value to return or a summary of the dialog if no value is instructed", |
| 90 | + ), |
| 91 | + }, |
| 92 | + BuiltinFunc: SysChatFinish, |
| 93 | + }, |
| 94 | + }, |
| 95 | + "sys.http.post": { |
| 96 | + ToolDef: types.ToolDef{ |
| 97 | + Parameters: types.Parameters{ |
| 98 | + Description: "Write contents to a http or https URL using the POST method", |
| 99 | + Arguments: types.ObjectSchema( |
| 100 | + "url", "The URL to POST to", |
| 101 | + "content", "The content to POST", |
| 102 | + "contentType", "The \"content type\" of the content such as application/json or text/plain"), |
| 103 | + }, |
| 104 | + BuiltinFunc: SysHTTPPost, |
| 105 | + }, |
| 106 | + }, |
| 107 | + "sys.find": { |
| 108 | + ToolDef: types.ToolDef{ |
| 109 | + Parameters: types.Parameters{ |
| 110 | + Description: "Traverse a directory looking for files that match a pattern in the style of the unix find command", |
| 111 | + Arguments: types.ObjectSchema( |
| 112 | + "pattern", "The file pattern to look for. The pattern is a traditional unix glob format with * matching any character and ? matching a single character", |
| 113 | + "directory", "The directory to search in. The current directory \".\" will be used as the default if no argument is passed", |
| 114 | + ), |
| 115 | + }, |
| 116 | + BuiltinFunc: SysFind, |
| 117 | + }, |
| 118 | + }, |
| 119 | + "sys.exec": { |
| 120 | + ToolDef: types.ToolDef{ |
| 121 | + Parameters: types.Parameters{ |
| 122 | + Description: "Execute a command and get the output of the command", |
| 123 | + Arguments: types.ObjectSchema( |
| 124 | + "command", "The command to run including all applicable arguments", |
| 125 | + "directory", "The directory to use as the current working directory of the command. The current directory \".\" will be used if no argument is passed", |
| 126 | + ), |
| 127 | + }, |
| 128 | + BuiltinFunc: SysExec, |
| 129 | + }, |
| 130 | + }, |
| 131 | + "sys.getenv": { |
| 132 | + ToolDef: types.ToolDef{ |
| 133 | + Parameters: types.Parameters{ |
| 134 | + Description: "Gets the value of an OS environment variable", |
| 135 | + Arguments: types.ObjectSchema( |
| 136 | + "name", "The environment variable name to lookup"), |
| 137 | + }, |
| 138 | + BuiltinFunc: SysGetenv, |
| 139 | + }, |
| 140 | + }, |
| 141 | + "sys.download": { |
| 142 | + ToolDef: types.ToolDef{ |
| 143 | + Parameters: types.Parameters{ |
| 144 | + Description: "Downloads a URL, saving the contents to disk at a given location", |
| 145 | + Arguments: types.ObjectSchema( |
| 146 | + "url", "The URL to download, either http or https.", |
| 147 | + "location", "(optional) The on disk location to store the file. If no location is specified a temp location will be used. If the target file already exists it will fail unless override is set to true.", |
| 148 | + "override", "If true and a file at the location exists, the file will be overwritten, otherwise fail. Default is false"), |
| 149 | + }, |
| 150 | + BuiltinFunc: SysDownload, |
| 151 | + }, |
| 152 | + }, |
| 153 | + "sys.remove": { |
| 154 | + ToolDef: types.ToolDef{ |
| 155 | + Parameters: types.Parameters{ |
| 156 | + Description: "Removes the specified files", |
| 157 | + Arguments: types.ObjectSchema( |
| 158 | + "location", "The file to remove"), |
| 159 | + }, |
| 160 | + BuiltinFunc: SysRemove, |
| 161 | + }, |
| 162 | + }, |
| 163 | + "sys.stat": { |
| 164 | + ToolDef: types.ToolDef{ |
| 165 | + Parameters: types.Parameters{ |
| 166 | + Description: "Gets size, modfied time, and mode of the specified file", |
| 167 | + Arguments: types.ObjectSchema( |
| 168 | + "filepath", "The complete path and filename of the file", |
| 169 | + ), |
| 170 | + }, |
| 171 | + BuiltinFunc: SysStat, |
| 172 | + }, |
| 173 | + }, |
| 174 | + "sys.prompt": { |
| 175 | + ToolDef: types.ToolDef{ |
| 176 | + Parameters: types.Parameters{ |
| 177 | + Description: "Prompts the user for input", |
| 178 | + Arguments: types.ObjectSchema( |
| 179 | + "message", "The message to display to the user", |
| 180 | + "fields", "A comma-separated list of fields to prompt for", |
| 181 | + "sensitive", "(true or false) Whether the input should be hidden", |
| 182 | + ), |
| 183 | + }, |
| 184 | + BuiltinFunc: SysPrompt, |
| 185 | + }, |
| 186 | + }, |
| 187 | + "sys.chat.history": { |
| 188 | + ToolDef: types.ToolDef{ |
| 189 | + Parameters: types.Parameters{ |
| 190 | + Description: "Retrieves the previous chat dialog", |
| 191 | + Arguments: types.ObjectSchema(), |
| 192 | + }, |
| 193 | + BuiltinFunc: SysChatHistory, |
| 194 | + }, |
| 195 | + }, |
| 196 | +} |
0 commit comments