mirror of
https://github.com/multipleof4/sune.git
synced 2026-01-14 08:38:00 +00:00
Create FunctionCalling.md
This commit is contained in:
21
readme/FunctionCalling.md
Normal file
21
readme/FunctionCalling.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
Sune function call (have Sunes attach files to their latest bubble)
|
||||||
|
|
||||||
|
In your Sune script, call:
|
||||||
|
```js
|
||||||
|
await window.suneAttach(files, { toAPI: true, tree: true })
|
||||||
|
```
|
||||||
|
files can be File objects or simple objects like:
|
||||||
|
```js
|
||||||
|
{ name: 'report.pdf', mime: 'application/pdf', data: '<BASE64>', size: 123456 }
|
||||||
|
```
|
||||||
|
`toAPI: true` adds an assistant message containing the actual file parts (so the API can consume them next turn).
|
||||||
|
|
||||||
|
`tree: true` adds the separate Attachments tree bubble with clickable downloads.
|
||||||
|
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
```js
|
||||||
|
await window.suneAttach([fileInput.files[0]])
|
||||||
|
await window.suneAttach([{name:'cat.png',mime:'image/png',data:'<BASE64>'}])
|
||||||
|
```
|
||||||
|
If you want only the tree bubble and not re-send data to the API, set {toAPI:false, tree:true}.
|
||||||
Reference in New Issue
Block a user