You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`performance.requestCompression.enabled`| Enable gzip compression for client requests with large payloads (e.g. settings or chat saves) |`false`|`true`, `false`|
244
+
|`performance.requestCompression.minPayloadSize`| Minimum payload size to trigger compression. Set to 0 to compress all requests regardless of size |`256kb`| Human-readable size (e.g., `256kb`, `1mb`) |
245
+
|`performance.requestCompression.maxPayloadSize`| Hard upper payload size limit for compression. Set to 0 to allow compression of any size |`8mb`| Human-readable size (e.g., `8mb`, `16mb`) |
246
+
|`performance.requestCompression.timeout`| Timeout for request compression in milliseconds |`4000`| Positive integer |
243
247
244
248
## Cache Buster Configuration
245
249
@@ -267,11 +271,12 @@ Requires localhost or a domain with HTTPS, otherwise will not work!
Copy file name to clipboardExpand all lines: For_Contributors/Function-Calling.md
+61-47Lines changed: 61 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,77 +35,91 @@ Function Calling allows adding dynamic functionality to your extensions by letti
35
35
36
36
### Check if the feature is supported
37
37
38
-
To determine if the function tool calling feature is supported, you can call `isToolCallingSupported` from the `SillyTavern.getContext()`object. This will check if the current API supports function tool calling and if it's enabled in the settings. Here is an example of how to check if the feature is supported:
38
+
Use `isToolCallingSupported()` from `SillyTavern.getContext()`to check if the current API supports function tool calling and if it's enabled in the settings:
39
39
40
-
```ts
41
-
if (SillyTavern.getContext().isToolCallingSupported()) {
42
-
console.log("Function tool calling is supported");
43
-
} else {
44
-
console.log("Function tool calling is not supported");
console.log('Function tool calling is supported');
45
+
}
46
+
```
47
+
48
+
You can also check whether tool calls can be performed for a specific generation type. Continuations, impersonation, and background ('quiet') prompts are not allowed to trigger tool calls:
console.log('Can perform tool calls for this generation');
45
55
}
46
56
```
47
57
48
-
### Register a function
58
+
### Register a function tool
49
59
50
-
To register a function tool, you need to call the `registerFunctionTool` function from the `SillyTavern.getContext()`object and pass the required parameters. Here is an example of how to register a function tool:
60
+
Use `registerFunctionTool()`from `SillyTavern.getContext()`to register a tool. The tool definition follows the [JSON Schema](https://json-schema.org/) format for its parameters:
51
61
52
-
```ts
53
-
SillyTavern.getContext().registerFunctionTool({
54
-
// Internal name of the function tool. Must be unique.
55
-
name: "myFunction",
56
-
// Display name of the function tool. Will be shown in the UI. (Optional)
57
-
displayName: "My Function",
58
-
// Description of the function tool. Must describe what the function does and when to use it.
59
-
description: "My function description. Use when you need to do something.",
60
-
// JSON schema for the parameters of the function tool. See: https://json-schema.org/
|`action`| Yes | Function called when the LLM invokes the tool. Receives parsed parameters as an object. Can be async. Must return a string result (non-string values will be JSON-stringified). |
105
+
|`formatMessage`| No | Function returning a string shown as a toast while the tool executes. Return an empty string to suppress the toast. |
106
+
|`shouldRegister`| No | Function returning a boolean; if `false`, the tool is excluded from the current request. If not provided, the tool is registered for every prompt. |
107
+
|`stealth`| No | If `true`, the tool call result is not recorded to visible chat history and no follow-up generation is triggered |
108
+
109
+
### Unregister a function tool
110
+
111
+
To deactivate a function tool, call `unregisterFunctionTool()` with the tool's name:
101
112
102
-
To deactivate a function tool, you need to call the `unregisterFunctionTool` function from the `SillyTavern.getContext()` object and pass the name of the function tool to disable. Here is an example of how to unregister a function tool:
1. Successful tool calls are saved as a part of the visible history and will be displayed in the chat UI, so you can inspect the actual parameters and results. If that is not desirable, set the `stealth: true` flag when registering a function tool.
111
-
2. If you don't want to see the tool call in the chat history. If you want to stylize or hide them with custom CSS, target a `toolCall` class on `.mes` elements, i.e. `.mes.toolCall { display: none; }` or `.mes.toolCall { color: #999; }`.
121
+
1. Successful tool calls are saved as part of the visible chat history and displayed in the chat UI, so you can inspect the actual parameters and results. If that is not desirable, set `stealth: true` when registering the tool.
122
+
2. To stylize or hide tool call messages with custom CSS, target the `toolCall` class on `.mes` elements, e.g. `.mes.toolCall { display: none; }` or `.mes.toolCall { opacity: 0.5; }`.
123
+
3. Write clear, specific descriptions for your tools — the LLM uses these to decide when and how to call them. Include guidance on when the tool should be used.
124
+
4. Keep the parameter schema simple and well-documented. Each property's `description` helps the LLM fill in the correct values.
125
+
5. Tool calls have a recursion limit (default: 5 rounds). If the LLM keeps calling tools repeatedly, execution will stop after the limit is reached.
0 commit comments