llmz 0.0.41 → 0.0.43

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.cjs CHANGED
@@ -1112,11 +1112,11 @@ var utils = {
1112
1112
  truncateWrappedContent: _chunkGZPN7RGHcjs.truncateWrappedContent
1113
1113
  };
1114
1114
  var execute = async (props) => {
1115
- const { executeContext } = await Promise.resolve().then(() => _interopRequireWildcard(require("./llmz-VNYSCUF6.cjs")));
1115
+ const { executeContext } = await Promise.resolve().then(() => _interopRequireWildcard(require("./llmz-ACSZOYZP.cjs")));
1116
1116
  return executeContext(props);
1117
1117
  };
1118
1118
  var init = async () => {
1119
- await Promise.resolve().then(() => _interopRequireWildcard(require("./llmz-VNYSCUF6.cjs")));
1119
+ await Promise.resolve().then(() => _interopRequireWildcard(require("./llmz-ACSZOYZP.cjs")));
1120
1120
  await Promise.resolve().then(() => _interopRequireWildcard(require("./component-AAEMNCHB.cjs")));
1121
1121
  await Promise.resolve().then(() => _interopRequireWildcard(require("./tool-MRVFOE5N.cjs")));
1122
1122
  await Promise.resolve().then(() => _interopRequireWildcard(require("./exit-XAYKJ6TR.cjs")));
package/dist/index.js CHANGED
@@ -1112,11 +1112,11 @@ var utils = {
1112
1112
  truncateWrappedContent
1113
1113
  };
1114
1114
  var execute = async (props) => {
1115
- const { executeContext } = await import("./llmz-LCFWXQDP.js");
1115
+ const { executeContext } = await import("./llmz-O536FBHV.js");
1116
1116
  return executeContext(props);
1117
1117
  };
1118
1118
  var init = async () => {
1119
- await import("./llmz-LCFWXQDP.js");
1119
+ await import("./llmz-O536FBHV.js");
1120
1120
  await import("./component-EOMTLA64.js");
1121
1121
  await import("./tool-M2N7SKNZ.js");
1122
1122
  await import("./exit-YLO7BY7Z.js");
@@ -0,0 +1 @@
1
+ export {};
@@ -168,6 +168,9 @@ var _executeContext = async (props) => {
168
168
  onBeforeTool
169
169
  });
170
170
  } catch (err) {
171
+ if (err instanceof _chunkPK72FAKDcjs.CognitiveError) {
172
+ return new (0, _chunk4NQXHRJ2cjs.ErrorExecutionResult)(ctx, err);
173
+ }
171
174
  iteration.end({
172
175
  type: "execution_error",
173
176
  execution_error: {
@@ -224,7 +227,10 @@ var executeIteration = async ({
224
227
  var _a, _b, _c, _d;
225
228
  let startedAt = Date.now();
226
229
  const traces = iteration.traces;
227
- const model = await cognitive.getModelDetails(Array.isArray(iteration.model) ? iteration.model[0] : iteration.model);
230
+ const modelRef = Array.isArray(iteration.model) ? iteration.model[0] : iteration.model;
231
+ const model = await cognitive.getModelDetails(modelRef).catch((thrown) => {
232
+ throw new (0, _chunkPK72FAKDcjs.CognitiveError)(`Failed to fetch model details for model "${modelRef}": ${getErrorMessage(thrown)}`);
233
+ });
228
234
  const modelLimit = Math.max(model.input.maxTokens, 8e3);
229
235
  const responseLengthBuffer = getModelOutputLimit(modelLimit);
230
236
  const messages = _chunkGZPN7RGHcjs.truncateWrappedContent.call(void 0, {
@@ -253,6 +259,8 @@ var executeIteration = async ({
253
259
  responseFormat: "text",
254
260
  messages: messages.filter((x) => x.role !== "system"),
255
261
  stopSequences: ctx.version.getStopTokens()
262
+ }).catch((thrown) => {
263
+ throw new (0, _chunkPK72FAKDcjs.CognitiveError)(`LLM generation failed: ${getErrorMessage(thrown)}`);
256
264
  });
257
265
  const out = typeof ((_c = (_b = output.output.choices) == null ? void 0 : _b[0]) == null ? void 0 : _c.content) === "string" ? output.output.choices[0].content : null;
258
266
  if (!out) {
@@ -168,6 +168,9 @@ var _executeContext = async (props) => {
168
168
  onBeforeTool
169
169
  });
170
170
  } catch (err) {
171
+ if (err instanceof CognitiveError) {
172
+ return new ErrorExecutionResult(ctx, err);
173
+ }
171
174
  iteration.end({
172
175
  type: "execution_error",
173
176
  execution_error: {
@@ -224,7 +227,10 @@ var executeIteration = async ({
224
227
  var _a, _b, _c, _d;
225
228
  let startedAt = Date.now();
226
229
  const traces = iteration.traces;
227
- const model = await cognitive.getModelDetails(Array.isArray(iteration.model) ? iteration.model[0] : iteration.model);
230
+ const modelRef = Array.isArray(iteration.model) ? iteration.model[0] : iteration.model;
231
+ const model = await cognitive.getModelDetails(modelRef).catch((thrown) => {
232
+ throw new CognitiveError(`Failed to fetch model details for model "${modelRef}": ${getErrorMessage(thrown)}`);
233
+ });
228
234
  const modelLimit = Math.max(model.input.maxTokens, 8e3);
229
235
  const responseLengthBuffer = getModelOutputLimit(modelLimit);
230
236
  const messages = truncateWrappedContent({
@@ -253,6 +259,8 @@ var executeIteration = async ({
253
259
  responseFormat: "text",
254
260
  messages: messages.filter((x) => x.role !== "system"),
255
261
  stopSequences: ctx.version.getStopTokens()
262
+ }).catch((thrown) => {
263
+ throw new CognitiveError(`LLM generation failed: ${getErrorMessage(thrown)}`);
256
264
  });
257
265
  const out = typeof ((_c = (_b = output.output.choices) == null ? void 0 : _b[0]) == null ? void 0 : _c.content) === "string" ? output.output.choices[0].content : null;
258
266
  if (!out) {
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/eslint.config.mjs CHANGED
@@ -3,7 +3,7 @@ import rootConfig from '../../eslint.config.mjs'
3
3
  export default [
4
4
  ...rootConfig,
5
5
  {
6
- ignores: ['src/__tests__/**/*', 'tsup.config.ts', 'vitest.*.ts'],
6
+ ignores: ['e2e/__tests__/**/*', 'tsup.config.ts', 'vitest.*.ts'],
7
7
  languageOptions: {
8
8
  parserOptions: {
9
9
  project: ['./tsconfig.json'],
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "llmz",
3
3
  "type": "module",
4
4
  "description": "LLMz - An LLM-native Typescript VM built on top of Zui",
5
- "version": "0.0.41",
5
+ "version": "0.0.43",
6
6
  "types": "./dist/index.d.ts",
7
7
  "main": "./dist/index.cjs",
8
8
  "module": "./dist/index.js",
@@ -20,9 +20,10 @@
20
20
  "build": "tsup && pnpm tsc --emitDeclarationOnly",
21
21
  "check:type": "tsc --noEmit",
22
22
  "watch": "tsup --watch",
23
- "test": "vitest run --config vitest.config.ts",
24
- "test:update": "vitest -u run --config vitest.config.ts",
25
- "test:watch": "vitest --config vitest.config.ts",
23
+ "test": "vitest --run",
24
+ "test:e2e": "vitest run --config vitest.e2e.config.ts",
25
+ "test:e2e:update": "vitest -u run --config vitest.e2e.config.ts",
26
+ "test:e2e:watch": "vitest --config vitest.e2e.config.ts",
26
27
  "build:markdown": "node --loader ts-node/esm ./scripts/compile-markdown.mts"
27
28
  },
28
29
  "keywords": [],
@@ -71,7 +72,7 @@
71
72
  },
72
73
  "peerDependencies": {
73
74
  "@botpress/client": "1.29.0",
74
- "@botpress/cognitive": "0.3.5",
75
+ "@botpress/cognitive": "0.3.6",
75
76
  "@bpinternal/thicktoken": "^1.0.5",
76
77
  "@bpinternal/zui": "^1.3.2"
77
78
  },