@assistant-ui/react 0.5.59 → 0.5.62

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,63 +3,17 @@ import { ReactNode } from 'react';
3
3
  import { JSONSchema7 } from 'json-schema';
4
4
  import { z } from 'zod';
5
5
 
6
- declare const LanguageModelV1CallSettingsSchema: z.ZodObject<{
7
- maxTokens: z.ZodOptional<z.ZodNumber>;
8
- temperature: z.ZodOptional<z.ZodNumber>;
9
- topP: z.ZodOptional<z.ZodNumber>;
10
- presencePenalty: z.ZodOptional<z.ZodNumber>;
11
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
12
- seed: z.ZodOptional<z.ZodNumber>;
13
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
14
- }, "strip", z.ZodTypeAny, {
15
- maxTokens?: number | undefined;
16
- temperature?: number | undefined;
17
- topP?: number | undefined;
18
- presencePenalty?: number | undefined;
19
- frequencyPenalty?: number | undefined;
20
- seed?: number | undefined;
21
- headers?: Record<string, string | undefined> | undefined;
22
- }, {
23
- maxTokens?: number | undefined;
24
- temperature?: number | undefined;
25
- topP?: number | undefined;
26
- presencePenalty?: number | undefined;
27
- frequencyPenalty?: number | undefined;
28
- seed?: number | undefined;
29
- headers?: Record<string, string | undefined> | undefined;
30
- }>;
31
- type LanguageModelV1CallSettings = z.infer<typeof LanguageModelV1CallSettingsSchema>;
32
- declare const LanguageModelConfigSchema: z.ZodObject<{
33
- apiKey: z.ZodOptional<z.ZodString>;
34
- baseUrl: z.ZodOptional<z.ZodString>;
35
- modelName: z.ZodOptional<z.ZodString>;
36
- }, "strip", z.ZodTypeAny, {
37
- apiKey?: string | undefined;
38
- baseUrl?: string | undefined;
39
- modelName?: string | undefined;
40
- }, {
41
- apiKey?: string | undefined;
42
- baseUrl?: string | undefined;
43
- modelName?: string | undefined;
44
- }>;
45
- type LanguageModelConfig = z.infer<typeof LanguageModelConfigSchema>;
46
- type ToolExecuteFunction<TArgs, TResult> = (args: TArgs, context: {
47
- abortSignal: AbortSignal;
48
- }) => TResult | Promise<TResult>;
49
- type Tool<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = {
50
- description?: string | undefined;
51
- parameters: z.ZodSchema<TArgs> | JSONSchema7;
52
- execute?: ToolExecuteFunction<TArgs, TResult>;
6
+ type BaseAttachment = {
7
+ id: string;
8
+ type: "image" | "document" | "file";
9
+ name: string;
53
10
  };
54
- type ModelConfig = {
55
- priority?: number | undefined;
56
- system?: string | undefined;
57
- tools?: Record<string, Tool<any, any>> | undefined;
58
- callSettings?: LanguageModelV1CallSettings | undefined;
59
- config?: LanguageModelConfig | undefined;
11
+ type ThreadComposerAttachment = BaseAttachment & {
12
+ file: File;
60
13
  };
61
- type ModelConfigProvider = {
62
- getModelConfig: () => ModelConfig;
14
+ type MessageAttachment = BaseAttachment & {
15
+ file?: File;
16
+ content: CoreUserContentPart[];
63
17
  };
64
18
 
65
19
  type TextContentPart = {
@@ -127,16 +81,22 @@ type MessageStatus = {
127
81
  type ThreadSystemMessage = MessageCommonProps & {
128
82
  role: "system";
129
83
  content: [TextContentPart];
84
+ status?: undefined;
85
+ attachments?: undefined;
86
+ metadata?: undefined;
130
87
  };
131
88
  type ThreadUserMessage = MessageCommonProps & {
132
89
  role: "user";
133
90
  content: ThreadUserContentPart[];
134
91
  attachments: readonly MessageAttachment[];
92
+ status?: undefined;
93
+ metadata?: undefined;
135
94
  };
136
95
  type ThreadAssistantMessage = MessageCommonProps & {
137
96
  role: "assistant";
138
97
  content: ThreadAssistantContentPart[];
139
98
  status: MessageStatus;
99
+ attachments?: undefined;
140
100
  /**
141
101
  * @deprecated Use `metadata.roundtrips` instead.
142
102
  */
@@ -168,19 +128,6 @@ type CoreAssistantMessage = {
168
128
  };
169
129
  type CoreMessage = CoreSystemMessage | CoreUserMessage | CoreAssistantMessage;
170
130
 
171
- type BaseAttachment = {
172
- id: string;
173
- type: "image" | "document" | "file";
174
- name: string;
175
- };
176
- type ThreadComposerAttachment = BaseAttachment & {
177
- file: File;
178
- };
179
- type MessageAttachment = BaseAttachment & {
180
- file?: File;
181
- content: CoreUserContentPart[];
182
- };
183
-
184
131
  declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
185
132
  system: z.ZodOptional<z.ZodString>;
186
133
  messages: z.ZodArray<z.ZodDiscriminatedUnion<"role", [z.ZodObject<{
@@ -189,23 +136,23 @@ declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendSh
189
136
  type: z.ZodLiteral<"text">;
190
137
  text: z.ZodString;
191
138
  }, "strip", z.ZodTypeAny, {
192
- type: "text";
193
139
  text: string;
194
- }, {
195
140
  type: "text";
141
+ }, {
196
142
  text: string;
143
+ type: "text";
197
144
  }>], null>;
198
145
  }, "strip", z.ZodTypeAny, {
199
146
  role: "system";
200
147
  content: [{
201
- type: "text";
202
148
  text: string;
149
+ type: "text";
203
150
  }];
204
151
  }, {
205
152
  role: "system";
206
153
  content: [{
207
- type: "text";
208
154
  text: string;
155
+ type: "text";
209
156
  }];
210
157
  }>, z.ZodObject<{
211
158
  role: z.ZodLiteral<"user">;
@@ -213,38 +160,38 @@ declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendSh
213
160
  type: z.ZodLiteral<"text">;
214
161
  text: z.ZodString;
215
162
  }, "strip", z.ZodTypeAny, {
216
- type: "text";
217
163
  text: string;
218
- }, {
219
164
  type: "text";
165
+ }, {
220
166
  text: string;
167
+ type: "text";
221
168
  }>, z.ZodObject<{
222
169
  type: z.ZodLiteral<"image">;
223
170
  image: z.ZodString;
224
171
  }, "strip", z.ZodTypeAny, {
225
- type: "image";
226
172
  image: string;
227
- }, {
228
173
  type: "image";
174
+ }, {
229
175
  image: string;
176
+ type: "image";
230
177
  }>]>, "many">;
231
178
  }, "strip", z.ZodTypeAny, {
232
179
  role: "user";
233
180
  content: ({
234
- type: "text";
235
181
  text: string;
182
+ type: "text";
236
183
  } | {
237
- type: "image";
238
184
  image: string;
185
+ type: "image";
239
186
  })[];
240
187
  }, {
241
188
  role: "user";
242
189
  content: ({
243
- type: "text";
244
190
  text: string;
191
+ type: "text";
245
192
  } | {
246
- type: "image";
247
193
  image: string;
194
+ type: "image";
248
195
  })[];
249
196
  }>, z.ZodObject<{
250
197
  role: z.ZodLiteral<"assistant">;
@@ -252,11 +199,11 @@ declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendSh
252
199
  type: z.ZodLiteral<"text">;
253
200
  text: z.ZodString;
254
201
  }, "strip", z.ZodTypeAny, {
255
- type: "text";
256
202
  text: string;
257
- }, {
258
203
  type: "text";
204
+ }, {
259
205
  text: string;
206
+ type: "text";
260
207
  }>, z.ZodObject<{
261
208
  type: z.ZodLiteral<"tool-call">;
262
209
  toolCallId: z.ZodString;
@@ -269,41 +216,41 @@ declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendSh
269
216
  toolCallId: string;
270
217
  toolName: string;
271
218
  args: Record<string, unknown>;
272
- result?: unknown;
273
219
  isError?: boolean | undefined;
220
+ result?: unknown;
274
221
  }, {
275
222
  type: "tool-call";
276
223
  toolCallId: string;
277
224
  toolName: string;
278
225
  args: Record<string, unknown>;
279
- result?: unknown;
280
226
  isError?: boolean | undefined;
227
+ result?: unknown;
281
228
  }>]>, "many">;
282
229
  }, "strip", z.ZodTypeAny, {
283
230
  role: "assistant";
284
231
  content: ({
285
- type: "text";
286
232
  text: string;
233
+ type: "text";
287
234
  } | {
288
235
  type: "tool-call";
289
236
  toolCallId: string;
290
237
  toolName: string;
291
238
  args: Record<string, unknown>;
292
- result?: unknown;
293
239
  isError?: boolean | undefined;
240
+ result?: unknown;
294
241
  })[];
295
242
  }, {
296
243
  role: "assistant";
297
244
  content: ({
298
- type: "text";
299
245
  text: string;
246
+ type: "text";
300
247
  } | {
301
248
  type: "tool-call";
302
249
  toolCallId: string;
303
250
  toolName: string;
304
251
  args: Record<string, unknown>;
305
- result?: unknown;
306
252
  isError?: boolean | undefined;
253
+ result?: unknown;
307
254
  })[];
308
255
  }>]>, "many">;
309
256
  tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -338,32 +285,33 @@ declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendSh
338
285
  messages: ({
339
286
  role: "user";
340
287
  content: ({
341
- type: "text";
342
288
  text: string;
289
+ type: "text";
343
290
  } | {
344
- type: "image";
345
291
  image: string;
292
+ type: "image";
346
293
  })[];
347
294
  } | {
348
295
  role: "assistant";
349
296
  content: ({
350
- type: "text";
351
297
  text: string;
298
+ type: "text";
352
299
  } | {
353
300
  type: "tool-call";
354
301
  toolCallId: string;
355
302
  toolName: string;
356
303
  args: Record<string, unknown>;
357
- result?: unknown;
358
304
  isError?: boolean | undefined;
305
+ result?: unknown;
359
306
  })[];
360
307
  } | {
361
308
  role: "system";
362
309
  content: [{
363
- type: "text";
364
310
  text: string;
311
+ type: "text";
365
312
  }];
366
313
  })[];
314
+ system?: string | undefined;
367
315
  maxTokens?: number | undefined;
368
316
  temperature?: number | undefined;
369
317
  topP?: number | undefined;
@@ -374,7 +322,6 @@ declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendSh
374
322
  apiKey?: string | undefined;
375
323
  baseUrl?: string | undefined;
376
324
  modelName?: string | undefined;
377
- system?: string | undefined;
378
325
  tools?: {
379
326
  type: "function";
380
327
  name: string;
@@ -385,32 +332,33 @@ declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendSh
385
332
  messages: ({
386
333
  role: "user";
387
334
  content: ({
388
- type: "text";
389
335
  text: string;
336
+ type: "text";
390
337
  } | {
391
- type: "image";
392
338
  image: string;
339
+ type: "image";
393
340
  })[];
394
341
  } | {
395
342
  role: "assistant";
396
343
  content: ({
397
- type: "text";
398
344
  text: string;
345
+ type: "text";
399
346
  } | {
400
347
  type: "tool-call";
401
348
  toolCallId: string;
402
349
  toolName: string;
403
350
  args: Record<string, unknown>;
404
- result?: unknown;
405
351
  isError?: boolean | undefined;
352
+ result?: unknown;
406
353
  })[];
407
354
  } | {
408
355
  role: "system";
409
356
  content: [{
410
- type: "text";
411
357
  text: string;
358
+ type: "text";
412
359
  }];
413
360
  })[];
361
+ system?: string | undefined;
414
362
  maxTokens?: number | undefined;
415
363
  temperature?: number | undefined;
416
364
  topP?: number | undefined;
@@ -421,7 +369,6 @@ declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendSh
421
369
  apiKey?: string | undefined;
422
370
  baseUrl?: string | undefined;
423
371
  modelName?: string | undefined;
424
- system?: string | undefined;
425
372
  tools?: {
426
373
  type: "function";
427
374
  name: string;
@@ -431,6 +378,65 @@ declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendSh
431
378
  }>;
432
379
  type EdgeRuntimeRequestOptions = z.infer<typeof EdgeRuntimeRequestOptionsSchema>;
433
380
 
381
+ declare const LanguageModelV1CallSettingsSchema: z.ZodObject<{
382
+ maxTokens: z.ZodOptional<z.ZodNumber>;
383
+ temperature: z.ZodOptional<z.ZodNumber>;
384
+ topP: z.ZodOptional<z.ZodNumber>;
385
+ presencePenalty: z.ZodOptional<z.ZodNumber>;
386
+ frequencyPenalty: z.ZodOptional<z.ZodNumber>;
387
+ seed: z.ZodOptional<z.ZodNumber>;
388
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
389
+ }, "strip", z.ZodTypeAny, {
390
+ maxTokens?: number | undefined;
391
+ temperature?: number | undefined;
392
+ topP?: number | undefined;
393
+ presencePenalty?: number | undefined;
394
+ frequencyPenalty?: number | undefined;
395
+ seed?: number | undefined;
396
+ headers?: Record<string, string | undefined> | undefined;
397
+ }, {
398
+ maxTokens?: number | undefined;
399
+ temperature?: number | undefined;
400
+ topP?: number | undefined;
401
+ presencePenalty?: number | undefined;
402
+ frequencyPenalty?: number | undefined;
403
+ seed?: number | undefined;
404
+ headers?: Record<string, string | undefined> | undefined;
405
+ }>;
406
+ type LanguageModelV1CallSettings = z.infer<typeof LanguageModelV1CallSettingsSchema>;
407
+ declare const LanguageModelConfigSchema: z.ZodObject<{
408
+ apiKey: z.ZodOptional<z.ZodString>;
409
+ baseUrl: z.ZodOptional<z.ZodString>;
410
+ modelName: z.ZodOptional<z.ZodString>;
411
+ }, "strip", z.ZodTypeAny, {
412
+ apiKey?: string | undefined;
413
+ baseUrl?: string | undefined;
414
+ modelName?: string | undefined;
415
+ }, {
416
+ apiKey?: string | undefined;
417
+ baseUrl?: string | undefined;
418
+ modelName?: string | undefined;
419
+ }>;
420
+ type LanguageModelConfig = z.infer<typeof LanguageModelConfigSchema>;
421
+ type ToolExecuteFunction<TArgs, TResult> = (args: TArgs, context: {
422
+ abortSignal: AbortSignal;
423
+ }) => TResult | Promise<TResult>;
424
+ type Tool<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = {
425
+ description?: string | undefined;
426
+ parameters: z.ZodSchema<TArgs> | JSONSchema7;
427
+ execute?: ToolExecuteFunction<TArgs, TResult>;
428
+ };
429
+ type ModelConfig = {
430
+ priority?: number | undefined;
431
+ system?: string | undefined;
432
+ tools?: Record<string, Tool<any, any>> | undefined;
433
+ callSettings?: LanguageModelV1CallSettings | undefined;
434
+ config?: LanguageModelConfig | undefined;
435
+ };
436
+ type ModelConfigProvider = {
437
+ getModelConfig: () => ModelConfig;
438
+ };
439
+
434
440
  type FinishResult = {
435
441
  messages: CoreMessage[];
436
442
  metadata: {
@@ -458,4 +464,4 @@ declare const createEdgeRuntimeAPI: (options: CreateEdgeRuntimeAPIOptions) => {
458
464
  POST: (request: Request) => Promise<Response>;
459
465
  };
460
466
 
461
- export { type AppendMessage as A, type ContentPartStatus as C, type EdgeRuntimeRequestOptions as E, type ImageContentPart as I, type MessageStatus as M, type ThreadAssistantContentPart as T, type UIContentPart as U, type ThreadRoundtrip as a, type ThreadMessage as b, type ModelConfig as c, type ModelConfigProvider as d, type TextContentPart as e, type ToolCallContentPart as f, type ToolCallContentPartStatus as g, type CoreMessage as h, type ThreadComposerAttachment as i, type MessageAttachment as j, type Tool as k, type CoreToolCallContentPart as l, type CreateEdgeRuntimeAPIOptions as m, type ThreadUserContentPart as n, type ThreadSystemMessage as o, type ThreadAssistantMessage as p, type ThreadUserMessage as q, type CoreUserContentPart as r, type CoreAssistantContentPart as s, type CoreSystemMessage as t, type CoreUserMessage as u, type CoreAssistantMessage as v, createEdgeRuntimeAPI as w, getEdgeRuntimeResponse as x };
467
+ export { type AppendMessage as A, type ContentPartStatus as C, type EdgeRuntimeRequestOptions as E, type ImageContentPart as I, type ModelConfig as M, type TextContentPart as T, type UIContentPart as U, type ToolCallContentPart as a, type ToolCallContentPartStatus as b, type ThreadMessage as c, type CoreMessage as d, type ThreadComposerAttachment as e, type ModelConfigProvider as f, type ThreadAssistantContentPart as g, type MessageStatus as h, type ThreadRoundtrip as i, type MessageAttachment as j, type Tool as k, type CoreToolCallContentPart as l, type CreateEdgeRuntimeAPIOptions as m, type ThreadUserContentPart as n, type ThreadSystemMessage as o, type ThreadAssistantMessage as p, type ThreadUserMessage as q, type CoreUserContentPart as r, type CoreAssistantContentPart as s, type CoreSystemMessage as t, type CoreUserMessage as u, type CoreAssistantMessage as v, createEdgeRuntimeAPI as w, getEdgeRuntimeResponse as x };