@assistant-ui/react 0.5.29 → 0.5.31
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/EdgeRuntimeRequestOptions-BD0mpoF6.d.mts +412 -0
- package/dist/EdgeRuntimeRequestOptions-BD0mpoF6.d.ts +412 -0
- package/dist/edge.d.mts +261 -3
- package/dist/edge.d.ts +261 -3
- package/dist/edge.js +98 -101
- package/dist/edge.js.map +1 -1
- package/dist/edge.mjs +96 -100
- package/dist/edge.mjs.map +1 -1
- package/dist/index.d.mts +50 -281
- package/dist/index.d.ts +50 -281
- package/dist/index.js +162 -124
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +106 -68
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/AssistantTypes-Bo5YKjhV.d.mts +0 -162
- package/dist/AssistantTypes-Bo5YKjhV.d.ts +0 -162
@@ -0,0 +1,412 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
import { JSONSchema7 } from 'json-schema';
|
3
|
+
import { LanguageModelV1LogProbs } from '@ai-sdk/provider';
|
4
|
+
import { ReactNode } from 'react';
|
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>;
|
53
|
+
};
|
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;
|
60
|
+
};
|
61
|
+
type ModelConfigProvider = {
|
62
|
+
getModelConfig: () => ModelConfig;
|
63
|
+
};
|
64
|
+
|
65
|
+
type TextContentPart = {
|
66
|
+
type: "text";
|
67
|
+
text: string;
|
68
|
+
};
|
69
|
+
type ImageContentPart = {
|
70
|
+
type: "image";
|
71
|
+
image: string;
|
72
|
+
};
|
73
|
+
type UIContentPart = {
|
74
|
+
type: "ui";
|
75
|
+
display: ReactNode;
|
76
|
+
};
|
77
|
+
type CoreToolCallContentPart<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = {
|
78
|
+
type: "tool-call";
|
79
|
+
toolCallId: string;
|
80
|
+
toolName: string;
|
81
|
+
args: TArgs;
|
82
|
+
result?: TResult | undefined;
|
83
|
+
isError?: boolean | undefined;
|
84
|
+
};
|
85
|
+
type ToolCallContentPart<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = CoreToolCallContentPart<TArgs, TResult> & {
|
86
|
+
argsText: string;
|
87
|
+
};
|
88
|
+
type ThreadUserContentPart = TextContentPart | ImageContentPart | UIContentPart;
|
89
|
+
type ThreadAssistantContentPart = TextContentPart | ToolCallContentPart | UIContentPart;
|
90
|
+
type MessageCommonProps = {
|
91
|
+
id: string;
|
92
|
+
createdAt: Date;
|
93
|
+
};
|
94
|
+
type ThreadRoundtrip = {
|
95
|
+
logprobs?: LanguageModelV1LogProbs | undefined;
|
96
|
+
usage?: {
|
97
|
+
promptTokens: number;
|
98
|
+
completionTokens: number;
|
99
|
+
} | undefined;
|
100
|
+
};
|
101
|
+
type ContentPartStatus = {
|
102
|
+
type: "running";
|
103
|
+
} | {
|
104
|
+
type: "complete";
|
105
|
+
} | {
|
106
|
+
type: "incomplete";
|
107
|
+
reason: "cancelled" | "length" | "content-filter" | "other" | "error";
|
108
|
+
error?: unknown;
|
109
|
+
};
|
110
|
+
type ToolCallContentPartStatus = {
|
111
|
+
type: "requires-action";
|
112
|
+
reason: "tool-calls";
|
113
|
+
} | ContentPartStatus;
|
114
|
+
type MessageStatus = {
|
115
|
+
type: "running";
|
116
|
+
} | {
|
117
|
+
type: "requires-action";
|
118
|
+
reason: "tool-calls";
|
119
|
+
} | {
|
120
|
+
type: "complete";
|
121
|
+
reason: "stop" | "unknown";
|
122
|
+
} | {
|
123
|
+
type: "incomplete";
|
124
|
+
reason: "cancelled" | "tool-calls" | "length" | "content-filter" | "other" | "error";
|
125
|
+
error?: unknown;
|
126
|
+
};
|
127
|
+
type ThreadSystemMessage = MessageCommonProps & {
|
128
|
+
role: "system";
|
129
|
+
content: [TextContentPart];
|
130
|
+
};
|
131
|
+
type ThreadUserMessage = MessageCommonProps & {
|
132
|
+
role: "user";
|
133
|
+
content: ThreadUserContentPart[];
|
134
|
+
};
|
135
|
+
type ThreadAssistantMessage = MessageCommonProps & {
|
136
|
+
role: "assistant";
|
137
|
+
content: ThreadAssistantContentPart[];
|
138
|
+
status: MessageStatus;
|
139
|
+
roundtrips?: ThreadRoundtrip[] | undefined;
|
140
|
+
};
|
141
|
+
type AppendMessage = CoreMessage & {
|
142
|
+
parentId: string | null;
|
143
|
+
};
|
144
|
+
type ThreadMessage = ThreadSystemMessage | ThreadUserMessage | ThreadAssistantMessage;
|
145
|
+
/** Core Message Types (without UI content parts) */
|
146
|
+
type CoreUserContentPart = TextContentPart | ImageContentPart;
|
147
|
+
type CoreAssistantContentPart = TextContentPart | CoreToolCallContentPart;
|
148
|
+
type CoreSystemMessage = {
|
149
|
+
role: "system";
|
150
|
+
content: [TextContentPart];
|
151
|
+
};
|
152
|
+
type CoreUserMessage = {
|
153
|
+
role: "user";
|
154
|
+
content: CoreUserContentPart[];
|
155
|
+
};
|
156
|
+
type CoreAssistantMessage = {
|
157
|
+
role: "assistant";
|
158
|
+
content: CoreAssistantContentPart[];
|
159
|
+
};
|
160
|
+
type CoreMessage = CoreSystemMessage | CoreUserMessage | CoreAssistantMessage;
|
161
|
+
|
162
|
+
declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
163
|
+
system: z.ZodOptional<z.ZodString>;
|
164
|
+
messages: z.ZodArray<z.ZodDiscriminatedUnion<"role", [z.ZodObject<{
|
165
|
+
role: z.ZodLiteral<"system">;
|
166
|
+
content: z.ZodTuple<[z.ZodObject<{
|
167
|
+
type: z.ZodLiteral<"text">;
|
168
|
+
text: z.ZodString;
|
169
|
+
}, "strip", z.ZodTypeAny, {
|
170
|
+
type: "text";
|
171
|
+
text: string;
|
172
|
+
}, {
|
173
|
+
type: "text";
|
174
|
+
text: string;
|
175
|
+
}>], null>;
|
176
|
+
}, "strip", z.ZodTypeAny, {
|
177
|
+
role: "system";
|
178
|
+
content: [{
|
179
|
+
type: "text";
|
180
|
+
text: string;
|
181
|
+
}];
|
182
|
+
}, {
|
183
|
+
role: "system";
|
184
|
+
content: [{
|
185
|
+
type: "text";
|
186
|
+
text: string;
|
187
|
+
}];
|
188
|
+
}>, z.ZodObject<{
|
189
|
+
role: z.ZodLiteral<"user">;
|
190
|
+
content: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
191
|
+
type: z.ZodLiteral<"text">;
|
192
|
+
text: z.ZodString;
|
193
|
+
}, "strip", z.ZodTypeAny, {
|
194
|
+
type: "text";
|
195
|
+
text: string;
|
196
|
+
}, {
|
197
|
+
type: "text";
|
198
|
+
text: string;
|
199
|
+
}>, z.ZodObject<{
|
200
|
+
type: z.ZodLiteral<"image">;
|
201
|
+
image: z.ZodString;
|
202
|
+
}, "strip", z.ZodTypeAny, {
|
203
|
+
type: "image";
|
204
|
+
image: string;
|
205
|
+
}, {
|
206
|
+
type: "image";
|
207
|
+
image: string;
|
208
|
+
}>]>, "many">;
|
209
|
+
}, "strip", z.ZodTypeAny, {
|
210
|
+
role: "user";
|
211
|
+
content: ({
|
212
|
+
type: "text";
|
213
|
+
text: string;
|
214
|
+
} | {
|
215
|
+
type: "image";
|
216
|
+
image: string;
|
217
|
+
})[];
|
218
|
+
}, {
|
219
|
+
role: "user";
|
220
|
+
content: ({
|
221
|
+
type: "text";
|
222
|
+
text: string;
|
223
|
+
} | {
|
224
|
+
type: "image";
|
225
|
+
image: string;
|
226
|
+
})[];
|
227
|
+
}>, z.ZodObject<{
|
228
|
+
role: z.ZodLiteral<"assistant">;
|
229
|
+
content: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
230
|
+
type: z.ZodLiteral<"text">;
|
231
|
+
text: z.ZodString;
|
232
|
+
}, "strip", z.ZodTypeAny, {
|
233
|
+
type: "text";
|
234
|
+
text: string;
|
235
|
+
}, {
|
236
|
+
type: "text";
|
237
|
+
text: string;
|
238
|
+
}>, z.ZodObject<{
|
239
|
+
type: z.ZodLiteral<"tool-call">;
|
240
|
+
toolCallId: z.ZodString;
|
241
|
+
toolName: z.ZodString;
|
242
|
+
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
243
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
244
|
+
isError: z.ZodOptional<z.ZodBoolean>;
|
245
|
+
}, "strip", z.ZodTypeAny, {
|
246
|
+
type: "tool-call";
|
247
|
+
toolCallId: string;
|
248
|
+
toolName: string;
|
249
|
+
args: Record<string, unknown>;
|
250
|
+
result?: unknown;
|
251
|
+
isError?: boolean | undefined;
|
252
|
+
}, {
|
253
|
+
type: "tool-call";
|
254
|
+
toolCallId: string;
|
255
|
+
toolName: string;
|
256
|
+
args: Record<string, unknown>;
|
257
|
+
result?: unknown;
|
258
|
+
isError?: boolean | undefined;
|
259
|
+
}>]>, "many">;
|
260
|
+
}, "strip", z.ZodTypeAny, {
|
261
|
+
role: "assistant";
|
262
|
+
content: ({
|
263
|
+
type: "text";
|
264
|
+
text: string;
|
265
|
+
} | {
|
266
|
+
type: "tool-call";
|
267
|
+
toolCallId: string;
|
268
|
+
toolName: string;
|
269
|
+
args: Record<string, unknown>;
|
270
|
+
result?: unknown;
|
271
|
+
isError?: boolean | undefined;
|
272
|
+
})[];
|
273
|
+
}, {
|
274
|
+
role: "assistant";
|
275
|
+
content: ({
|
276
|
+
type: "text";
|
277
|
+
text: string;
|
278
|
+
} | {
|
279
|
+
type: "tool-call";
|
280
|
+
toolCallId: string;
|
281
|
+
toolName: string;
|
282
|
+
args: Record<string, unknown>;
|
283
|
+
result?: unknown;
|
284
|
+
isError?: boolean | undefined;
|
285
|
+
})[];
|
286
|
+
}>]>, "many">;
|
287
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
288
|
+
type: z.ZodLiteral<"function">;
|
289
|
+
name: z.ZodString;
|
290
|
+
description: z.ZodOptional<z.ZodString>;
|
291
|
+
parameters: z.ZodType<JSONSchema7, z.ZodTypeDef, JSONSchema7>;
|
292
|
+
}, "strip", z.ZodTypeAny, {
|
293
|
+
type: "function";
|
294
|
+
name: string;
|
295
|
+
parameters: JSONSchema7;
|
296
|
+
description?: string | undefined;
|
297
|
+
}, {
|
298
|
+
type: "function";
|
299
|
+
name: string;
|
300
|
+
parameters: JSONSchema7;
|
301
|
+
description?: string | undefined;
|
302
|
+
}>, "many">>;
|
303
|
+
}, {
|
304
|
+
maxTokens: z.ZodOptional<z.ZodNumber>;
|
305
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
306
|
+
topP: z.ZodOptional<z.ZodNumber>;
|
307
|
+
presencePenalty: z.ZodOptional<z.ZodNumber>;
|
308
|
+
frequencyPenalty: z.ZodOptional<z.ZodNumber>;
|
309
|
+
seed: z.ZodOptional<z.ZodNumber>;
|
310
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
|
311
|
+
}>, {
|
312
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
313
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
314
|
+
modelName: z.ZodOptional<z.ZodString>;
|
315
|
+
}>, "strip", z.ZodTypeAny, {
|
316
|
+
messages: ({
|
317
|
+
role: "user";
|
318
|
+
content: ({
|
319
|
+
type: "text";
|
320
|
+
text: string;
|
321
|
+
} | {
|
322
|
+
type: "image";
|
323
|
+
image: string;
|
324
|
+
})[];
|
325
|
+
} | {
|
326
|
+
role: "assistant";
|
327
|
+
content: ({
|
328
|
+
type: "text";
|
329
|
+
text: string;
|
330
|
+
} | {
|
331
|
+
type: "tool-call";
|
332
|
+
toolCallId: string;
|
333
|
+
toolName: string;
|
334
|
+
args: Record<string, unknown>;
|
335
|
+
result?: unknown;
|
336
|
+
isError?: boolean | undefined;
|
337
|
+
})[];
|
338
|
+
} | {
|
339
|
+
role: "system";
|
340
|
+
content: [{
|
341
|
+
type: "text";
|
342
|
+
text: string;
|
343
|
+
}];
|
344
|
+
})[];
|
345
|
+
maxTokens?: number | undefined;
|
346
|
+
temperature?: number | undefined;
|
347
|
+
topP?: number | undefined;
|
348
|
+
presencePenalty?: number | undefined;
|
349
|
+
frequencyPenalty?: number | undefined;
|
350
|
+
seed?: number | undefined;
|
351
|
+
headers?: Record<string, string | undefined> | undefined;
|
352
|
+
apiKey?: string | undefined;
|
353
|
+
baseUrl?: string | undefined;
|
354
|
+
modelName?: string | undefined;
|
355
|
+
system?: string | undefined;
|
356
|
+
tools?: {
|
357
|
+
type: "function";
|
358
|
+
name: string;
|
359
|
+
parameters: JSONSchema7;
|
360
|
+
description?: string | undefined;
|
361
|
+
}[] | undefined;
|
362
|
+
}, {
|
363
|
+
messages: ({
|
364
|
+
role: "user";
|
365
|
+
content: ({
|
366
|
+
type: "text";
|
367
|
+
text: string;
|
368
|
+
} | {
|
369
|
+
type: "image";
|
370
|
+
image: string;
|
371
|
+
})[];
|
372
|
+
} | {
|
373
|
+
role: "assistant";
|
374
|
+
content: ({
|
375
|
+
type: "text";
|
376
|
+
text: string;
|
377
|
+
} | {
|
378
|
+
type: "tool-call";
|
379
|
+
toolCallId: string;
|
380
|
+
toolName: string;
|
381
|
+
args: Record<string, unknown>;
|
382
|
+
result?: unknown;
|
383
|
+
isError?: boolean | undefined;
|
384
|
+
})[];
|
385
|
+
} | {
|
386
|
+
role: "system";
|
387
|
+
content: [{
|
388
|
+
type: "text";
|
389
|
+
text: string;
|
390
|
+
}];
|
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
|
+
apiKey?: string | undefined;
|
400
|
+
baseUrl?: string | undefined;
|
401
|
+
modelName?: string | undefined;
|
402
|
+
system?: string | undefined;
|
403
|
+
tools?: {
|
404
|
+
type: "function";
|
405
|
+
name: string;
|
406
|
+
parameters: JSONSchema7;
|
407
|
+
description?: string | undefined;
|
408
|
+
}[] | undefined;
|
409
|
+
}>;
|
410
|
+
type EdgeRuntimeRequestOptions = z.infer<typeof EdgeRuntimeRequestOptionsSchema>;
|
411
|
+
|
412
|
+
export { type AppendMessage as A, type ContentPartStatus as C, type EdgeRuntimeRequestOptions as E, type ImageContentPart as I, type LanguageModelV1CallSettings as L, 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 Tool as i, type CoreToolCallContentPart as j, type ThreadUserContentPart as k, type ThreadSystemMessage as l, type ThreadAssistantMessage as m, type ThreadUserMessage as n, type CoreUserContentPart as o, type CoreAssistantContentPart as p, type CoreSystemMessage as q, type CoreUserMessage as r, type CoreAssistantMessage as s, EdgeRuntimeRequestOptionsSchema as t, type LanguageModelConfig as u };
|
package/dist/edge.d.mts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { LanguageModelV1LogProbs, LanguageModelV1, LanguageModelV1ToolChoice } from '@ai-sdk/provider';
|
2
|
-
import { z } from 'zod';
|
3
2
|
import { JSONSchema7 } from 'json-schema';
|
3
|
+
import { z } from 'zod';
|
4
4
|
|
5
5
|
type TextContentPart = {
|
6
6
|
type: "text";
|
@@ -42,6 +42,255 @@ type CoreAssistantMessage = {
|
|
42
42
|
};
|
43
43
|
type CoreMessage = CoreSystemMessage | CoreUserMessage | CoreAssistantMessage;
|
44
44
|
|
45
|
+
declare const EdgeRuntimeRequestOptionsSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
46
|
+
system: z.ZodOptional<z.ZodString>;
|
47
|
+
messages: z.ZodArray<z.ZodDiscriminatedUnion<"role", [z.ZodObject<{
|
48
|
+
role: z.ZodLiteral<"system">;
|
49
|
+
content: z.ZodTuple<[z.ZodObject<{
|
50
|
+
type: z.ZodLiteral<"text">;
|
51
|
+
text: z.ZodString;
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
53
|
+
text: string;
|
54
|
+
type: "text";
|
55
|
+
}, {
|
56
|
+
text: string;
|
57
|
+
type: "text";
|
58
|
+
}>], null>;
|
59
|
+
}, "strip", z.ZodTypeAny, {
|
60
|
+
role: "system";
|
61
|
+
content: [{
|
62
|
+
text: string;
|
63
|
+
type: "text";
|
64
|
+
}];
|
65
|
+
}, {
|
66
|
+
role: "system";
|
67
|
+
content: [{
|
68
|
+
text: string;
|
69
|
+
type: "text";
|
70
|
+
}];
|
71
|
+
}>, z.ZodObject<{
|
72
|
+
role: z.ZodLiteral<"user">;
|
73
|
+
content: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
74
|
+
type: z.ZodLiteral<"text">;
|
75
|
+
text: z.ZodString;
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
77
|
+
text: string;
|
78
|
+
type: "text";
|
79
|
+
}, {
|
80
|
+
text: string;
|
81
|
+
type: "text";
|
82
|
+
}>, z.ZodObject<{
|
83
|
+
type: z.ZodLiteral<"image">;
|
84
|
+
image: z.ZodString;
|
85
|
+
}, "strip", z.ZodTypeAny, {
|
86
|
+
image: string;
|
87
|
+
type: "image";
|
88
|
+
}, {
|
89
|
+
image: string;
|
90
|
+
type: "image";
|
91
|
+
}>]>, "many">;
|
92
|
+
}, "strip", z.ZodTypeAny, {
|
93
|
+
role: "user";
|
94
|
+
content: ({
|
95
|
+
text: string;
|
96
|
+
type: "text";
|
97
|
+
} | {
|
98
|
+
image: string;
|
99
|
+
type: "image";
|
100
|
+
})[];
|
101
|
+
}, {
|
102
|
+
role: "user";
|
103
|
+
content: ({
|
104
|
+
text: string;
|
105
|
+
type: "text";
|
106
|
+
} | {
|
107
|
+
image: string;
|
108
|
+
type: "image";
|
109
|
+
})[];
|
110
|
+
}>, z.ZodObject<{
|
111
|
+
role: z.ZodLiteral<"assistant">;
|
112
|
+
content: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
113
|
+
type: z.ZodLiteral<"text">;
|
114
|
+
text: z.ZodString;
|
115
|
+
}, "strip", z.ZodTypeAny, {
|
116
|
+
text: string;
|
117
|
+
type: "text";
|
118
|
+
}, {
|
119
|
+
text: string;
|
120
|
+
type: "text";
|
121
|
+
}>, z.ZodObject<{
|
122
|
+
type: z.ZodLiteral<"tool-call">;
|
123
|
+
toolCallId: z.ZodString;
|
124
|
+
toolName: z.ZodString;
|
125
|
+
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
126
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
127
|
+
isError: z.ZodOptional<z.ZodBoolean>;
|
128
|
+
}, "strip", z.ZodTypeAny, {
|
129
|
+
type: "tool-call";
|
130
|
+
toolCallId: string;
|
131
|
+
toolName: string;
|
132
|
+
args: Record<string, unknown>;
|
133
|
+
isError?: boolean | undefined;
|
134
|
+
result?: unknown;
|
135
|
+
}, {
|
136
|
+
type: "tool-call";
|
137
|
+
toolCallId: string;
|
138
|
+
toolName: string;
|
139
|
+
args: Record<string, unknown>;
|
140
|
+
isError?: boolean | undefined;
|
141
|
+
result?: unknown;
|
142
|
+
}>]>, "many">;
|
143
|
+
}, "strip", z.ZodTypeAny, {
|
144
|
+
role: "assistant";
|
145
|
+
content: ({
|
146
|
+
text: string;
|
147
|
+
type: "text";
|
148
|
+
} | {
|
149
|
+
type: "tool-call";
|
150
|
+
toolCallId: string;
|
151
|
+
toolName: string;
|
152
|
+
args: Record<string, unknown>;
|
153
|
+
isError?: boolean | undefined;
|
154
|
+
result?: unknown;
|
155
|
+
})[];
|
156
|
+
}, {
|
157
|
+
role: "assistant";
|
158
|
+
content: ({
|
159
|
+
text: string;
|
160
|
+
type: "text";
|
161
|
+
} | {
|
162
|
+
type: "tool-call";
|
163
|
+
toolCallId: string;
|
164
|
+
toolName: string;
|
165
|
+
args: Record<string, unknown>;
|
166
|
+
isError?: boolean | undefined;
|
167
|
+
result?: unknown;
|
168
|
+
})[];
|
169
|
+
}>]>, "many">;
|
170
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
171
|
+
type: z.ZodLiteral<"function">;
|
172
|
+
name: z.ZodString;
|
173
|
+
description: z.ZodOptional<z.ZodString>;
|
174
|
+
parameters: z.ZodType<JSONSchema7, z.ZodTypeDef, JSONSchema7>;
|
175
|
+
}, "strip", z.ZodTypeAny, {
|
176
|
+
type: "function";
|
177
|
+
name: string;
|
178
|
+
parameters: JSONSchema7;
|
179
|
+
description?: string | undefined;
|
180
|
+
}, {
|
181
|
+
type: "function";
|
182
|
+
name: string;
|
183
|
+
parameters: JSONSchema7;
|
184
|
+
description?: string | undefined;
|
185
|
+
}>, "many">>;
|
186
|
+
}, {
|
187
|
+
maxTokens: z.ZodOptional<z.ZodNumber>;
|
188
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
189
|
+
topP: z.ZodOptional<z.ZodNumber>;
|
190
|
+
presencePenalty: z.ZodOptional<z.ZodNumber>;
|
191
|
+
frequencyPenalty: z.ZodOptional<z.ZodNumber>;
|
192
|
+
seed: z.ZodOptional<z.ZodNumber>;
|
193
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
|
194
|
+
}>, {
|
195
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
196
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
197
|
+
modelName: z.ZodOptional<z.ZodString>;
|
198
|
+
}>, "strip", z.ZodTypeAny, {
|
199
|
+
messages: ({
|
200
|
+
role: "user";
|
201
|
+
content: ({
|
202
|
+
text: string;
|
203
|
+
type: "text";
|
204
|
+
} | {
|
205
|
+
image: string;
|
206
|
+
type: "image";
|
207
|
+
})[];
|
208
|
+
} | {
|
209
|
+
role: "assistant";
|
210
|
+
content: ({
|
211
|
+
text: string;
|
212
|
+
type: "text";
|
213
|
+
} | {
|
214
|
+
type: "tool-call";
|
215
|
+
toolCallId: string;
|
216
|
+
toolName: string;
|
217
|
+
args: Record<string, unknown>;
|
218
|
+
isError?: boolean | undefined;
|
219
|
+
result?: unknown;
|
220
|
+
})[];
|
221
|
+
} | {
|
222
|
+
role: "system";
|
223
|
+
content: [{
|
224
|
+
text: string;
|
225
|
+
type: "text";
|
226
|
+
}];
|
227
|
+
})[];
|
228
|
+
system?: string | undefined;
|
229
|
+
maxTokens?: number | undefined;
|
230
|
+
temperature?: number | undefined;
|
231
|
+
topP?: number | undefined;
|
232
|
+
presencePenalty?: number | undefined;
|
233
|
+
frequencyPenalty?: number | undefined;
|
234
|
+
seed?: number | undefined;
|
235
|
+
headers?: Record<string, string | undefined> | undefined;
|
236
|
+
apiKey?: string | undefined;
|
237
|
+
baseUrl?: string | undefined;
|
238
|
+
modelName?: string | undefined;
|
239
|
+
tools?: {
|
240
|
+
type: "function";
|
241
|
+
name: string;
|
242
|
+
parameters: JSONSchema7;
|
243
|
+
description?: string | undefined;
|
244
|
+
}[] | undefined;
|
245
|
+
}, {
|
246
|
+
messages: ({
|
247
|
+
role: "user";
|
248
|
+
content: ({
|
249
|
+
text: string;
|
250
|
+
type: "text";
|
251
|
+
} | {
|
252
|
+
image: string;
|
253
|
+
type: "image";
|
254
|
+
})[];
|
255
|
+
} | {
|
256
|
+
role: "assistant";
|
257
|
+
content: ({
|
258
|
+
text: string;
|
259
|
+
type: "text";
|
260
|
+
} | {
|
261
|
+
type: "tool-call";
|
262
|
+
toolCallId: string;
|
263
|
+
toolName: string;
|
264
|
+
args: Record<string, unknown>;
|
265
|
+
isError?: boolean | undefined;
|
266
|
+
result?: unknown;
|
267
|
+
})[];
|
268
|
+
} | {
|
269
|
+
role: "system";
|
270
|
+
content: [{
|
271
|
+
text: string;
|
272
|
+
type: "text";
|
273
|
+
}];
|
274
|
+
})[];
|
275
|
+
system?: string | undefined;
|
276
|
+
maxTokens?: number | undefined;
|
277
|
+
temperature?: number | undefined;
|
278
|
+
topP?: number | undefined;
|
279
|
+
presencePenalty?: number | undefined;
|
280
|
+
frequencyPenalty?: number | undefined;
|
281
|
+
seed?: number | undefined;
|
282
|
+
headers?: Record<string, string | undefined> | undefined;
|
283
|
+
apiKey?: string | undefined;
|
284
|
+
baseUrl?: string | undefined;
|
285
|
+
modelName?: string | undefined;
|
286
|
+
tools?: {
|
287
|
+
type: "function";
|
288
|
+
name: string;
|
289
|
+
parameters: JSONSchema7;
|
290
|
+
description?: string | undefined;
|
291
|
+
}[] | undefined;
|
292
|
+
}>;
|
293
|
+
|
45
294
|
declare const LanguageModelV1CallSettingsSchema: z.ZodObject<{
|
46
295
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
47
296
|
temperature: z.ZodOptional<z.ZodNumber>;
|
@@ -103,8 +352,17 @@ type CreateEdgeRuntimeAPIOptions = LanguageModelV1CallSettings & {
|
|
103
352
|
toolChoice?: LanguageModelV1ToolChoice;
|
104
353
|
onFinish?: (result: FinishResult) => void;
|
105
354
|
};
|
106
|
-
|
355
|
+
type GetEdgeRuntimeStreamOptions = {
|
356
|
+
abortSignal: AbortSignal;
|
357
|
+
requestData: z.infer<typeof EdgeRuntimeRequestOptionsSchema>;
|
358
|
+
options: CreateEdgeRuntimeAPIOptions;
|
359
|
+
};
|
360
|
+
declare namespace getEdgeRuntimeResponse {
|
361
|
+
export type { GetEdgeRuntimeStreamOptions as Options };
|
362
|
+
}
|
363
|
+
declare const getEdgeRuntimeResponse: (options: getEdgeRuntimeResponse.Options) => Promise<Response>;
|
364
|
+
declare const createEdgeRuntimeAPI: (options: CreateEdgeRuntimeAPIOptions) => {
|
107
365
|
POST: (request: Request) => Promise<Response>;
|
108
366
|
};
|
109
367
|
|
110
|
-
export { createEdgeRuntimeAPI };
|
368
|
+
export { createEdgeRuntimeAPI, getEdgeRuntimeResponse };
|