@ai-sdk/vue 1.2.12 → 2.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +353 -27
- package/README.md +0 -1
- package/dist/index.d.mts +9 -155
- package/dist/index.d.ts +9 -155
- package/dist/index.js +62 -466
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -474
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,63 +1,389 @@
|
|
|
1
1
|
# @ai-sdk/vue
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 2.0.0-alpha.10
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 98f25e5: chore (ui): remove managed chat inputs
|
|
8
|
+
- 98f25e5: chore (ui/vue): replace useChat with new Chat
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies [98f25e5]
|
|
13
|
+
- Updated dependencies [7bb58d4]
|
|
14
|
+
- ai@5.0.0-alpha.10
|
|
15
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.10
|
|
16
|
+
|
|
17
|
+
## 2.0.0-alpha.9
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [8255639]
|
|
22
|
+
- Updated dependencies [9ae327d]
|
|
23
|
+
- ai@5.0.0-alpha.9
|
|
24
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.9
|
|
25
|
+
|
|
26
|
+
## 2.0.0-alpha.8
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [4fef487]
|
|
31
|
+
- Updated dependencies [6b1c55c]
|
|
32
|
+
- Updated dependencies [2e4f9e4]
|
|
33
|
+
- Updated dependencies [c25cbce]
|
|
34
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.8
|
|
35
|
+
- ai@5.0.0-alpha.8
|
|
36
|
+
|
|
37
|
+
## 2.0.0-alpha.7
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [db345da]
|
|
42
|
+
- Updated dependencies [9b0da33]
|
|
43
|
+
- Updated dependencies [247ee0c]
|
|
44
|
+
- ai@5.0.0-alpha.7
|
|
45
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.7
|
|
46
|
+
|
|
47
|
+
## 2.0.0-alpha.6
|
|
48
|
+
|
|
49
|
+
### Major Changes
|
|
50
|
+
|
|
51
|
+
- 8cbbad6: chore (ai): refactor and use chatstore in vue
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- Updated dependencies [0d2c085]
|
|
56
|
+
- Updated dependencies [48a7606]
|
|
57
|
+
- ai@5.0.0-alpha.6
|
|
58
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.6
|
|
59
|
+
|
|
60
|
+
## 2.0.0-alpha.5
|
|
61
|
+
|
|
62
|
+
### Patch Changes
|
|
63
|
+
|
|
64
|
+
- Updated dependencies [655cf3c]
|
|
65
|
+
- Updated dependencies [1675396]
|
|
66
|
+
- Updated dependencies [cf9af6e]
|
|
67
|
+
- Updated dependencies [ef256ed]
|
|
68
|
+
- Updated dependencies [1ed0287]
|
|
69
|
+
- Updated dependencies [825e8d7]
|
|
70
|
+
- Updated dependencies [7324c21]
|
|
71
|
+
- ai@5.0.0-alpha.5
|
|
72
|
+
|
|
73
|
+
## 2.0.0-alpha.4
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- Updated dependencies [b32c141]
|
|
78
|
+
- Updated dependencies [72d7d72]
|
|
79
|
+
- Updated dependencies [9315076]
|
|
80
|
+
- Updated dependencies [7d97ab6]
|
|
81
|
+
- Updated dependencies [37a916d]
|
|
82
|
+
- Updated dependencies [5f2b3d4]
|
|
83
|
+
- ai@5.0.0-alpha.4
|
|
84
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.4
|
|
85
|
+
|
|
86
|
+
## 2.0.0-alpha.3
|
|
87
|
+
|
|
88
|
+
### Patch Changes
|
|
89
|
+
|
|
90
|
+
- Updated dependencies [ab7ccef]
|
|
91
|
+
- Updated dependencies [257224b]
|
|
92
|
+
- Updated dependencies [0463011]
|
|
93
|
+
- Updated dependencies [d306260]
|
|
94
|
+
- ai@5.0.0-alpha.3
|
|
95
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.3
|
|
96
|
+
|
|
97
|
+
## 2.0.0-alpha.2
|
|
98
|
+
|
|
99
|
+
### Patch Changes
|
|
100
|
+
|
|
101
|
+
- Updated dependencies [82aa95d]
|
|
102
|
+
- ai@5.0.0-alpha.2
|
|
103
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.2
|
|
104
|
+
|
|
105
|
+
## 2.0.0-alpha.1
|
|
106
|
+
|
|
107
|
+
### Patch Changes
|
|
108
|
+
|
|
109
|
+
- Updated dependencies [b346545]
|
|
110
|
+
- Updated dependencies [109c0ac]
|
|
111
|
+
- ai@5.0.0-alpha.1
|
|
112
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.1
|
|
113
|
+
|
|
114
|
+
## 2.0.0-canary.23
|
|
115
|
+
|
|
116
|
+
### Patch Changes
|
|
117
|
+
|
|
118
|
+
- Updated dependencies [bedb239]
|
|
119
|
+
- Updated dependencies [507ac1d]
|
|
120
|
+
- Updated dependencies [2b9bbcd]
|
|
121
|
+
- Updated dependencies [f7e8bf4]
|
|
122
|
+
- Updated dependencies [cda32ba]
|
|
123
|
+
- Updated dependencies [50f0362]
|
|
124
|
+
- Updated dependencies [ed675de]
|
|
125
|
+
- Updated dependencies [faf8446]
|
|
126
|
+
- Updated dependencies [64f6d64]
|
|
127
|
+
- ai@5.0.0-canary.24
|
|
128
|
+
- @ai-sdk/provider-utils@3.0.0-canary.19
|
|
129
|
+
|
|
130
|
+
## 2.0.0-canary.22
|
|
131
|
+
|
|
132
|
+
### Major Changes
|
|
133
|
+
|
|
134
|
+
- 40acf9b: feat (ui): introduce ChatStore and ChatTransport
|
|
135
|
+
|
|
136
|
+
### Patch Changes
|
|
137
|
+
|
|
138
|
+
- Updated dependencies [40acf9b]
|
|
139
|
+
- @ai-sdk/provider-utils@3.0.0-canary.18
|
|
140
|
+
- ai@5.0.0-canary.23
|
|
141
|
+
|
|
142
|
+
## 2.0.0-canary.21
|
|
143
|
+
|
|
144
|
+
### Patch Changes
|
|
145
|
+
|
|
146
|
+
- Updated dependencies [e7dc6c7]
|
|
147
|
+
- Updated dependencies [a34eb39]
|
|
148
|
+
- Updated dependencies [b33ed7a]
|
|
149
|
+
- Updated dependencies [765f1cd]
|
|
150
|
+
- ai@5.0.0-canary.22
|
|
151
|
+
|
|
152
|
+
## 2.0.0-canary.20
|
|
153
|
+
|
|
154
|
+
### Patch Changes
|
|
155
|
+
|
|
156
|
+
- cff5a9e: fix (ai-sdk/vue): fix status reactivity
|
|
157
|
+
- Updated dependencies [d964901]
|
|
158
|
+
- Updated dependencies [0560977]
|
|
159
|
+
- Updated dependencies [66af894]
|
|
160
|
+
- Updated dependencies [516be5b]
|
|
161
|
+
- Updated dependencies [bfbfc4c]
|
|
162
|
+
- Updated dependencies [ea7a7c9]
|
|
163
|
+
- Updated dependencies [1409e13]
|
|
164
|
+
- ai@5.0.0-canary.21
|
|
165
|
+
- @ai-sdk/provider-utils@3.0.0-canary.17
|
|
166
|
+
|
|
167
|
+
## 2.0.0-canary.19
|
|
168
|
+
|
|
169
|
+
### Patch Changes
|
|
170
|
+
|
|
171
|
+
- Updated dependencies [13fef90]
|
|
172
|
+
- Updated dependencies [e90d45d]
|
|
173
|
+
- Updated dependencies [bc3109f]
|
|
174
|
+
- Updated dependencies [496bbc1]
|
|
175
|
+
- Updated dependencies [da70d79]
|
|
176
|
+
- Updated dependencies [bcea599]
|
|
177
|
+
- Updated dependencies [48d675a]
|
|
178
|
+
- Updated dependencies [c7710a9]
|
|
179
|
+
- Updated dependencies [87b828f]
|
|
180
|
+
- Updated dependencies [35fc02c]
|
|
181
|
+
- Updated dependencies [b983b51]
|
|
182
|
+
- ai@5.0.0-canary.20
|
|
183
|
+
- @ai-sdk/provider-utils@3.0.0-canary.16
|
|
184
|
+
|
|
185
|
+
## 2.0.0-canary.18
|
|
186
|
+
|
|
187
|
+
### Patch Changes
|
|
188
|
+
|
|
189
|
+
- Updated dependencies [2d03e19]
|
|
190
|
+
- Updated dependencies [319b989]
|
|
191
|
+
- Updated dependencies [441d042]
|
|
192
|
+
- Updated dependencies [dcc549b]
|
|
193
|
+
- Updated dependencies [cb2b53a]
|
|
194
|
+
- Updated dependencies [e244a78]
|
|
195
|
+
- ai@5.0.0-canary.19
|
|
196
|
+
|
|
197
|
+
## 2.0.0-canary.17
|
|
198
|
+
|
|
199
|
+
### Patch Changes
|
|
200
|
+
|
|
201
|
+
- Updated dependencies [a571d6e]
|
|
202
|
+
- Updated dependencies [c60f895]
|
|
203
|
+
- Updated dependencies [332167b]
|
|
204
|
+
- Updated dependencies [a8c8bd5]
|
|
205
|
+
- Updated dependencies [a662dea]
|
|
206
|
+
- Updated dependencies [41fa418]
|
|
207
|
+
- @ai-sdk/provider-utils@3.0.0-canary.15
|
|
208
|
+
- ai@5.0.0-canary.18
|
|
209
|
+
|
|
210
|
+
## 2.0.0-canary.16
|
|
211
|
+
|
|
212
|
+
### Patch Changes
|
|
213
|
+
|
|
214
|
+
- Updated dependencies [f04fb4a]
|
|
215
|
+
- Updated dependencies [fd1924b]
|
|
216
|
+
- Updated dependencies [957b739]
|
|
217
|
+
- Updated dependencies [fafc3f2]
|
|
218
|
+
- Updated dependencies [c9ad635]
|
|
219
|
+
- Updated dependencies [9bd5ab5]
|
|
220
|
+
- Updated dependencies [92cb0a2]
|
|
221
|
+
- ai@5.0.0-canary.17
|
|
222
|
+
- @ai-sdk/provider-utils@3.0.0-canary.14
|
|
223
|
+
|
|
224
|
+
## 2.0.0-canary.15
|
|
225
|
+
|
|
226
|
+
### Patch Changes
|
|
227
|
+
|
|
228
|
+
- Updated dependencies [ec78cdc]
|
|
229
|
+
- Updated dependencies [9b4d074]
|
|
230
|
+
- Updated dependencies [8b86e99]
|
|
231
|
+
- Updated dependencies [28ad69e]
|
|
232
|
+
- Updated dependencies [2524fc7]
|
|
233
|
+
- Updated dependencies [ec5933d]
|
|
234
|
+
- Updated dependencies [175b868]
|
|
235
|
+
- ai@5.0.0-canary.16
|
|
236
|
+
|
|
237
|
+
## 2.0.0-canary.14
|
|
238
|
+
|
|
239
|
+
### Patch Changes
|
|
240
|
+
|
|
241
|
+
- Updated dependencies [d9209ca]
|
|
242
|
+
- Updated dependencies [ea27cc6]
|
|
243
|
+
- Updated dependencies [0ff02bb]
|
|
244
|
+
- Updated dependencies [4bfe9ec]
|
|
245
|
+
- Updated dependencies [2877a74]
|
|
246
|
+
- ai@5.0.0-canary.15
|
|
247
|
+
- @ai-sdk/provider-utils@3.0.0-canary.13
|
|
248
|
+
|
|
249
|
+
## 2.0.0-canary.13
|
|
250
|
+
|
|
251
|
+
### Patch Changes
|
|
252
|
+
|
|
253
|
+
- Updated dependencies [9bf7291]
|
|
254
|
+
- Updated dependencies [4617fab]
|
|
255
|
+
- Updated dependencies [a76a62b]
|
|
256
|
+
- ai@5.0.0-canary.14
|
|
257
|
+
- @ai-sdk/provider-utils@3.0.0-canary.12
|
|
258
|
+
|
|
259
|
+
## 2.0.0-canary.12
|
|
4
260
|
|
|
5
261
|
### Patch Changes
|
|
6
262
|
|
|
7
|
-
-
|
|
263
|
+
- Updated dependencies [14cb3be]
|
|
264
|
+
- Updated dependencies [66962ed]
|
|
265
|
+
- Updated dependencies [9301f86]
|
|
266
|
+
- ai@5.0.0-canary.13
|
|
267
|
+
- @ai-sdk/provider-utils@3.0.0-canary.11
|
|
8
268
|
|
|
9
|
-
##
|
|
269
|
+
## 2.0.0-canary.11
|
|
10
270
|
|
|
11
271
|
### Patch Changes
|
|
12
272
|
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
- @ai-sdk/ui-utils@1.2.11
|
|
273
|
+
- ai@5.0.0-canary.12
|
|
274
|
+
- @ai-sdk/provider-utils@3.0.0-canary.10
|
|
16
275
|
|
|
17
|
-
##
|
|
276
|
+
## 2.0.0-canary.10
|
|
18
277
|
|
|
19
278
|
### Patch Changes
|
|
20
279
|
|
|
21
|
-
- Updated dependencies [
|
|
22
|
-
-
|
|
280
|
+
- Updated dependencies [8e64e9c]
|
|
281
|
+
- ai@5.0.0-canary.11
|
|
282
|
+
- @ai-sdk/provider-utils@3.0.0-canary.9
|
|
23
283
|
|
|
24
|
-
##
|
|
284
|
+
## 2.0.0-canary.9
|
|
25
285
|
|
|
26
286
|
### Patch Changes
|
|
27
287
|
|
|
28
|
-
-
|
|
29
|
-
- Updated dependencies [
|
|
30
|
-
-
|
|
288
|
+
- Updated dependencies [d8aeaef]
|
|
289
|
+
- Updated dependencies [3e10408]
|
|
290
|
+
- ai@5.0.0-canary.10
|
|
31
291
|
|
|
32
|
-
##
|
|
292
|
+
## 2.0.0-canary.8
|
|
33
293
|
|
|
34
294
|
### Patch Changes
|
|
35
295
|
|
|
36
|
-
-
|
|
37
|
-
-
|
|
296
|
+
- Updated dependencies [a847c3e]
|
|
297
|
+
- Updated dependencies [5d142ab]
|
|
298
|
+
- Updated dependencies [cb9c9e4]
|
|
299
|
+
- Updated dependencies [8aa9e20]
|
|
300
|
+
- Updated dependencies [b32e192]
|
|
301
|
+
- ai@5.0.0-canary.9
|
|
302
|
+
- @ai-sdk/provider-utils@3.0.0-canary.8
|
|
38
303
|
|
|
39
|
-
##
|
|
304
|
+
## 2.0.0-canary.7
|
|
40
305
|
|
|
41
306
|
### Patch Changes
|
|
42
307
|
|
|
43
|
-
-
|
|
44
|
-
-
|
|
308
|
+
- Updated dependencies [5d1e3ba]
|
|
309
|
+
- Updated dependencies [26735b5]
|
|
310
|
+
- Updated dependencies [14c9410]
|
|
311
|
+
- Updated dependencies [7827a49]
|
|
312
|
+
- Updated dependencies [bd8a36c]
|
|
313
|
+
- Updated dependencies [b6f9f3c]
|
|
314
|
+
- Updated dependencies [92c8e66]
|
|
315
|
+
- Updated dependencies [fd65bc6]
|
|
316
|
+
- Updated dependencies [5bdff05]
|
|
317
|
+
- ai@5.0.0-canary.8
|
|
318
|
+
- @ai-sdk/provider-utils@3.0.0-canary.7
|
|
45
319
|
|
|
46
|
-
##
|
|
320
|
+
## 2.0.0-canary.6
|
|
47
321
|
|
|
48
322
|
### Patch Changes
|
|
49
323
|
|
|
50
|
-
- Updated dependencies [
|
|
51
|
-
|
|
52
|
-
|
|
324
|
+
- Updated dependencies [0b78e17]
|
|
325
|
+
- Updated dependencies [6fba4c7]
|
|
326
|
+
- Updated dependencies [3e3b9df]
|
|
327
|
+
- Updated dependencies [1766ede]
|
|
328
|
+
- Updated dependencies [f10304b]
|
|
329
|
+
- ai@5.0.0-canary.7
|
|
330
|
+
- @ai-sdk/provider-utils@3.0.0-canary.6
|
|
331
|
+
|
|
332
|
+
## 2.0.0-canary.5
|
|
333
|
+
|
|
334
|
+
### Patch Changes
|
|
335
|
+
|
|
336
|
+
- ai@5.0.0-canary.6
|
|
337
|
+
- @ai-sdk/provider-utils@3.0.0-canary.5
|
|
338
|
+
|
|
339
|
+
## 2.0.0-canary.4
|
|
340
|
+
|
|
341
|
+
### Patch Changes
|
|
342
|
+
|
|
343
|
+
- Updated dependencies [b71fe8d]
|
|
344
|
+
- Updated dependencies [d91b50d]
|
|
345
|
+
- ai@5.0.0-canary.5
|
|
346
|
+
- @ai-sdk/provider-utils@3.0.0-canary.4
|
|
347
|
+
|
|
348
|
+
## 2.0.0-canary.3
|
|
349
|
+
|
|
350
|
+
### Patch Changes
|
|
351
|
+
|
|
352
|
+
- Updated dependencies [a166433]
|
|
353
|
+
- Updated dependencies [9f95b35]
|
|
354
|
+
- @ai-sdk/provider-utils@3.0.0-canary.3
|
|
355
|
+
- @ai-sdk/ui-utils@2.0.0-canary.3
|
|
356
|
+
|
|
357
|
+
## 2.0.0-canary.2
|
|
358
|
+
|
|
359
|
+
### Patch Changes
|
|
360
|
+
|
|
361
|
+
- @ai-sdk/provider-utils@3.0.0-canary.2
|
|
362
|
+
- @ai-sdk/ui-utils@2.0.0-canary.2
|
|
363
|
+
|
|
364
|
+
## 2.0.0-canary.1
|
|
365
|
+
|
|
366
|
+
### Patch Changes
|
|
367
|
+
|
|
368
|
+
- Updated dependencies [060370c]
|
|
369
|
+
- Updated dependencies [0c0c0b3]
|
|
370
|
+
- Updated dependencies [63d791d]
|
|
371
|
+
- @ai-sdk/provider-utils@3.0.0-canary.1
|
|
372
|
+
- @ai-sdk/ui-utils@2.0.0-canary.1
|
|
373
|
+
|
|
374
|
+
## 2.0.0-canary.0
|
|
375
|
+
|
|
376
|
+
### Major Changes
|
|
53
377
|
|
|
54
|
-
|
|
378
|
+
- d5f588f: AI SDK 5
|
|
379
|
+
- 9477ebb: chore (ui): remove useAssistant hook (**breaking change**)
|
|
55
380
|
|
|
56
381
|
### Patch Changes
|
|
57
382
|
|
|
58
|
-
- Updated dependencies [
|
|
59
|
-
|
|
60
|
-
- @ai-sdk/
|
|
383
|
+
- Updated dependencies [d5f588f]
|
|
384
|
+
- Updated dependencies [9477ebb]
|
|
385
|
+
- @ai-sdk/provider-utils@3.0.0-canary.0
|
|
386
|
+
- @ai-sdk/ui-utils@2.0.0-canary.0
|
|
61
387
|
|
|
62
388
|
## 1.2.4
|
|
63
389
|
|
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,89 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import { Ref
|
|
4
|
-
|
|
5
|
-
type UseChatHelpers = {
|
|
6
|
-
/** Current messages in the chat */
|
|
7
|
-
messages: Ref<UIMessage[]>;
|
|
8
|
-
/** The error object of the API request */
|
|
9
|
-
error: Ref<undefined | Error>;
|
|
10
|
-
/**
|
|
11
|
-
* Append a user message to the chat list. This triggers the API call to fetch
|
|
12
|
-
* the assistant's response.
|
|
13
|
-
*/
|
|
14
|
-
append: (message: Message | CreateMessage, chatRequestOptions?: ChatRequestOptions) => Promise<string | null | undefined>;
|
|
15
|
-
/**
|
|
16
|
-
* Reload the last AI chat response for the given chat history. If the last
|
|
17
|
-
* message isn't from the assistant, it will request the API to generate a
|
|
18
|
-
* new response.
|
|
19
|
-
*/
|
|
20
|
-
reload: (chatRequestOptions?: ChatRequestOptions) => Promise<string | null | undefined>;
|
|
21
|
-
/**
|
|
22
|
-
* Abort the current request immediately, keep the generated tokens if any.
|
|
23
|
-
*/
|
|
24
|
-
stop: () => void;
|
|
25
|
-
/**
|
|
26
|
-
* Update the `messages` state locally. This is useful when you want to
|
|
27
|
-
* edit the messages on the client, and then trigger the `reload` method
|
|
28
|
-
* manually to regenerate the AI response.
|
|
29
|
-
*/
|
|
30
|
-
setMessages: (messages: Message[] | ((messages: Message[]) => Message[])) => void;
|
|
31
|
-
/** The current value of the input */
|
|
32
|
-
input: Ref<string>;
|
|
33
|
-
/** Form submission handler to automatically reset input and append a user message */
|
|
34
|
-
handleSubmit: (event?: {
|
|
35
|
-
preventDefault?: () => void;
|
|
36
|
-
}, chatRequestOptions?: ChatRequestOptions) => void;
|
|
37
|
-
/**
|
|
38
|
-
* Whether the API request is in progress
|
|
39
|
-
*
|
|
40
|
-
* @deprecated use `status` instead
|
|
41
|
-
*/
|
|
42
|
-
isLoading: Ref<boolean>;
|
|
43
|
-
/**
|
|
44
|
-
* Hook status:
|
|
45
|
-
*
|
|
46
|
-
* - `submitted`: The message has been sent to the API and we're awaiting the start of the response stream.
|
|
47
|
-
* - `streaming`: The response is actively streaming in from the API, receiving chunks of data.
|
|
48
|
-
* - `ready`: The full response has been received and processed; a new user message can be submitted.
|
|
49
|
-
* - `error`: An error occurred during the API request, preventing successful completion.
|
|
50
|
-
*/
|
|
51
|
-
status: Ref<'submitted' | 'streaming' | 'ready' | 'error'>;
|
|
52
|
-
/** Additional data added on the server via StreamData. */
|
|
53
|
-
data: Ref<JSONValue[] | undefined>;
|
|
54
|
-
/** Set the data of the chat. You can use this to transform or clear the chat data. */
|
|
55
|
-
setData: (data: JSONValue[] | undefined | ((data: JSONValue[] | undefined) => JSONValue[] | undefined)) => void;
|
|
56
|
-
addToolResult: ({ toolCallId, result, }: {
|
|
57
|
-
toolCallId: string;
|
|
58
|
-
result: any;
|
|
59
|
-
}) => void;
|
|
60
|
-
/** The id of the chat */
|
|
61
|
-
id: string;
|
|
62
|
-
};
|
|
63
|
-
declare function useChat({ api, id, initialMessages, initialInput, sendExtraMessageFields, streamProtocol, onResponse, onFinish, onError, credentials, headers: metadataHeaders, body: metadataBody, generateId, onToolCall, fetch, keepLastMessageOnError, maxSteps, experimental_prepareRequestBody, }?: UseChatOptions & {
|
|
64
|
-
/**
|
|
65
|
-
* Maximum number of sequential LLM calls (steps), e.g. when you use tool calls. Must be at least 1.
|
|
66
|
-
* A maximum number is required to prevent infinite loops in the case of misconfigured tools.
|
|
67
|
-
* By default, it's set to 1, which means that only a single LLM call is made.
|
|
68
|
-
*/
|
|
69
|
-
maxSteps?: number;
|
|
70
|
-
/**
|
|
71
|
-
* Experimental (Vue only). When a function is provided, it will be used
|
|
72
|
-
* to prepare the request body for the chat API. This can be useful for
|
|
73
|
-
* customizing the request body based on the messages and data in the chat.
|
|
74
|
-
*
|
|
75
|
-
* @param id The chat ID
|
|
76
|
-
* @param messages The current messages in the chat
|
|
77
|
-
* @param requestData The data object passed in the chat request
|
|
78
|
-
* @param requestBody The request body object passed in the chat request
|
|
79
|
-
*/
|
|
80
|
-
experimental_prepareRequestBody?: (options: {
|
|
81
|
-
id: string;
|
|
82
|
-
messages: UIMessage[];
|
|
83
|
-
requestData?: JSONValue;
|
|
84
|
-
requestBody?: object;
|
|
85
|
-
}) => unknown;
|
|
86
|
-
}): UseChatHelpers;
|
|
1
|
+
import { CompletionRequestOptions, UseCompletionOptions, UIDataPartSchemas, AbstractChat, ChatInit } from 'ai';
|
|
2
|
+
export { UseCompletionOptions } from 'ai';
|
|
3
|
+
import { Ref } from 'vue';
|
|
87
4
|
|
|
88
5
|
type UseCompletionHelpers = {
|
|
89
6
|
/** The current completion result */
|
|
@@ -93,7 +10,7 @@ type UseCompletionHelpers = {
|
|
|
93
10
|
/**
|
|
94
11
|
* Send a new prompt to the API endpoint and update the completion state.
|
|
95
12
|
*/
|
|
96
|
-
complete: (prompt: string, options?:
|
|
13
|
+
complete: (prompt: string, options?: CompletionRequestOptions) => Promise<string | null | undefined>;
|
|
97
14
|
/**
|
|
98
15
|
* Abort the current API request but keep the generated tokens.
|
|
99
16
|
*/
|
|
@@ -118,74 +35,11 @@ type UseCompletionHelpers = {
|
|
|
118
35
|
}) => void;
|
|
119
36
|
/** Whether the API request is in progress */
|
|
120
37
|
isLoading: Ref<boolean | undefined>;
|
|
121
|
-
/** Additional data added on the server via StreamData */
|
|
122
|
-
data: Ref<JSONValue[] | undefined>;
|
|
123
38
|
};
|
|
124
|
-
declare function useCompletion({ api, id, initialCompletion, initialInput, credentials, headers, body, streamProtocol,
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* A vue.js composable function to interact with the assistant API.
|
|
128
|
-
*/
|
|
39
|
+
declare function useCompletion({ api, id, initialCompletion, initialInput, credentials, headers, body, streamProtocol, onFinish, onError, fetch, }?: UseCompletionOptions): UseCompletionHelpers;
|
|
129
40
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
*/
|
|
134
|
-
messages: Ref<Message[]>;
|
|
135
|
-
/**
|
|
136
|
-
* Update the message store with a new array of messages.
|
|
137
|
-
*/
|
|
138
|
-
setMessages: (messagesProcessor: (messages: Message[]) => Message[]) => void;
|
|
139
|
-
/**
|
|
140
|
-
* The current thread ID.
|
|
141
|
-
*/
|
|
142
|
-
threadId: Ref<string | undefined>;
|
|
143
|
-
/**
|
|
144
|
-
* Set the current thread ID. Specifying a thread ID will switch to that thread, if it exists. If set to 'undefined', a new thread will be created. For both cases, `threadId` will be updated with the new value and `messages` will be cleared.
|
|
145
|
-
*/
|
|
146
|
-
setThreadId: (threadId: string | undefined) => void;
|
|
147
|
-
/**
|
|
148
|
-
* The current value of the input field.
|
|
149
|
-
*/
|
|
150
|
-
input: Ref<string>;
|
|
151
|
-
/**
|
|
152
|
-
* Append a user message to the chat list. This triggers the API call to fetch
|
|
153
|
-
* the assistant's response.
|
|
154
|
-
* @param message The message to append
|
|
155
|
-
* @param requestOptions Additional options to pass to the API call
|
|
156
|
-
*/
|
|
157
|
-
append: (message: Message | CreateMessage, requestOptions?: {
|
|
158
|
-
data?: Record<string, string>;
|
|
159
|
-
}) => Promise<void>;
|
|
160
|
-
/**
|
|
161
|
-
* Abort the current request immediately, keep the generated tokens if any.
|
|
162
|
-
*/
|
|
163
|
-
stop: ComputedRef<() => void>;
|
|
164
|
-
/**
|
|
165
|
-
* Handler for the `onChange` event of the input field to control the input's value.
|
|
166
|
-
*/
|
|
167
|
-
handleInputChange: (e: Event & {
|
|
168
|
-
target: HTMLInputElement;
|
|
169
|
-
}) => void;
|
|
170
|
-
/**
|
|
171
|
-
* Handler for the `onSubmit` event of the form to append a user message and reset the input.
|
|
172
|
-
*/
|
|
173
|
-
handleSubmit: (e: Event & {
|
|
174
|
-
target: HTMLFormElement;
|
|
175
|
-
}) => void;
|
|
176
|
-
/**
|
|
177
|
-
* Whether the assistant is currently sending a message.
|
|
178
|
-
*/
|
|
179
|
-
isSending: ComputedRef<boolean>;
|
|
180
|
-
/**
|
|
181
|
-
* The current status of the assistant.
|
|
182
|
-
*/
|
|
183
|
-
status: Ref<AssistantStatus>;
|
|
184
|
-
/**
|
|
185
|
-
* The current error, if any.
|
|
186
|
-
*/
|
|
187
|
-
error: Ref<Error | undefined>;
|
|
188
|
-
};
|
|
189
|
-
declare function useAssistant({ api, threadId: threadIdParam, credentials, headers, body, onError, }: UseAssistantOptions): UseAssistantHelpers;
|
|
41
|
+
declare class Chat<MESSAGE_METADATA, UI_DATA_PART_SCHEMAS extends UIDataPartSchemas = UIDataPartSchemas> extends AbstractChat<MESSAGE_METADATA, UI_DATA_PART_SCHEMAS> {
|
|
42
|
+
constructor({ messages, ...init }: ChatInit<MESSAGE_METADATA, UI_DATA_PART_SCHEMAS>);
|
|
43
|
+
}
|
|
190
44
|
|
|
191
|
-
export {
|
|
45
|
+
export { Chat, UseCompletionHelpers, useCompletion };
|