Rebecca Turner
7ef296d43a
Feature: Allow tools to accept arrays of values as an array ( #4085 )
...
Previously, a tool that that registered itself as having an array parameter
had each element of the array registered as a variable, but it did not
register the array parameter itself. This meant that it was only really
useful with fixed length arrays.
This patch adds a variable for the array itself that lives alongside the
existing args. I don't expect this to have any backward compatiblity
concerns.
Repro:
```stscript
// this requires lalib to function |
/let key=schema {
"$schema": "http://json-schema.org/draft-04/schema# ",
"type": "string",
"properties": {
"example": {
"type": "array",
"contains": {
"type": "string"
}
}
},
"required": [
"example"
]
} ||
/tools-register name=YourFunc description="filler" parameters={{var::schema}} {:
/let ex {: /try {: /return {{var::arg.example}} :} :}() | /= ex.isException | /if rule=not left={{pipe}} else={:
/console-log {{var::ex}}
:} {:
/console-log "arg.example: {{var::arg.example}}" |
/foreach {{var::arg.example}} {: /console-log "#{{var::index}}: {{var::item}}" :}
:} |
/try {: /return {{var::arg.example.0}} :} | /console-log "arg.example.0: {{pipe}}" |
/try {: /return {{var::arg.example.1}} :} | /console-log "arg.example.1: {{pipe}}" |
/try {: /return {{var::arg.example.2}} :} | /console-log "arg.example.2: {{pipe}}" |
/try {: /return {{var::arg.example.3}} :} | /console-log "arg.example.3: {{pipe}}" |
:} ||
/let key=params {
"example": [
"test1", "test2", "test3"
]
} |
/tools-invoke parameters={{var::params}} YourFunc
```
Currently produces:
```
[/console-log] arg.example: {"isException":true,"exception":"No such variable: \"arg.example\""}
[/console-log] arg.example.0: {"isException":false,"result":"test1"}
[/console-log] arg.example.1: {"isException":false,"result":"test2"}
[/console-log] arg.example.2: {"isException":false,"result":"test3"}
[/console-log] arg.example.3: {"isException":true,"exception":"No such variable: \"arg.example.3\""}
```
With this patch it produces:
```
[/console-log] arg.example: ["test1","test2","test3"]
[/console-log] #0 : test1
[/console-log] #1 : test2
[/console-log] #2 : test3
[/console-log] arg.example.0: {"isException":false,"result":"test1"}
[/console-log] arg.example.1: {"isException":false,"result":"test2"}
[/console-log] arg.example.2: {"isException":false,"result":"test3"}
[/console-log] arg.example.3: {"isException":true,"exception":"No such variable: \"arg.example.3\""}
```
2025-06-02 10:54:10 +03:00
Rebecca Turner
6bb07370f4
Fix #4083 JSON parse error when tool does not accept parameters ( #4084 )
...
* Fix #4083 : JSON parse error when tool does not accept parameters
* Reformat for visual coolness
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com >
2025-06-02 10:18:04 +03:00
Cohee
ade45b6cd1
Allow prompt post-processing for all sources. Add 'single user msg' processing ( #4009 )
...
* Allow prompt post-processing for all sources. Add 'single user msg' PPP type
* Fix copilot comments
* Fix typo in element id
* Remove redundant conditions
* Lint fix
* Add link to PPP docs
2025-05-22 20:36:22 +03:00
NijikaMyWaifu
157315cd68
Add Vertex AI express mode support ( #3977 )
...
* Add Vertex AI express mode support
Split Google AI Studio and Vertex AI
* Add support for Vertex AI, including updating default models and related settings, modifying frontend HTML to include Vertex AI options, and adjusting request processing logic in the backend API.
* Log API name in the console
* Merge sysprompt toggles back
* Use Gemma tokenizers for Vertex and LearnLM
* AI Studio parity updates
* Add link to express mode doc. Also technically it's not a form
* Split title
* Use array includes
* Add support for Google Vertex AI in image captioning feature
* Specify caption API name, add to compression list
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com >
2025-05-22 20:10:53 +03:00
Cohee
420d568cd3
Pollinations - Text ( #3985 )
...
* [wip] Pollinations for text
* Implement generate API request
* Determine Pollinations model tools via models list
* Add Pollinations option to /model command
* Add Pollinations support to caption
* Update link to pollinations site
* Fix type errors in openai.js
* Fix API connection test to use AbortController for request cancellation
* Remove hard coded list of pollinations vision models
* Remove openai-audio from captioning models
2025-05-11 20:14:11 +03:00
Cohee
1c52099ed6
Add xAI as chat completion source
2025-04-10 22:59:10 +03:00
Cohee
de0e65fe13
Enable tool calling for ai21
2025-03-08 17:25:37 +02:00
Cohee
c9277cec28
Gemini: Add tool calling
2025-03-06 23:52:35 +02:00
Cohee
c3dd3e246e
DeepSeek: Add tool calling for -chat model
2025-02-11 00:04:40 +02:00
Cohee
7e7b3e30c4
Tool Calling: Implement stealth tool defintions ( #3192 )
...
* Tool Calling: Implement stealth tool defintions
* Move isStealth check up
* Always stop generation on stealth tool calls
* Image Generation: use stealth flag for tool registration
* Update stealth property description to clarify no follow-up generation will be performed
* Revert "Image Generation: use stealth flag for tool registration"
This reverts commit 8d13445c0b
.
2024-12-19 21:17:47 +02:00
Cohee
9c43999e4b
Fix /tools-unregister
2024-12-06 17:15:40 +02:00
Cohee
649c3911eb
Add shouldRegister arg to /tools-register
2024-11-03 19:11:07 +02:00
Cohee
3387fe4bd6
unvendor: Replace DOMPurify
2024-10-16 23:11:13 +03:00
Cohee
42f8b86b11
Tool Calling: stringify errors instead of silently failing
2024-10-09 22:39:55 +03:00
Cohee
3fd7ca90ed
Tool Calling: Don't try to parse if tool calling is not supported
2024-10-09 10:49:02 +00:00
Cohee
15efdb6609
Merge pull request #2962 from SillyTavern/cohere-v2
...
Migrate Cohere to /v2/chat
2024-10-09 10:29:04 +03:00
Cohee
c49138dfea
Tool Calling: Make formatMessage async
2024-10-09 03:56:24 +03:00
Cohee
bc0f5bf4ce
Tool Calling: add shouldRegister function to tool defintion
2024-10-09 03:53:32 +03:00
Cohee
c2935ba4a7
Migrate Cohere to /v2/chat
...
Closes #2916
2024-10-08 23:50:09 +03:00
Cohee
7db85e7ed8
Limit tool calls recursion
2024-10-07 00:22:27 +03:00
Cohee
89bad21881
Allow tool registration on swipes
2024-10-06 22:25:23 +03:00
Cohee
6b022e783d
Fix tool call reuse between Claude and OAI
2024-10-06 22:22:19 +03:00
Cohee
927c2418e0
Group tool calls in the result
2024-10-06 20:19:58 +03:00
Cohee
96862be6b0
Fix tools-list
2024-10-06 13:01:14 +03:00
Cohee
077ba8b03d
Add slash commands for tools management
2024-10-06 12:49:08 +03:00
Cohee
7dea59f026
Format tool result if JSON
2024-10-05 20:54:37 +03:00
Cohee
47e3cf82e0
Don't call tools on stopped streams. Emit events
2024-10-05 19:08:57 +03:00
Cohee
6a304e8884
Fix generation looping
2024-10-05 00:20:06 +03:00
Cohee
01fc5113d7
Fix ghost messages
2024-10-04 23:13:56 +03:00
Cohee
d5d8d6c876
Remove warning log for unregister
2024-10-04 13:05:03 +00:00
Cohee
db04fff3df
Claude: Streamed tool calls parser
2024-10-04 11:31:15 +00:00
Cohee
ca1f6a56c3
Merge branch 'tool-calling' of https://github.com/SillyTavern/SillyTavern into tool-calling
2024-10-04 13:39:13 +03:00
Cohee
0cab91e0f8
Add Claude streamed tool parser
2024-10-04 13:39:08 +03:00
Cohee
4a2989718c
ESLint and JSDoc fixes
2024-10-04 10:34:17 +00:00
Cohee
c3c10a629e
Claude: new prompt converter + non-streaming tools
2024-10-04 03:41:25 +03:00
Cohee
559f1b81f7
Remove tool calling for Cohere v1
2024-10-04 02:11:46 +03:00
Cohee
01f03dbf50
Support MistralAI streaming tool calls
2024-10-04 01:51:41 +03:00
Cohee
5cf64a2613
Update tool registration
2024-10-04 00:39:28 +03:00
Cohee
6558b10675
Show an error when all tools fail
2024-10-04 00:11:36 +03:00
Cohee
1e076a3e43
Prettify displayed message
2024-10-02 23:32:29 +03:00
Cohee
2b7c03f3b0
Nicely format message for tool calls
2024-10-02 23:13:11 +03:00
Cohee
0f8c1fa95d
Save tool calls to visible chats.
2024-10-02 22:17:27 +03:00
Cohee
63724a2b38
eslint update
2024-10-02 01:54:47 +03:00
Cohee
68c87f7e7a
Fix code scanning alert no. 231: Prototype-polluting function
...
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2024-10-02 01:53:03 +03:00
Cohee
c94c06ed4d
Implement function tool calling for OpenAI
2024-10-02 01:45:57 +03:00
Cohee
8006795897
New tool calling framework
2024-10-02 01:00:48 +03:00