@botpress/zai 2.0.10 → 2.0.12

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.
@@ -1,4 +1,4 @@
1
- import { z } from "@bpinternal/zui";
1
+ import { transforms, z } from "@bpinternal/zui";
2
2
  import { Adapter } from "./adapter";
3
3
  const CRITICAL_TAGS = {
4
4
  system: "true",
@@ -37,7 +37,7 @@ const TableSchema = z.object({
37
37
  });
38
38
  const searchableColumns = ["input"];
39
39
  const TableJsonSchema = Object.entries(TableSchema.shape).reduce((acc, [key, value]) => {
40
- acc[key] = value.toJsonSchema();
40
+ acc[key] = transforms.toJSONSchemaLegacy(value);
41
41
  acc[key]["x-zui"] ??= {};
42
42
  acc[key]["x-zui"].searchable = searchableColumns.includes(key);
43
43
  return acc;
@@ -39,7 +39,7 @@ Zai.prototype.extract = async function(input, _schema, _options) {
39
39
  } else {
40
40
  throw new Error("Schema must be either a ZuiObject or a ZuiArray<ZuiObject>");
41
41
  }
42
- const schemaTypescript = schema.toTypescript({ declaration: false });
42
+ const schemaTypescript = schema.toTypescriptType({ declaration: false });
43
43
  const schemaLength = tokenizer.count(schemaTypescript);
44
44
  options.chunkLength = Math.min(
45
45
  options.chunkLength,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@botpress/zai",
3
3
  "description": "Zui AI (zai) – An LLM utility library written on top of Zui and the Botpress API",
4
- "version": "2.0.10",
4
+ "version": "2.0.12",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "exports": {
@@ -23,7 +23,7 @@
23
23
  "author": "",
24
24
  "license": "ISC",
25
25
  "dependencies": {
26
- "@botpress/cognitive": "0.1.24",
26
+ "@botpress/cognitive": "0.1.26",
27
27
  "json5": "^2.2.3",
28
28
  "jsonrepair": "^3.10.0",
29
29
  "lodash-es": "^4.17.21"
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@bpinternal/thicktoken": "^1.0.0",
45
- "@bpinternal/zui": "^0.22.5"
45
+ "@bpinternal/zui": "^1.0.0"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=18.0.0"
@@ -1,5 +1,5 @@
1
1
  import { type Client } from '@botpress/client'
2
- import { z } from '@bpinternal/zui'
2
+ import { transforms, z } from '@bpinternal/zui'
3
3
 
4
4
  import { GenerationMetadata } from '../utils'
5
5
  import { Adapter, GetExamplesProps, SaveExampleProps } from './adapter'
@@ -73,7 +73,7 @@ const TableSchema = z.object({
73
73
  const searchableColumns = ['input'] as const satisfies Array<keyof typeof TableSchema.shape> as string[]
74
74
 
75
75
  const TableJsonSchema = Object.entries(TableSchema.shape).reduce((acc, [key, value]) => {
76
- acc[key] = value.toJsonSchema()
76
+ acc[key] = transforms.toJSONSchemaLegacy(value)
77
77
  acc[key]['x-zui'] ??= {}
78
78
  acc[key]['x-zui'].searchable = searchableColumns.includes(key)
79
79
  return acc
@@ -82,7 +82,7 @@ Zai.prototype.extract = async function <S extends OfType<AnyObjectOrArray>>(
82
82
  throw new Error('Schema must be either a ZuiObject or a ZuiArray<ZuiObject>')
83
83
  }
84
84
 
85
- const schemaTypescript = schema.toTypescript({ declaration: false })
85
+ const schemaTypescript = schema.toTypescriptType({ declaration: false })
86
86
  const schemaLength = tokenizer.count(schemaTypescript)
87
87
 
88
88
  options.chunkLength = Math.min(