llmz 0.4.0 → 0.5.0
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/dist/{chunk-VC5IEFWI.js → chunk-4POZJQXN.js} +1 -1
- package/dist/{chunk-QDPE3KRX.cjs → chunk-5WBNTV42.cjs} +6 -6
- package/dist/{chunk-7CH23XHW.cjs → chunk-KTDBAJBB.cjs} +39 -14
- package/dist/{chunk-Q673NO2A.js → chunk-LOX7GOR6.js} +39 -14
- package/dist/component.d.ts +32 -0
- package/dist/component.default.d.ts +120 -64
- package/dist/{dual-modes-KZYB4L4M.js → dual-modes-S5TJ5JVJ.js} +1 -1
- package/dist/{dual-modes-FWUVU6C7.cjs → dual-modes-TCMWBZIH.cjs} +2 -2
- package/dist/{execute-4RIQATCY.js → execute-FF7D46TY.js} +2 -2
- package/dist/{execute-KHQ45ANS.cjs → execute-IK6O4SU2.cjs} +17 -17
- package/dist/index.cjs +75 -116
- package/dist/index.js +67 -108
- package/dist/index.workerd.js +96 -116
- package/dist/prompts/chat-mode/system.md.d.ts +1 -1
- package/package.json +1 -1
|
@@ -6,11 +6,16 @@ export declare const DefaultComponents: {
|
|
|
6
6
|
description: string;
|
|
7
7
|
name: string;
|
|
8
8
|
aliases: string[];
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
generation: {
|
|
10
|
+
usage: string;
|
|
11
|
+
examples: {
|
|
12
|
+
props: {
|
|
13
|
+
action: string;
|
|
14
|
+
label: string;
|
|
15
|
+
value: string;
|
|
16
|
+
};
|
|
17
|
+
}[];
|
|
18
|
+
};
|
|
14
19
|
leaf: {
|
|
15
20
|
props: z.ZodObject<{
|
|
16
21
|
action: z.ZodDefault<z.ZodEnum<["say", "url", "postback"]>>;
|
|
@@ -25,11 +30,14 @@ export declare const DefaultComponents: {
|
|
|
25
30
|
name: string;
|
|
26
31
|
description: string;
|
|
27
32
|
aliases: never[];
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
generation: {
|
|
34
|
+
examples: {
|
|
35
|
+
props: {
|
|
36
|
+
url: string;
|
|
37
|
+
alt: string;
|
|
38
|
+
};
|
|
39
|
+
}[];
|
|
40
|
+
};
|
|
33
41
|
leaf: {
|
|
34
42
|
props: z.ZodObject<{
|
|
35
43
|
url: z.ZodString;
|
|
@@ -42,11 +50,14 @@ export declare const DefaultComponents: {
|
|
|
42
50
|
name: string;
|
|
43
51
|
description: string;
|
|
44
52
|
aliases: never[];
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
generation: {
|
|
54
|
+
examples: {
|
|
55
|
+
props: {
|
|
56
|
+
url: string;
|
|
57
|
+
name: string;
|
|
58
|
+
};
|
|
59
|
+
}[];
|
|
60
|
+
};
|
|
50
61
|
leaf: {
|
|
51
62
|
props: z.ZodObject<{
|
|
52
63
|
url: z.ZodString;
|
|
@@ -59,11 +70,14 @@ export declare const DefaultComponents: {
|
|
|
59
70
|
name: string;
|
|
60
71
|
description: string;
|
|
61
72
|
aliases: never[];
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
generation: {
|
|
74
|
+
examples: {
|
|
75
|
+
props: {
|
|
76
|
+
url: string;
|
|
77
|
+
title: string;
|
|
78
|
+
};
|
|
79
|
+
}[];
|
|
80
|
+
};
|
|
67
81
|
leaf: {
|
|
68
82
|
props: z.ZodObject<{
|
|
69
83
|
url: z.ZodString;
|
|
@@ -76,11 +90,14 @@ export declare const DefaultComponents: {
|
|
|
76
90
|
name: string;
|
|
77
91
|
description: string;
|
|
78
92
|
aliases: never[];
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
93
|
+
generation: {
|
|
94
|
+
examples: {
|
|
95
|
+
props: {
|
|
96
|
+
url: string;
|
|
97
|
+
title: string;
|
|
98
|
+
};
|
|
99
|
+
}[];
|
|
100
|
+
};
|
|
84
101
|
leaf: {
|
|
85
102
|
props: z.ZodObject<{
|
|
86
103
|
url: z.ZodString;
|
|
@@ -93,11 +110,15 @@ export declare const DefaultComponents: {
|
|
|
93
110
|
name: string;
|
|
94
111
|
description: string;
|
|
95
112
|
aliases: never[];
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
113
|
+
generation: {
|
|
114
|
+
examples: {
|
|
115
|
+
props: {
|
|
116
|
+
title: string;
|
|
117
|
+
subtitle: string;
|
|
118
|
+
};
|
|
119
|
+
body: string;
|
|
120
|
+
}[];
|
|
121
|
+
};
|
|
101
122
|
container: {
|
|
102
123
|
props: z.ZodObject<{
|
|
103
124
|
title: z.ZodString;
|
|
@@ -110,11 +131,14 @@ export declare const DefaultComponents: {
|
|
|
110
131
|
name: string;
|
|
111
132
|
description: string;
|
|
112
133
|
aliases: never[];
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
134
|
+
generation: {
|
|
135
|
+
examples: {
|
|
136
|
+
props: {
|
|
137
|
+
url: string;
|
|
138
|
+
alt: string;
|
|
139
|
+
};
|
|
140
|
+
}[];
|
|
141
|
+
};
|
|
118
142
|
leaf: {
|
|
119
143
|
props: z.ZodObject<{
|
|
120
144
|
url: z.ZodString;
|
|
@@ -129,11 +153,16 @@ export declare const DefaultComponents: {
|
|
|
129
153
|
description: string;
|
|
130
154
|
name: string;
|
|
131
155
|
aliases: string[];
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
156
|
+
generation: {
|
|
157
|
+
usage: string;
|
|
158
|
+
examples: {
|
|
159
|
+
props: {
|
|
160
|
+
action: string;
|
|
161
|
+
label: string;
|
|
162
|
+
value: string;
|
|
163
|
+
};
|
|
164
|
+
}[];
|
|
165
|
+
};
|
|
137
166
|
leaf: {
|
|
138
167
|
props: z.ZodObject<{
|
|
139
168
|
action: z.ZodDefault<z.ZodEnum<["say", "url", "postback"]>>;
|
|
@@ -151,11 +180,6 @@ export declare const DefaultComponents: {
|
|
|
151
180
|
name: string;
|
|
152
181
|
description: string;
|
|
153
182
|
aliases: never[];
|
|
154
|
-
examples: {
|
|
155
|
-
name: string;
|
|
156
|
-
description: string;
|
|
157
|
-
code: string;
|
|
158
|
-
}[];
|
|
159
183
|
container: {
|
|
160
184
|
props: z.ZodObject<{}, "strip">;
|
|
161
185
|
children: {
|
|
@@ -165,11 +189,15 @@ export declare const DefaultComponents: {
|
|
|
165
189
|
name: string;
|
|
166
190
|
description: string;
|
|
167
191
|
aliases: never[];
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
192
|
+
generation: {
|
|
193
|
+
examples: {
|
|
194
|
+
props: {
|
|
195
|
+
title: string;
|
|
196
|
+
subtitle: string;
|
|
197
|
+
};
|
|
198
|
+
body: string;
|
|
199
|
+
}[];
|
|
200
|
+
};
|
|
173
201
|
container: {
|
|
174
202
|
props: z.ZodObject<{
|
|
175
203
|
title: z.ZodString;
|
|
@@ -182,11 +210,14 @@ export declare const DefaultComponents: {
|
|
|
182
210
|
name: string;
|
|
183
211
|
description: string;
|
|
184
212
|
aliases: never[];
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
213
|
+
generation: {
|
|
214
|
+
examples: {
|
|
215
|
+
props: {
|
|
216
|
+
url: string;
|
|
217
|
+
alt: string;
|
|
218
|
+
};
|
|
219
|
+
}[];
|
|
220
|
+
};
|
|
190
221
|
leaf: {
|
|
191
222
|
props: z.ZodObject<{
|
|
192
223
|
url: z.ZodString;
|
|
@@ -201,11 +232,16 @@ export declare const DefaultComponents: {
|
|
|
201
232
|
description: string;
|
|
202
233
|
name: string;
|
|
203
234
|
aliases: string[];
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
235
|
+
generation: {
|
|
236
|
+
usage: string;
|
|
237
|
+
examples: {
|
|
238
|
+
props: {
|
|
239
|
+
action: string;
|
|
240
|
+
label: string;
|
|
241
|
+
value: string;
|
|
242
|
+
};
|
|
243
|
+
}[];
|
|
244
|
+
};
|
|
209
245
|
leaf: {
|
|
210
246
|
props: z.ZodObject<{
|
|
211
247
|
action: z.ZodDefault<z.ZodEnum<["say", "url", "postback"]>>;
|
|
@@ -226,11 +262,31 @@ export declare const DefaultComponents: {
|
|
|
226
262
|
name: string;
|
|
227
263
|
aliases: string[];
|
|
228
264
|
description: string;
|
|
229
|
-
|
|
230
|
-
|
|
265
|
+
generation: {
|
|
266
|
+
examples: {
|
|
267
|
+
body: string;
|
|
268
|
+
}[];
|
|
269
|
+
};
|
|
270
|
+
default: {
|
|
271
|
+
props: z.ZodObject<{}, "strip">;
|
|
272
|
+
children: never[];
|
|
273
|
+
};
|
|
274
|
+
}>;
|
|
275
|
+
Speech: Component<{
|
|
276
|
+
type: "default";
|
|
277
|
+
name: string;
|
|
278
|
+
aliases: string[];
|
|
279
|
+
description: string;
|
|
280
|
+
body: {
|
|
281
|
+
format: "text";
|
|
231
282
|
description: string;
|
|
232
|
-
|
|
233
|
-
|
|
283
|
+
};
|
|
284
|
+
generation: {
|
|
285
|
+
usage: string;
|
|
286
|
+
examples: {
|
|
287
|
+
body: string;
|
|
288
|
+
}[];
|
|
289
|
+
};
|
|
234
290
|
default: {
|
|
235
291
|
props: z.ZodObject<{}, "strip">;
|
|
236
292
|
children: never[];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkKTDBAJBBcjs = require('./chunk-KTDBAJBB.cjs');
|
|
4
4
|
require('./chunk-KIN7Y247.cjs');
|
|
5
5
|
require('./chunk-HEAQAEFZ.cjs');
|
|
6
6
|
require('./chunk-GOWPACSK.cjs');
|
|
7
7
|
require('./chunk-HC2QZTVT.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.DualModePrompt =
|
|
10
|
+
exports.DualModePrompt = _chunkKTDBAJBBcjs.DualModePrompt;
|
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
SuccessExecutionResult,
|
|
12
12
|
_CustomModelClient,
|
|
13
13
|
parseExit
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-4POZJQXN.js";
|
|
15
15
|
import {
|
|
16
16
|
StreamingMessageParser,
|
|
17
17
|
toParsedAssistantResponse
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-LOX7GOR6.js";
|
|
19
19
|
import "./chunk-UGHFNCPD.js";
|
|
20
20
|
import "./chunk-TDALRNGL.js";
|
|
21
21
|
import "./chunk-GDJTKI7J.js";
|
|
@@ -11,11 +11,11 @@ var _chunk3UZKLXADcjs = require('./chunk-3UZKLXAD.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunk5WBNTV42cjs = require('./chunk-5WBNTV42.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkKTDBAJBBcjs = require('./chunk-KTDBAJBB.cjs');
|
|
19
19
|
require('./chunk-RGUG3UMF.cjs');
|
|
20
20
|
require('./chunk-PZE6PIPG.cjs');
|
|
21
21
|
require('./chunk-HMMM32RG.cjs');
|
|
@@ -227,7 +227,7 @@ var generateCode = async ({
|
|
|
227
227
|
}
|
|
228
228
|
};
|
|
229
229
|
if (typeof cognitive.generateTextStream === "function") {
|
|
230
|
-
const parser = new (0,
|
|
230
|
+
const parser = new (0, _chunkKTDBAJBBcjs.StreamingMessageParser)();
|
|
231
231
|
const fence = new LeadingFenceFilter();
|
|
232
232
|
const streamController = createJoinedAbortController([controller.signal]);
|
|
233
233
|
const requestedAt = Date.now();
|
|
@@ -286,7 +286,7 @@ var generateCode = async ({
|
|
|
286
286
|
await dispatchSends(parser.push(remaining));
|
|
287
287
|
}
|
|
288
288
|
await dispatchSends(parser.finish());
|
|
289
|
-
assistantResponse =
|
|
289
|
+
assistantResponse = _chunkKTDBAJBBcjs.toParsedAssistantResponse.call(void 0, parser.items, raw);
|
|
290
290
|
} else {
|
|
291
291
|
const response = await cognitive.generateText(input, { signal: controller.signal }).catch((thrown) => {
|
|
292
292
|
throw new (0, _chunkPK72FAKDcjs.CognitiveError)(`LLM generation failed: ${_chunkGOWPACSKcjs.getErrorMessage.call(void 0, thrown)}`);
|
|
@@ -436,7 +436,7 @@ var applyNextExit = async ({
|
|
|
436
436
|
if (!next) {
|
|
437
437
|
throw new Error("applyNextExit called without a \u25A0next block on the iteration");
|
|
438
438
|
}
|
|
439
|
-
const attempt = (props) =>
|
|
439
|
+
const attempt = (props) => _chunk5WBNTV42cjs.parseExit.call(void 0, Object.keys(props).length ? { action: next.name, value: props } : { action: next.name }, iteration.exits);
|
|
440
440
|
let parsedExit = attempt(next.props);
|
|
441
441
|
const keys = Object.keys(next.props);
|
|
442
442
|
if (!parsedExit.success && keys.length === 1 && ["props", "value", "data"].includes(keys[0])) {
|
|
@@ -743,8 +743,8 @@ var executeContextInternal = async (props) => {
|
|
|
743
743
|
const controller = createJoinedAbortController([props.signal]);
|
|
744
744
|
const { onIterationStart, onIterationEnd, onTrace, onExit, onBeforeExecution, onAfterTool, onBeforeTool } = props;
|
|
745
745
|
const client = _nullishCoalesce(props.client, () => ( new (0, _client.Client)()));
|
|
746
|
-
const cognitive = _cognitive.Cognitive.isCognitiveClient(client) ||
|
|
747
|
-
const ctx = new (0,
|
|
746
|
+
const cognitive = _cognitive.Cognitive.isCognitiveClient(client) || _chunk5WBNTV42cjs._CustomModelClient.isCustomClient(client) ? client : new (0, _cognitive.Cognitive)({ client });
|
|
747
|
+
const ctx = new (0, _chunk5WBNTV42cjs.Context)({
|
|
748
748
|
chat: props.chat,
|
|
749
749
|
instructions: props.instructions,
|
|
750
750
|
objects: props.objects,
|
|
@@ -763,7 +763,7 @@ var executeContextInternal = async (props) => {
|
|
|
763
763
|
try {
|
|
764
764
|
while (true) {
|
|
765
765
|
if (ctx.iterations.length >= ctx.loop) {
|
|
766
|
-
return new (0,
|
|
766
|
+
return new (0, _chunk5WBNTV42cjs.ErrorExecutionResult)(ctx, new (0, _chunkPK72FAKDcjs.LoopExceededError)());
|
|
767
767
|
}
|
|
768
768
|
const iteration = await ctx.nextIteration();
|
|
769
769
|
const unsubscribeTrace = iteration.traces.onPush((traces) => {
|
|
@@ -794,7 +794,7 @@ var executeContextInternal = async (props) => {
|
|
|
794
794
|
}
|
|
795
795
|
}
|
|
796
796
|
});
|
|
797
|
-
return new (0,
|
|
797
|
+
return new (0, _chunk5WBNTV42cjs.ErrorExecutionResult)(ctx, _nullishCoalesce(controller.signal.reason, () => ( "The operation was aborted")));
|
|
798
798
|
}
|
|
799
799
|
const iterationResult = await executeIterationWithErrorHandling({
|
|
800
800
|
iteration,
|
|
@@ -824,7 +824,7 @@ var executeContextInternal = async (props) => {
|
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
826
|
} catch (error) {
|
|
827
|
-
return new (0,
|
|
827
|
+
return new (0, _chunk5WBNTV42cjs.ErrorExecutionResult)(ctx, _nullishCoalesce(error, () => ( "Unknown error")));
|
|
828
828
|
}
|
|
829
829
|
};
|
|
830
830
|
var executeIterationStartHook = async ({
|
|
@@ -911,7 +911,7 @@ var executeIterationWithErrorHandling = async ({
|
|
|
911
911
|
if (!controller.signal.aborted) {
|
|
912
912
|
return {
|
|
913
913
|
type: "return",
|
|
914
|
-
result: new (0,
|
|
914
|
+
result: new (0, _chunk5WBNTV42cjs.ErrorExecutionResult)(ctx, err)
|
|
915
915
|
};
|
|
916
916
|
}
|
|
917
917
|
await finalizeIteration({
|
|
@@ -927,7 +927,7 @@ var executeIterationWithErrorHandling = async ({
|
|
|
927
927
|
});
|
|
928
928
|
return {
|
|
929
929
|
type: "return",
|
|
930
|
-
result: new (0,
|
|
930
|
+
result: new (0, _chunk5WBNTV42cjs.ErrorExecutionResult)(ctx, _nullishCoalesce(controller.signal.reason, () => ( "The operation was aborted")))
|
|
931
931
|
};
|
|
932
932
|
}
|
|
933
933
|
};
|
|
@@ -939,7 +939,7 @@ var transformIterationResult = ({
|
|
|
939
939
|
const exitName = iteration.status.exit_success.exit_name;
|
|
940
940
|
return {
|
|
941
941
|
type: "return",
|
|
942
|
-
result: new (0,
|
|
942
|
+
result: new (0, _chunk5WBNTV42cjs.SuccessExecutionResult)(ctx, {
|
|
943
943
|
exit: iteration.exits.find((x) => x.name === exitName),
|
|
944
944
|
result: iteration.status.exit_success.return_value
|
|
945
945
|
})
|
|
@@ -948,17 +948,17 @@ var transformIterationResult = ({
|
|
|
948
948
|
if (iteration.status.type === "callback_requested") {
|
|
949
949
|
return {
|
|
950
950
|
type: "return",
|
|
951
|
-
result: new (0,
|
|
951
|
+
result: new (0, _chunk5WBNTV42cjs.PartialExecutionResult)(
|
|
952
952
|
ctx,
|
|
953
953
|
iteration.status.callback_requested.signal,
|
|
954
|
-
|
|
954
|
+
_chunk5WBNTV42cjs.Snapshot.fromSignal(iteration.status.callback_requested.signal)
|
|
955
955
|
)
|
|
956
956
|
};
|
|
957
957
|
}
|
|
958
958
|
if (iteration.status.type === "aborted") {
|
|
959
959
|
return {
|
|
960
960
|
type: "return",
|
|
961
|
-
result: new (0,
|
|
961
|
+
result: new (0, _chunk5WBNTV42cjs.ErrorExecutionResult)(ctx, _nullishCoalesce(iteration.error, () => ( "The operation was aborted")))
|
|
962
962
|
};
|
|
963
963
|
}
|
|
964
964
|
if (iteration.status.type === "thinking_requested" || iteration.status.type === "exit_error" || iteration.status.type === "execution_error" || iteration.status.type === "invalid_code_error") {
|
|
@@ -966,7 +966,7 @@ var transformIterationResult = ({
|
|
|
966
966
|
}
|
|
967
967
|
return {
|
|
968
968
|
type: "return",
|
|
969
|
-
result: new (0,
|
|
969
|
+
result: new (0, _chunk5WBNTV42cjs.ErrorExecutionResult)(ctx, _nullishCoalesce(iteration.error, () => ( `Unknown error. Status: ${iteration.status.type}`)))
|
|
970
970
|
};
|
|
971
971
|
};
|
|
972
972
|
var executeIteration = async ({
|