Skip to content

Commit c5f7a56

Browse files
Cohee1207WolfsblvtCopilotCopilot
authored
1.17.0 (#198)
* Doc/writing extensions extensions (#196) * Document lifecycle hooks, HTML templates, function tool calling, action loader, and expand macro/event/library documentation * Improve function calling documentation: add canPerformToolCalls, clarify examples, and expand tips - Add documentation for canPerformToolCalls() to check generation-type-specific tool call support - Switch code examples from TypeScript to JavaScript for consistency - Restructure registration example with clearer field descriptions and a table format - Add tips on writing effective tool descriptions, parameter schemas, and recursion limits - Simplify Writing-Extensions.md function calling section --------- Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com> * Update documentation for SillyTavern 1.17.0 release (#197) * Update docs for SillyTavern 1.17.0 release - Node.js, macros, STscript, reasoning, OpenRouter, World Info, Vector Storage, Image Gen, config Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern-Docs/sessions/9155dd64-f3b0-439b-815a-24622ffd2729 Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com> * Update docs * Update config.yaml performance order * Add explanation for Git backends in config.yaml documentation * Update Node.js version requirement in installation instructions * Update extensions/Stable-Diffusion.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update Usage/Prompts/reasoning.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent bad9492 commit c5f7a56

File tree

12 files changed

+615
-116
lines changed

12 files changed

+615
-116
lines changed

Administration/config-yaml.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ An enabled CORS proxy may be required by some extensions. It is not required by
240240
| `performance.lazyLoadCharacters` | Lazy-load character data | `true` | `true`, `false` |
241241
| `performance.useDiskCache` | Enable disk caching for character cards | `true` | `true`, `false` |
242242
| `performance.memoryCacheCapacity` | Maximum memory cache capacity | `100mb` | Human-readable size (e.g., `100mb`, `1gb`) |
243+
| `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 |
243247

244248
## Cache Buster Configuration
245249

@@ -267,11 +271,12 @@ Requires localhost or a domain with HTTPS, otherwise will not work!
267271

268272
| Setting | Description | Default | Permitted Values |
269273
|---------|-------------|---------|-----------------|
274+
| `backups.common.numberOfBackups` | Number of backups to keep | `50` | Any positive integer |
270275
| `backups.chat.enabled` | Enable automatic chat backups | `true` | `true`, `false` |
271276
| `backups.chat.checkIntegrity` | Verify integrity of chat files before saving | `true` | `true`, `false` |
272-
| `backups.common.numberOfBackups` | Number of backups to keep | `50` | Any positive integer |
273277
| `backups.chat.throttleInterval` | Backup throttle interval (ms) | `10000` | Any positive integer |
274278
| `backups.chat.maxTotalBackups` | Maximum total chat backups to keep | `-1` | Any positive integer or -1 |
279+
| `backups.allowFullDataBackup` | Allow users to create a full backup archive of their data | `true` | `true`, `false` |
275280

276281
## [Extensions Configuration](/extensions/index.md)
277282

@@ -293,6 +298,19 @@ Requires localhost or a domain with HTTPS, otherwise will not work!
293298
| `enableServerPlugins` | Enable server-side plugins | `false` | `true`, `false` |
294299
| `enableServerPluginsAutoUpdate` | Attempt to automatically update server plugins on startup | `true` | `true`, `false` |
295300

301+
## Git Configuration
302+
303+
!!! Git backends explained
304+
305+
1. `auto` - prefer system binary, falling back to integrated
306+
2. `system` - system git binary using [simple-git](https://www.npmjs.com/package/simple-git)
307+
3. `builtin` - integrated engine using [isomorphic-git](https://www.npmjs.com/package/isomorphic-git)
308+
!!!
309+
310+
| Setting | Description | Default | Permitted Values |
311+
|---------|-------------|---------|-----------------|
312+
| `git.backend` | Git backend for plugin/extension repository operations | `auto` | `auto`, `system`, `builtin` |
313+
296314
## [API Integration Settings](/Usage/API_Connections/index.md)
297315

298316
### OpenAI Configuration
@@ -330,6 +348,7 @@ See: [Prompt Caching](https://platform.claude.com/docs/en/build-with-claude/prom
330348
| `claude.enableSystemPromptCache` | Enable system prompt caching | `false` | `true`, `false` |
331349
| `claude.cachingAtDepth` | Enable message history caching | `-1` | `-1` (disabled), `0` or positive integer |
332350
| `claude.extendedTTL` | Use 1h TTL instead of the default 5m. Note that this also increases the cost of the request. | `false` | `true`, `false` |
351+
| `claude.enableAdaptiveThinking` | Enables adaptive thinking for supported models (Opus 4.6+). Disable to enforce legacy thinking mode (with thinking budget). See: [Adaptive Thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking) | `false` | `true`, `false` |
333352

334353
### Google Gemini Configuration
335354

For_Contributors/Function-Calling.md

Lines changed: 61 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -35,77 +35,91 @@ Function Calling allows adding dynamic functionality to your extensions by letti
3535

3636
### Check if the feature is supported
3737

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:
3939

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");
40+
```js
41+
const { isToolCallingSupported } = SillyTavern.getContext();
42+
43+
if (isToolCallingSupported()) {
44+
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:
49+
50+
```js
51+
const { canPerformToolCalls } = SillyTavern.getContext();
52+
53+
if (canPerformToolCalls('normal')) {
54+
console.log('Can perform tool calls for this generation');
4555
}
4656
```
4757

48-
### Register a function
58+
### Register a function tool
4959

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:
5161

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/
62+
```js
63+
const { registerFunctionTool } = SillyTavern.getContext();
64+
65+
registerFunctionTool({
66+
name: 'get_weather',
67+
displayName: 'Get Weather',
68+
description: 'Get the current weather for a given location',
6169
parameters: {
6270
$schema: 'http://json-schema.org/draft-04/schema#',
6371
type: 'object',
6472
properties: {
65-
param1: {
73+
location: {
6674
type: 'string',
67-
description: 'Parameter 1 description',
75+
description: 'The city name, e.g. "London"',
6876
},
69-
param2: {
77+
unit: {
7078
type: 'string',
71-
description: 'Parameter 2 description',
79+
enum: ['celsius', 'fahrenheit'],
80+
description: 'Temperature unit',
7281
},
7382
},
74-
required: [
75-
'param1', 'param2',
76-
],
77-
},
78-
// Function to call when the tool is triggered. Can be async.
79-
// If the result is not a string, it will be JSON-stringified.
80-
action: async ({ param1, param2 }) => {
81-
// Your function code here
82-
console.log(`Function called with parameters: ${param1}, ${param2}`);
83-
return "Function result";
84-
},
85-
// Optional function to format the toast message displayed when the function is invoked.
86-
// If an empty string is returned, no toast message will be displayed.
87-
formatMessage: ({ param1, param2 }) => {
88-
return `Function is called with: ${param1} and ${param2}`;
83+
required: ['location'],
8984
},
90-
// Optional function that returns a boolean value indicating whether the tool should be registered for the current prompt.
91-
// If no shouldRegister function is provided, the tool will be registered for every prompt.
92-
shouldRegister: () => {
93-
return true;
85+
action: async ({ location, unit }) => {
86+
// Perform your logic here (API calls, computations, etc.)
87+
const data = await fetchWeatherData(location, unit);
88+
return JSON.stringify(data);
9489
},
95-
// Optional flag. If set to true, the function call will be performed, but the result won't be recorded to the visible chat history.
90+
formatMessage: ({ location }) => `Checking weather for ${location}...`,
91+
shouldRegister: () => isWeatherFeatureEnabled(),
9692
stealth: false,
9793
});
9894
```
9995

100-
### Unregister a function
96+
### Registration fields
97+
98+
| Field | Required | Description |
99+
|-------|----------|-------------|
100+
| `name` | Yes | Unique identifier for the tool |
101+
| `displayName` | No | User-friendly display name shown in the UI |
102+
| `description` | Yes | Description sent to the LLM to explain what the tool does and when to use it |
103+
| `parameters` | Yes | JSON Schema defining the tool's input parameters |
104+
| `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:
101112

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:
113+
```js
114+
const { unregisterFunctionTool } = SillyTavern.getContext();
103115

104-
```ts
105-
SillyTavern.getContext().unregisterFunctionTool("myFunction");
116+
unregisterFunctionTool('get_weather');
106117
```
107118

108119
## Tips and tricks
109120

110-
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

Comments
 (0)