@assistant-ui/react 0.5.58 → 0.5.60

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 = {
@@ -168,19 +122,6 @@ type CoreAssistantMessage = {
168
122
  };
169
123
  type CoreMessage = CoreSystemMessage | CoreUserMessage | CoreAssistantMessage;
170
124
 
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
125
  declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
185
126
  system: z.ZodOptional<z.ZodString>;
186
127
  messages: z.ZodArray<z.ZodDiscriminatedUnion<"role", [z.ZodObject<{
@@ -189,23 +130,23 @@ declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendSh
189
130
  type: z.ZodLiteral<"text">;
190
131
  text: z.ZodString;
191
132
  }, "strip", z.ZodTypeAny, {
192
- type: "text";
193
133
  text: string;
194
- }, {
195
134
  type: "text";
135
+ }, {
196
136
  text: string;
137
+ type: "text";
197
138
  }>], null>;
198
139
  }, "strip", z.ZodTypeAny, {
199
140
  role: "system";
200
141
  content: [{
201
- type: "text";
202
142
  text: string;
143
+ type: "text";
203
144
  }];
204
145
  }, {
205
146
  role: "system";
206
147
  content: [{
207
- type: "text";
208
148
  text: string;
149
+ type: "text";
209
150
  }];
210
151
  }>, z.ZodObject<{
211
152
  role: z.ZodLiteral<"user">;
@@ -213,38 +154,38 @@ declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendSh
213
154
  type: z.ZodLiteral<"text">;
214
155
  text: z.ZodString;
215
156
  }, "strip", z.ZodTypeAny, {
216
- type: "text";
217
157
  text: string;
218
- }, {
219
158
  type: "text";
159
+ }, {
220
160
  text: string;
161
+ type: "text";
221
162
  }>, z.ZodObject<{
222
163
  type: z.ZodLiteral<"image">;
223
164
  image: z.ZodString;
224
165
  }, "strip", z.ZodTypeAny, {
225
- type: "image";
226
166
  image: string;
227
- }, {
228
167
  type: "image";
168
+ }, {
229
169
  image: string;
170
+ type: "image";
230
171
  }>]>, "many">;
231
172
  }, "strip", z.ZodTypeAny, {
232
173
  role: "user";
233
174
  content: ({
234
- type: "text";
235
175
  text: string;
176
+ type: "text";
236
177
  } | {
237
- type: "image";
238
178
  image: string;
179
+ type: "image";
239
180
  })[];
240
181
  }, {
241
182
  role: "user";
242
183
  content: ({
243
- type: "text";
244
184
  text: string;
185
+ type: "text";
245
186
  } | {
246
- type: "image";
247
187
  image: string;
188
+ type: "image";
248
189
  })[];
249
190
  }>, z.ZodObject<{
250
191
  role: z.ZodLiteral<"assistant">;
@@ -252,11 +193,11 @@ declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendSh
252
193
  type: z.ZodLiteral<"text">;
253
194
  text: z.ZodString;
254
195
  }, "strip", z.ZodTypeAny, {
255
- type: "text";
256
196
  text: string;
257
- }, {
258
197
  type: "text";
198
+ }, {
259
199
  text: string;
200
+ type: "text";
260
201
  }>, z.ZodObject<{
261
202
  type: z.ZodLiteral<"tool-call">;
262
203
  toolCallId: z.ZodString;
@@ -269,41 +210,41 @@ declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendSh
269
210
  toolCallId: string;
270
211
  toolName: string;
271
212
  args: Record<string, unknown>;
272
- result?: unknown;
273
213
  isError?: boolean | undefined;
214
+ result?: unknown;
274
215
  }, {
275
216
  type: "tool-call";
276
217
  toolCallId: string;
277
218
  toolName: string;
278
219
  args: Record<string, unknown>;
279
- result?: unknown;
280
220
  isError?: boolean | undefined;
221
+ result?: unknown;
281
222
  }>]>, "many">;
282
223
  }, "strip", z.ZodTypeAny, {
283
224
  role: "assistant";
284
225
  content: ({
285
- type: "text";
286
226
  text: string;
227
+ type: "text";
287
228
  } | {
288
229
  type: "tool-call";
289
230
  toolCallId: string;
290
231
  toolName: string;
291
232
  args: Record<string, unknown>;
292
- result?: unknown;
293
233
  isError?: boolean | undefined;
234
+ result?: unknown;
294
235
  })[];
295
236
  }, {
296
237
  role: "assistant";
297
238
  content: ({
298
- type: "text";
299
239
  text: string;
240
+ type: "text";
300
241
  } | {
301
242
  type: "tool-call";
302
243
  toolCallId: string;
303
244
  toolName: string;
304
245
  args: Record<string, unknown>;
305
- result?: unknown;
306
246
  isError?: boolean | undefined;
247
+ result?: unknown;
307
248
  })[];
308
249
  }>]>, "many">;
309
250
  tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -338,32 +279,33 @@ declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendSh
338
279
  messages: ({
339
280
  role: "user";
340
281
  content: ({
341
- type: "text";
342
282
  text: string;
283
+ type: "text";
343
284
  } | {
344
- type: "image";
345
285
  image: string;
286
+ type: "image";
346
287
  })[];
347
288
  } | {
348
289
  role: "assistant";
349
290
  content: ({
350
- type: "text";
351
291
  text: string;
292
+ type: "text";
352
293
  } | {
353
294
  type: "tool-call";
354
295
  toolCallId: string;
355
296
  toolName: string;
356
297
  args: Record<string, unknown>;
357
- result?: unknown;
358
298
  isError?: boolean | undefined;
299
+ result?: unknown;
359
300
  })[];
360
301
  } | {
361
302
  role: "system";
362
303
  content: [{
363
- type: "text";
364
304
  text: string;
305
+ type: "text";
365
306
  }];
366
307
  })[];
308
+ system?: string | undefined;
367
309
  maxTokens?: number | undefined;
368
310
  temperature?: number | undefined;
369
311
  topP?: number | undefined;
@@ -374,7 +316,6 @@ declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendSh
374
316
  apiKey?: string | undefined;
375
317
  baseUrl?: string | undefined;
376
318
  modelName?: string | undefined;
377
- system?: string | undefined;
378
319
  tools?: {
379
320
  type: "function";
380
321
  name: string;
@@ -385,32 +326,33 @@ declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendSh
385
326
  messages: ({
386
327
  role: "user";
387
328
  content: ({
388
- type: "text";
389
329
  text: string;
330
+ type: "text";
390
331
  } | {
391
- type: "image";
392
332
  image: string;
333
+ type: "image";
393
334
  })[];
394
335
  } | {
395
336
  role: "assistant";
396
337
  content: ({
397
- type: "text";
398
338
  text: string;
339
+ type: "text";
399
340
  } | {
400
341
  type: "tool-call";
401
342
  toolCallId: string;
402
343
  toolName: string;
403
344
  args: Record<string, unknown>;
404
- result?: unknown;
405
345
  isError?: boolean | undefined;
346
+ result?: unknown;
406
347
  })[];
407
348
  } | {
408
349
  role: "system";
409
350
  content: [{
410
- type: "text";
411
351
  text: string;
352
+ type: "text";
412
353
  }];
413
354
  })[];
355
+ system?: string | undefined;
414
356
  maxTokens?: number | undefined;
415
357
  temperature?: number | undefined;
416
358
  topP?: number | undefined;
@@ -421,7 +363,6 @@ declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendSh
421
363
  apiKey?: string | undefined;
422
364
  baseUrl?: string | undefined;
423
365
  modelName?: string | undefined;
424
- system?: string | undefined;
425
366
  tools?: {
426
367
  type: "function";
427
368
  name: string;
@@ -431,6 +372,65 @@ declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendSh
431
372
  }>;
432
373
  type EdgeRuntimeRequestOptions = z.infer<typeof EdgeRuntimeRequestOptionsSchema>;
433
374
 
375
+ declare const LanguageModelV1CallSettingsSchema: z.ZodObject<{
376
+ maxTokens: z.ZodOptional<z.ZodNumber>;
377
+ temperature: z.ZodOptional<z.ZodNumber>;
378
+ topP: z.ZodOptional<z.ZodNumber>;
379
+ presencePenalty: z.ZodOptional<z.ZodNumber>;
380
+ frequencyPenalty: z.ZodOptional<z.ZodNumber>;
381
+ seed: z.ZodOptional<z.ZodNumber>;
382
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
383
+ }, "strip", z.ZodTypeAny, {
384
+ maxTokens?: number | undefined;
385
+ temperature?: number | undefined;
386
+ topP?: number | undefined;
387
+ presencePenalty?: number | undefined;
388
+ frequencyPenalty?: number | undefined;
389
+ seed?: number | undefined;
390
+ headers?: Record<string, string | undefined> | undefined;
391
+ }, {
392
+ maxTokens?: number | undefined;
393
+ temperature?: number | undefined;
394
+ topP?: number | undefined;
395
+ presencePenalty?: number | undefined;
396
+ frequencyPenalty?: number | undefined;
397
+ seed?: number | undefined;
398
+ headers?: Record<string, string | undefined> | undefined;
399
+ }>;
400
+ type LanguageModelV1CallSettings = z.infer<typeof LanguageModelV1CallSettingsSchema>;
401
+ declare const LanguageModelConfigSchema: z.ZodObject<{
402
+ apiKey: z.ZodOptional<z.ZodString>;
403
+ baseUrl: z.ZodOptional<z.ZodString>;
404
+ modelName: z.ZodOptional<z.ZodString>;
405
+ }, "strip", z.ZodTypeAny, {
406
+ apiKey?: string | undefined;
407
+ baseUrl?: string | undefined;
408
+ modelName?: string | undefined;
409
+ }, {
410
+ apiKey?: string | undefined;
411
+ baseUrl?: string | undefined;
412
+ modelName?: string | undefined;
413
+ }>;
414
+ type LanguageModelConfig = z.infer<typeof LanguageModelConfigSchema>;
415
+ type ToolExecuteFunction<TArgs, TResult> = (args: TArgs, context: {
416
+ abortSignal: AbortSignal;
417
+ }) => TResult | Promise<TResult>;
418
+ type Tool<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = {
419
+ description?: string | undefined;
420
+ parameters: z.ZodSchema<TArgs> | JSONSchema7;
421
+ execute?: ToolExecuteFunction<TArgs, TResult>;
422
+ };
423
+ type ModelConfig = {
424
+ priority?: number | undefined;
425
+ system?: string | undefined;
426
+ tools?: Record<string, Tool<any, any>> | undefined;
427
+ callSettings?: LanguageModelV1CallSettings | undefined;
428
+ config?: LanguageModelConfig | undefined;
429
+ };
430
+ type ModelConfigProvider = {
431
+ getModelConfig: () => ModelConfig;
432
+ };
433
+
434
434
  type FinishResult = {
435
435
  messages: CoreMessage[];
436
436
  metadata: {
@@ -458,4 +458,4 @@ declare const createEdgeRuntimeAPI: (options: CreateEdgeRuntimeAPIOptions) => {
458
458
  POST: (request: Request) => Promise<Response>;
459
459
  };
460
460
 
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 };
461
+ export { type AppendMessage as A, type ContentPartStatus as C, type EdgeRuntimeRequestOptions as E, type ImageContentPart as I, type MessageStatus as M, type TextContentPart as T, type UIContentPart as U, type ToolCallContentPart as a, type ToolCallContentPartStatus as b, type ThreadAssistantContentPart as c, type ThreadRoundtrip as d, type ThreadMessage as e, type ModelConfig as f, type ModelConfigProvider 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 };