@assistant-ui/react 0.5.19 → 0.5.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,156 @@
1
+ import { LanguageModelV1LogProbs } from '@ai-sdk/provider';
2
+ import { ReactNode } from 'react';
3
+ import { z } from 'zod';
4
+ import { JSONSchema7 } from 'json-schema';
5
+
6
+ type TextContentPart = {
7
+ type: "text";
8
+ text: string;
9
+ };
10
+ type ImageContentPart = {
11
+ type: "image";
12
+ image: string;
13
+ };
14
+ type UIContentPart = {
15
+ type: "ui";
16
+ display: ReactNode;
17
+ };
18
+ type CoreToolCallContentPart<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = {
19
+ type: "tool-call";
20
+ toolCallId: string;
21
+ toolName: string;
22
+ args: TArgs;
23
+ result?: TResult | undefined;
24
+ isError?: boolean | undefined;
25
+ };
26
+ type ToolCallContentPart<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = CoreToolCallContentPart<TArgs, TResult> & {
27
+ argsText: string;
28
+ };
29
+ type ThreadUserContentPart = TextContentPart | ImageContentPart | UIContentPart;
30
+ type ThreadAssistantContentPart = TextContentPart | ToolCallContentPart | UIContentPart;
31
+ type MessageCommonProps = {
32
+ id: string;
33
+ createdAt: Date;
34
+ };
35
+ type ThreadRoundtrip = {
36
+ logprobs?: LanguageModelV1LogProbs | undefined;
37
+ usage?: {
38
+ promptTokens: number;
39
+ completionTokens: number;
40
+ } | undefined;
41
+ };
42
+ type ContentPartStatus = {
43
+ type: "running";
44
+ } | {
45
+ type: "complete";
46
+ } | {
47
+ type: "incomplete";
48
+ reason: "cancelled" | "length" | "content-filter" | "other" | "error";
49
+ error?: unknown;
50
+ };
51
+ type MessageStatus = {
52
+ type: "running";
53
+ } | {
54
+ type: "requires-action";
55
+ reason: "tool-calls";
56
+ } | {
57
+ type: "complete";
58
+ reason: "stop" | "unknown";
59
+ } | {
60
+ type: "incomplete";
61
+ reason: "cancelled" | "tool-calls" | "length" | "content-filter" | "other" | "error";
62
+ error?: unknown;
63
+ };
64
+ type ThreadSystemMessage = MessageCommonProps & {
65
+ role: "system";
66
+ content: [TextContentPart];
67
+ };
68
+ type ThreadUserMessage = MessageCommonProps & {
69
+ role: "user";
70
+ content: ThreadUserContentPart[];
71
+ };
72
+ type ThreadAssistantMessage = MessageCommonProps & {
73
+ role: "assistant";
74
+ content: ThreadAssistantContentPart[];
75
+ status: MessageStatus;
76
+ roundtrips?: ThreadRoundtrip[] | undefined;
77
+ };
78
+ type AppendMessage = CoreMessage & {
79
+ parentId: string | null;
80
+ };
81
+ type ThreadMessage = ThreadSystemMessage | ThreadUserMessage | ThreadAssistantMessage;
82
+ /** Core Message Types (without UI content parts) */
83
+ type CoreUserContentPart = TextContentPart | ImageContentPart;
84
+ type CoreAssistantContentPart = TextContentPart | CoreToolCallContentPart;
85
+ type CoreSystemMessage = {
86
+ role: "system";
87
+ content: [TextContentPart];
88
+ };
89
+ type CoreUserMessage = {
90
+ role: "user";
91
+ content: CoreUserContentPart[];
92
+ };
93
+ type CoreAssistantMessage = {
94
+ role: "assistant";
95
+ content: CoreAssistantContentPart[];
96
+ };
97
+ type CoreMessage = CoreSystemMessage | CoreUserMessage | CoreAssistantMessage;
98
+
99
+ declare const LanguageModelV1CallSettingsSchema: z.ZodObject<{
100
+ maxTokens: z.ZodOptional<z.ZodNumber>;
101
+ temperature: z.ZodOptional<z.ZodNumber>;
102
+ topP: z.ZodOptional<z.ZodNumber>;
103
+ presencePenalty: z.ZodOptional<z.ZodNumber>;
104
+ frequencyPenalty: z.ZodOptional<z.ZodNumber>;
105
+ seed: z.ZodOptional<z.ZodNumber>;
106
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
107
+ }, "strip", z.ZodTypeAny, {
108
+ maxTokens?: number | undefined;
109
+ temperature?: number | undefined;
110
+ topP?: number | undefined;
111
+ presencePenalty?: number | undefined;
112
+ frequencyPenalty?: number | undefined;
113
+ seed?: number | undefined;
114
+ headers?: Record<string, string | undefined> | undefined;
115
+ }, {
116
+ maxTokens?: number | undefined;
117
+ temperature?: number | undefined;
118
+ topP?: number | undefined;
119
+ presencePenalty?: number | undefined;
120
+ frequencyPenalty?: number | undefined;
121
+ seed?: number | undefined;
122
+ headers?: Record<string, string | undefined> | undefined;
123
+ }>;
124
+ type LanguageModelV1CallSettings = z.infer<typeof LanguageModelV1CallSettingsSchema>;
125
+ declare const LanguageModelConfigSchema: z.ZodObject<{
126
+ apiKey: z.ZodOptional<z.ZodString>;
127
+ baseUrl: z.ZodOptional<z.ZodString>;
128
+ modelName: z.ZodOptional<z.ZodString>;
129
+ }, "strip", z.ZodTypeAny, {
130
+ apiKey?: string | undefined;
131
+ baseUrl?: string | undefined;
132
+ modelName?: string | undefined;
133
+ }, {
134
+ apiKey?: string | undefined;
135
+ baseUrl?: string | undefined;
136
+ modelName?: string | undefined;
137
+ }>;
138
+ type LanguageModelConfig = z.infer<typeof LanguageModelConfigSchema>;
139
+ type ToolExecuteFunction<TArgs, TResult> = (args: TArgs) => TResult | Promise<TResult>;
140
+ type Tool<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = {
141
+ description?: string | undefined;
142
+ parameters: z.ZodSchema<TArgs> | JSONSchema7;
143
+ execute?: ToolExecuteFunction<TArgs, TResult>;
144
+ };
145
+ type ModelConfig = {
146
+ priority?: number | undefined;
147
+ system?: string | undefined;
148
+ tools?: Record<string, Tool<any, any>> | undefined;
149
+ callSettings?: LanguageModelV1CallSettings | undefined;
150
+ config?: LanguageModelConfig | undefined;
151
+ };
152
+ type ModelConfigProvider = {
153
+ getModelConfig: () => ModelConfig;
154
+ };
155
+
156
+ export type { AppendMessage as A, CoreMessage as C, LanguageModelV1CallSettings as L, ModelConfigProvider as M, Tool as T, ThreadRoundtrip as a, LanguageModelConfig as b, ModelConfig as c, ThreadMessage as d, ContentPartStatus as e, TextContentPart as f };
@@ -0,0 +1,156 @@
1
+ import { LanguageModelV1LogProbs } from '@ai-sdk/provider';
2
+ import { ReactNode } from 'react';
3
+ import { z } from 'zod';
4
+ import { JSONSchema7 } from 'json-schema';
5
+
6
+ type TextContentPart = {
7
+ type: "text";
8
+ text: string;
9
+ };
10
+ type ImageContentPart = {
11
+ type: "image";
12
+ image: string;
13
+ };
14
+ type UIContentPart = {
15
+ type: "ui";
16
+ display: ReactNode;
17
+ };
18
+ type CoreToolCallContentPart<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = {
19
+ type: "tool-call";
20
+ toolCallId: string;
21
+ toolName: string;
22
+ args: TArgs;
23
+ result?: TResult | undefined;
24
+ isError?: boolean | undefined;
25
+ };
26
+ type ToolCallContentPart<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = CoreToolCallContentPart<TArgs, TResult> & {
27
+ argsText: string;
28
+ };
29
+ type ThreadUserContentPart = TextContentPart | ImageContentPart | UIContentPart;
30
+ type ThreadAssistantContentPart = TextContentPart | ToolCallContentPart | UIContentPart;
31
+ type MessageCommonProps = {
32
+ id: string;
33
+ createdAt: Date;
34
+ };
35
+ type ThreadRoundtrip = {
36
+ logprobs?: LanguageModelV1LogProbs | undefined;
37
+ usage?: {
38
+ promptTokens: number;
39
+ completionTokens: number;
40
+ } | undefined;
41
+ };
42
+ type ContentPartStatus = {
43
+ type: "running";
44
+ } | {
45
+ type: "complete";
46
+ } | {
47
+ type: "incomplete";
48
+ reason: "cancelled" | "length" | "content-filter" | "other" | "error";
49
+ error?: unknown;
50
+ };
51
+ type MessageStatus = {
52
+ type: "running";
53
+ } | {
54
+ type: "requires-action";
55
+ reason: "tool-calls";
56
+ } | {
57
+ type: "complete";
58
+ reason: "stop" | "unknown";
59
+ } | {
60
+ type: "incomplete";
61
+ reason: "cancelled" | "tool-calls" | "length" | "content-filter" | "other" | "error";
62
+ error?: unknown;
63
+ };
64
+ type ThreadSystemMessage = MessageCommonProps & {
65
+ role: "system";
66
+ content: [TextContentPart];
67
+ };
68
+ type ThreadUserMessage = MessageCommonProps & {
69
+ role: "user";
70
+ content: ThreadUserContentPart[];
71
+ };
72
+ type ThreadAssistantMessage = MessageCommonProps & {
73
+ role: "assistant";
74
+ content: ThreadAssistantContentPart[];
75
+ status: MessageStatus;
76
+ roundtrips?: ThreadRoundtrip[] | undefined;
77
+ };
78
+ type AppendMessage = CoreMessage & {
79
+ parentId: string | null;
80
+ };
81
+ type ThreadMessage = ThreadSystemMessage | ThreadUserMessage | ThreadAssistantMessage;
82
+ /** Core Message Types (without UI content parts) */
83
+ type CoreUserContentPart = TextContentPart | ImageContentPart;
84
+ type CoreAssistantContentPart = TextContentPart | CoreToolCallContentPart;
85
+ type CoreSystemMessage = {
86
+ role: "system";
87
+ content: [TextContentPart];
88
+ };
89
+ type CoreUserMessage = {
90
+ role: "user";
91
+ content: CoreUserContentPart[];
92
+ };
93
+ type CoreAssistantMessage = {
94
+ role: "assistant";
95
+ content: CoreAssistantContentPart[];
96
+ };
97
+ type CoreMessage = CoreSystemMessage | CoreUserMessage | CoreAssistantMessage;
98
+
99
+ declare const LanguageModelV1CallSettingsSchema: z.ZodObject<{
100
+ maxTokens: z.ZodOptional<z.ZodNumber>;
101
+ temperature: z.ZodOptional<z.ZodNumber>;
102
+ topP: z.ZodOptional<z.ZodNumber>;
103
+ presencePenalty: z.ZodOptional<z.ZodNumber>;
104
+ frequencyPenalty: z.ZodOptional<z.ZodNumber>;
105
+ seed: z.ZodOptional<z.ZodNumber>;
106
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
107
+ }, "strip", z.ZodTypeAny, {
108
+ maxTokens?: number | undefined;
109
+ temperature?: number | undefined;
110
+ topP?: number | undefined;
111
+ presencePenalty?: number | undefined;
112
+ frequencyPenalty?: number | undefined;
113
+ seed?: number | undefined;
114
+ headers?: Record<string, string | undefined> | undefined;
115
+ }, {
116
+ maxTokens?: number | undefined;
117
+ temperature?: number | undefined;
118
+ topP?: number | undefined;
119
+ presencePenalty?: number | undefined;
120
+ frequencyPenalty?: number | undefined;
121
+ seed?: number | undefined;
122
+ headers?: Record<string, string | undefined> | undefined;
123
+ }>;
124
+ type LanguageModelV1CallSettings = z.infer<typeof LanguageModelV1CallSettingsSchema>;
125
+ declare const LanguageModelConfigSchema: z.ZodObject<{
126
+ apiKey: z.ZodOptional<z.ZodString>;
127
+ baseUrl: z.ZodOptional<z.ZodString>;
128
+ modelName: z.ZodOptional<z.ZodString>;
129
+ }, "strip", z.ZodTypeAny, {
130
+ apiKey?: string | undefined;
131
+ baseUrl?: string | undefined;
132
+ modelName?: string | undefined;
133
+ }, {
134
+ apiKey?: string | undefined;
135
+ baseUrl?: string | undefined;
136
+ modelName?: string | undefined;
137
+ }>;
138
+ type LanguageModelConfig = z.infer<typeof LanguageModelConfigSchema>;
139
+ type ToolExecuteFunction<TArgs, TResult> = (args: TArgs) => TResult | Promise<TResult>;
140
+ type Tool<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = {
141
+ description?: string | undefined;
142
+ parameters: z.ZodSchema<TArgs> | JSONSchema7;
143
+ execute?: ToolExecuteFunction<TArgs, TResult>;
144
+ };
145
+ type ModelConfig = {
146
+ priority?: number | undefined;
147
+ system?: string | undefined;
148
+ tools?: Record<string, Tool<any, any>> | undefined;
149
+ callSettings?: LanguageModelV1CallSettings | undefined;
150
+ config?: LanguageModelConfig | undefined;
151
+ };
152
+ type ModelConfigProvider = {
153
+ getModelConfig: () => ModelConfig;
154
+ };
155
+
156
+ export type { AppendMessage as A, CoreMessage as C, LanguageModelV1CallSettings as L, ModelConfigProvider as M, Tool as T, ThreadRoundtrip as a, LanguageModelConfig as b, ModelConfig as c, ThreadMessage as d, ContentPartStatus as e, TextContentPart as f };
@@ -0,0 +1,61 @@
1
+ // src/types/ModelConfigTypes.ts
2
+ import { z } from "zod";
3
+ var LanguageModelV1CallSettingsSchema = z.object({
4
+ maxTokens: z.number().int().positive().optional(),
5
+ temperature: z.number().optional(),
6
+ topP: z.number().optional(),
7
+ presencePenalty: z.number().optional(),
8
+ frequencyPenalty: z.number().optional(),
9
+ seed: z.number().int().optional(),
10
+ headers: z.record(z.string().optional()).optional()
11
+ });
12
+ var LanguageModelConfigSchema = z.object({
13
+ apiKey: z.string().optional(),
14
+ baseUrl: z.string().optional(),
15
+ modelName: z.string().optional()
16
+ });
17
+ var mergeModelConfigs = (configSet) => {
18
+ const configs = Array.from(configSet).map((c) => c.getModelConfig()).sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
19
+ return configs.reduce((acc, config) => {
20
+ if (config.system) {
21
+ if (acc.system) {
22
+ acc.system += `
23
+
24
+ ${config.system}`;
25
+ } else {
26
+ acc.system = config.system;
27
+ }
28
+ }
29
+ if (config.tools) {
30
+ for (const [name, tool] of Object.entries(config.tools)) {
31
+ if (acc.tools?.[name]) {
32
+ throw new Error(
33
+ `You tried to define a tool with the name ${name}, but it already exists.`
34
+ );
35
+ }
36
+ if (!acc.tools) acc.tools = {};
37
+ acc.tools[name] = tool;
38
+ }
39
+ }
40
+ if (config.config) {
41
+ acc.config = {
42
+ ...acc.config,
43
+ ...config.config
44
+ };
45
+ }
46
+ if (config.callSettings) {
47
+ acc.callSettings = {
48
+ ...acc.callSettings,
49
+ ...config.callSettings
50
+ };
51
+ }
52
+ return acc;
53
+ }, {});
54
+ };
55
+
56
+ export {
57
+ LanguageModelV1CallSettingsSchema,
58
+ LanguageModelConfigSchema,
59
+ mergeModelConfigs
60
+ };
61
+ //# sourceMappingURL=chunk-BV6Y7C43.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/ModelConfigTypes.ts"],"sourcesContent":["import { z } from \"zod\";\nimport type { JSONSchema7 } from \"json-schema\";\n\nexport const LanguageModelV1CallSettingsSchema = z.object({\n maxTokens: z.number().int().positive().optional(),\n temperature: z.number().optional(),\n topP: z.number().optional(),\n presencePenalty: z.number().optional(),\n frequencyPenalty: z.number().optional(),\n seed: z.number().int().optional(),\n headers: z.record(z.string().optional()).optional(),\n});\n\nexport type LanguageModelV1CallSettings = z.infer<\n typeof LanguageModelV1CallSettingsSchema\n>;\n\nexport const LanguageModelConfigSchema = z.object({\n apiKey: z.string().optional(),\n baseUrl: z.string().optional(),\n modelName: z.string().optional(),\n});\n\nexport type LanguageModelConfig = z.infer<typeof LanguageModelConfigSchema>;\n\ntype ToolExecuteFunction<TArgs, TResult> = (\n args: TArgs,\n) => TResult | Promise<TResult>;\n\nexport type Tool<\n TArgs extends Record<string, unknown> = Record<string | number, unknown>,\n TResult = unknown,\n> = {\n description?: string | undefined;\n parameters: z.ZodSchema<TArgs> | JSONSchema7;\n execute?: ToolExecuteFunction<TArgs, TResult>;\n};\n\nexport type ModelConfig = {\n priority?: number | undefined;\n system?: string | undefined;\n tools?: Record<string, Tool<any, any>> | undefined;\n callSettings?: LanguageModelV1CallSettings | undefined;\n config?: LanguageModelConfig | undefined;\n};\n\nexport type ModelConfigProvider = { getModelConfig: () => ModelConfig };\n\nexport const mergeModelConfigs = (\n configSet: Set<ModelConfigProvider>,\n): ModelConfig => {\n const configs = Array.from(configSet)\n .map((c) => c.getModelConfig())\n .sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));\n\n return configs.reduce((acc, config) => {\n if (config.system) {\n if (acc.system) {\n // TODO should the separator be configurable?\n acc.system += `\\n\\n${config.system}`;\n } else {\n acc.system = config.system;\n }\n }\n if (config.tools) {\n for (const [name, tool] of Object.entries(config.tools)) {\n if (acc.tools?.[name]) {\n throw new Error(\n `You tried to define a tool with the name ${name}, but it already exists.`,\n );\n }\n if (!acc.tools) acc.tools = {};\n acc.tools[name] = tool;\n }\n }\n if (config.config) {\n acc.config = {\n ...acc.config,\n ...config.config,\n };\n }\n if (config.callSettings) {\n acc.callSettings = {\n ...acc.callSettings,\n ...config.callSettings,\n };\n }\n return acc;\n }, {} as ModelConfig);\n};\n"],"mappings":";AAAA,SAAS,SAAS;AAGX,IAAM,oCAAoC,EAAE,OAAO;AAAA,EACxD,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EAChD,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,iBAAiB,EAAE,OAAO,EAAE,SAAS;AAAA,EACrC,kBAAkB,EAAE,OAAO,EAAE,SAAS;AAAA,EACtC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EAChC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS;AACpD,CAAC;AAMM,IAAM,4BAA4B,EAAE,OAAO;AAAA,EAChD,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,WAAW,EAAE,OAAO,EAAE,SAAS;AACjC,CAAC;AA2BM,IAAM,oBAAoB,CAC/B,cACgB;AAChB,QAAM,UAAU,MAAM,KAAK,SAAS,EACjC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC,EAC7B,KAAK,CAAC,GAAG,OAAO,EAAE,YAAY,MAAM,EAAE,YAAY,EAAE;AAEvD,SAAO,QAAQ,OAAO,CAAC,KAAK,WAAW;AACrC,QAAI,OAAO,QAAQ;AACjB,UAAI,IAAI,QAAQ;AAEd,YAAI,UAAU;AAAA;AAAA,EAAO,OAAO,MAAM;AAAA,MACpC,OAAO;AACL,YAAI,SAAS,OAAO;AAAA,MACtB;AAAA,IACF;AACA,QAAI,OAAO,OAAO;AAChB,iBAAW,CAAC,MAAM,IAAI,KAAK,OAAO,QAAQ,OAAO,KAAK,GAAG;AACvD,YAAI,IAAI,QAAQ,IAAI,GAAG;AACrB,gBAAM,IAAI;AAAA,YACR,4CAA4C,IAAI;AAAA,UAClD;AAAA,QACF;AACA,YAAI,CAAC,IAAI,MAAO,KAAI,QAAQ,CAAC;AAC7B,YAAI,MAAM,IAAI,IAAI;AAAA,MACpB;AAAA,IACF;AACA,QAAI,OAAO,QAAQ;AACjB,UAAI,SAAS;AAAA,QACX,GAAG,IAAI;AAAA,QACP,GAAG,OAAO;AAAA,MACZ;AAAA,IACF;AACA,QAAI,OAAO,cAAc;AACvB,UAAI,eAAe;AAAA,QACjB,GAAG,IAAI;AAAA,QACP,GAAG,OAAO;AAAA,MACZ;AAAA,IACF;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAgB;AACtB;","names":[]}
package/dist/edge.d.mts CHANGED
@@ -1,93 +1,8 @@
1
- import { LanguageModelV1LogProbs, LanguageModelV1, LanguageModelV1ToolChoice } from '@ai-sdk/provider';
2
- import { z } from 'zod';
3
- import { JSONSchema7 } from 'json-schema';
4
-
5
- type TextContentPart = {
6
- type: "text";
7
- text: string;
8
- };
9
- type ImageContentPart = {
10
- type: "image";
11
- image: string;
12
- };
13
- type CoreToolCallContentPart<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = {
14
- type: "tool-call";
15
- toolCallId: string;
16
- toolName: string;
17
- args: TArgs;
18
- result?: TResult | undefined;
19
- isError?: boolean | undefined;
20
- };
21
- type ThreadRoundtrip = {
22
- logprobs?: LanguageModelV1LogProbs | undefined;
23
- usage?: {
24
- promptTokens: number;
25
- completionTokens: number;
26
- } | undefined;
27
- };
28
- /** Core Message Types (without UI content parts) */
29
- type CoreUserContentPart = TextContentPart | ImageContentPart;
30
- type CoreAssistantContentPart = TextContentPart | CoreToolCallContentPart;
31
- type CoreSystemMessage = {
32
- role: "system";
33
- content: [TextContentPart];
34
- };
35
- type CoreUserMessage = {
36
- role: "user";
37
- content: CoreUserContentPart[];
38
- };
39
- type CoreAssistantMessage = {
40
- role: "assistant";
41
- content: CoreAssistantContentPart[];
42
- };
43
- type CoreMessage = CoreSystemMessage | CoreUserMessage | CoreAssistantMessage;
44
-
45
- declare const LanguageModelV1CallSettingsSchema: z.ZodObject<{
46
- maxTokens: z.ZodOptional<z.ZodNumber>;
47
- temperature: z.ZodOptional<z.ZodNumber>;
48
- topP: z.ZodOptional<z.ZodNumber>;
49
- presencePenalty: z.ZodOptional<z.ZodNumber>;
50
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
51
- seed: z.ZodOptional<z.ZodNumber>;
52
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
53
- }, "strip", z.ZodTypeAny, {
54
- maxTokens?: number | undefined;
55
- temperature?: number | undefined;
56
- topP?: number | undefined;
57
- presencePenalty?: number | undefined;
58
- frequencyPenalty?: number | undefined;
59
- seed?: number | undefined;
60
- headers?: Record<string, string | undefined> | undefined;
61
- }, {
62
- maxTokens?: number | undefined;
63
- temperature?: number | undefined;
64
- topP?: number | undefined;
65
- presencePenalty?: number | undefined;
66
- frequencyPenalty?: number | undefined;
67
- seed?: number | undefined;
68
- headers?: Record<string, string | undefined> | undefined;
69
- }>;
70
- type LanguageModelV1CallSettings = z.infer<typeof LanguageModelV1CallSettingsSchema>;
71
- declare const LanguageModelConfigSchema: z.ZodObject<{
72
- apiKey: z.ZodOptional<z.ZodString>;
73
- baseUrl: z.ZodOptional<z.ZodString>;
74
- modelName: z.ZodOptional<z.ZodString>;
75
- }, "strip", z.ZodTypeAny, {
76
- apiKey?: string | undefined;
77
- baseUrl?: string | undefined;
78
- modelName?: string | undefined;
79
- }, {
80
- apiKey?: string | undefined;
81
- baseUrl?: string | undefined;
82
- modelName?: string | undefined;
83
- }>;
84
- type LanguageModelConfig = z.infer<typeof LanguageModelConfigSchema>;
85
- type ToolExecuteFunction<TArgs, TResult> = (args: TArgs) => TResult | Promise<TResult>;
86
- type Tool<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = {
87
- description?: string | undefined;
88
- parameters: z.ZodSchema<TArgs> | JSONSchema7;
89
- execute?: ToolExecuteFunction<TArgs, TResult>;
90
- };
1
+ import { LanguageModelV1, LanguageModelV1ToolChoice } from '@ai-sdk/provider';
2
+ import { L as LanguageModelV1CallSettings, T as Tool, C as CoreMessage, a as ThreadRoundtrip, b as LanguageModelConfig } from './ModelConfigTypes-ComYH1b6.mjs';
3
+ import 'react';
4
+ import 'zod';
5
+ import 'json-schema';
91
6
 
92
7
  type FinishResult = {
93
8
  messages: CoreMessage[];
package/dist/edge.d.ts CHANGED
@@ -1,93 +1,8 @@
1
- import { LanguageModelV1LogProbs, LanguageModelV1, LanguageModelV1ToolChoice } from '@ai-sdk/provider';
2
- import { z } from 'zod';
3
- import { JSONSchema7 } from 'json-schema';
4
-
5
- type TextContentPart = {
6
- type: "text";
7
- text: string;
8
- };
9
- type ImageContentPart = {
10
- type: "image";
11
- image: string;
12
- };
13
- type CoreToolCallContentPart<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = {
14
- type: "tool-call";
15
- toolCallId: string;
16
- toolName: string;
17
- args: TArgs;
18
- result?: TResult | undefined;
19
- isError?: boolean | undefined;
20
- };
21
- type ThreadRoundtrip = {
22
- logprobs?: LanguageModelV1LogProbs | undefined;
23
- usage?: {
24
- promptTokens: number;
25
- completionTokens: number;
26
- } | undefined;
27
- };
28
- /** Core Message Types (without UI content parts) */
29
- type CoreUserContentPart = TextContentPart | ImageContentPart;
30
- type CoreAssistantContentPart = TextContentPart | CoreToolCallContentPart;
31
- type CoreSystemMessage = {
32
- role: "system";
33
- content: [TextContentPart];
34
- };
35
- type CoreUserMessage = {
36
- role: "user";
37
- content: CoreUserContentPart[];
38
- };
39
- type CoreAssistantMessage = {
40
- role: "assistant";
41
- content: CoreAssistantContentPart[];
42
- };
43
- type CoreMessage = CoreSystemMessage | CoreUserMessage | CoreAssistantMessage;
44
-
45
- declare const LanguageModelV1CallSettingsSchema: z.ZodObject<{
46
- maxTokens: z.ZodOptional<z.ZodNumber>;
47
- temperature: z.ZodOptional<z.ZodNumber>;
48
- topP: z.ZodOptional<z.ZodNumber>;
49
- presencePenalty: z.ZodOptional<z.ZodNumber>;
50
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
51
- seed: z.ZodOptional<z.ZodNumber>;
52
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
53
- }, "strip", z.ZodTypeAny, {
54
- maxTokens?: number | undefined;
55
- temperature?: number | undefined;
56
- topP?: number | undefined;
57
- presencePenalty?: number | undefined;
58
- frequencyPenalty?: number | undefined;
59
- seed?: number | undefined;
60
- headers?: Record<string, string | undefined> | undefined;
61
- }, {
62
- maxTokens?: number | undefined;
63
- temperature?: number | undefined;
64
- topP?: number | undefined;
65
- presencePenalty?: number | undefined;
66
- frequencyPenalty?: number | undefined;
67
- seed?: number | undefined;
68
- headers?: Record<string, string | undefined> | undefined;
69
- }>;
70
- type LanguageModelV1CallSettings = z.infer<typeof LanguageModelV1CallSettingsSchema>;
71
- declare const LanguageModelConfigSchema: z.ZodObject<{
72
- apiKey: z.ZodOptional<z.ZodString>;
73
- baseUrl: z.ZodOptional<z.ZodString>;
74
- modelName: z.ZodOptional<z.ZodString>;
75
- }, "strip", z.ZodTypeAny, {
76
- apiKey?: string | undefined;
77
- baseUrl?: string | undefined;
78
- modelName?: string | undefined;
79
- }, {
80
- apiKey?: string | undefined;
81
- baseUrl?: string | undefined;
82
- modelName?: string | undefined;
83
- }>;
84
- type LanguageModelConfig = z.infer<typeof LanguageModelConfigSchema>;
85
- type ToolExecuteFunction<TArgs, TResult> = (args: TArgs) => TResult | Promise<TResult>;
86
- type Tool<TArgs extends Record<string, unknown> = Record<string | number, unknown>, TResult = unknown> = {
87
- description?: string | undefined;
88
- parameters: z.ZodSchema<TArgs> | JSONSchema7;
89
- execute?: ToolExecuteFunction<TArgs, TResult>;
90
- };
1
+ import { LanguageModelV1, LanguageModelV1ToolChoice } from '@ai-sdk/provider';
2
+ import { L as LanguageModelV1CallSettings, T as Tool, C as CoreMessage, a as ThreadRoundtrip, b as LanguageModelConfig } from './ModelConfigTypes-ComYH1b6.js';
3
+ import 'react';
4
+ import 'zod';
5
+ import 'json-schema';
91
6
 
92
7
  type FinishResult = {
93
8
  messages: CoreMessage[];