@botpress/zai 1.0.1 → 1.1.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.
Files changed (47) hide show
  1. package/dist/adapters/adapter.js +2 -0
  2. package/dist/adapters/botpress-table.js +168 -0
  3. package/dist/adapters/memory.js +12 -0
  4. package/dist/index.d.ts +99 -98
  5. package/dist/index.js +9 -1873
  6. package/dist/models.js +387 -0
  7. package/dist/operations/check.js +141 -0
  8. package/dist/operations/constants.js +2 -0
  9. package/dist/operations/errors.js +15 -0
  10. package/dist/operations/extract.js +212 -0
  11. package/dist/operations/filter.js +179 -0
  12. package/dist/operations/label.js +237 -0
  13. package/dist/operations/rewrite.js +111 -0
  14. package/dist/operations/summarize.js +132 -0
  15. package/dist/operations/text.js +46 -0
  16. package/dist/utils.js +43 -0
  17. package/dist/zai.js +140 -0
  18. package/package.json +21 -19
  19. package/src/adapters/adapter.ts +35 -0
  20. package/src/adapters/botpress-table.ts +210 -0
  21. package/src/adapters/memory.ts +13 -0
  22. package/src/index.ts +11 -0
  23. package/src/models.ts +394 -0
  24. package/src/operations/__tests/botpress_docs.txt +26040 -0
  25. package/src/operations/__tests/cache.jsonl +101 -0
  26. package/src/operations/__tests/index.ts +87 -0
  27. package/src/operations/check.ts +187 -0
  28. package/src/operations/constants.ts +2 -0
  29. package/src/operations/errors.ts +9 -0
  30. package/src/operations/extract.ts +291 -0
  31. package/src/operations/filter.ts +231 -0
  32. package/src/operations/label.ts +332 -0
  33. package/src/operations/rewrite.ts +148 -0
  34. package/src/operations/summarize.ts +193 -0
  35. package/src/operations/text.ts +63 -0
  36. package/src/sdk-interfaces/llm/generateContent.ts +127 -0
  37. package/src/sdk-interfaces/llm/listLanguageModels.ts +19 -0
  38. package/src/utils.ts +61 -0
  39. package/src/zai.ts +193 -0
  40. package/tsconfig.json +2 -2
  41. package/dist/index.cjs +0 -1903
  42. package/dist/index.cjs.map +0 -1
  43. package/dist/index.d.cts +0 -916
  44. package/dist/index.js.map +0 -1
  45. package/tsup.config.ts +0 -16
  46. package/vitest.config.ts +0 -9
  47. package/vitest.setup.ts +0 -24
@@ -0,0 +1,2 @@
1
+ export class Adapter {
2
+ }
@@ -0,0 +1,168 @@
1
+ import { z } from "@bpinternal/zui";
2
+ import { BotpressClient, GenerationMetadata } from "../utils";
3
+ import { Adapter } from "./adapter";
4
+ const CRITICAL_TAGS = {
5
+ system: "true",
6
+ "schema-purpose": "active-learning",
7
+ "schema-version": "Oct-2024"
8
+ };
9
+ const OPTIONAL_TAGS = {
10
+ "x-studio-title": "Active Learning",
11
+ "x-studio-description": "Table for storing active learning tasks and examples",
12
+ "x-studio-readonly": "true",
13
+ "x-studio-icon": "lucide://atom",
14
+ "x-studio-color": "green"
15
+ };
16
+ const FACTOR = 30;
17
+ const Props = z.object({
18
+ client: BotpressClient,
19
+ tableName: z.string().regex(
20
+ /^[a-zA-Z0-9_]{1,45}Table$/,
21
+ "Table name must be lowercase and contain only letters, numbers and underscores"
22
+ )
23
+ });
24
+ const TableSchema = z.object({
25
+ taskType: z.string().describe("The type of the task (filter, extract, etc.)"),
26
+ taskId: z.string(),
27
+ key: z.string().describe("A unique key for the task (e.g. a hash of the input, taskId, taskType and instructions)"),
28
+ instructions: z.string(),
29
+ input: z.object({}).passthrough().describe("The input to the task"),
30
+ output: z.object({}).passthrough().describe("The expected output"),
31
+ explanation: z.string().nullable(),
32
+ metadata: GenerationMetadata,
33
+ status: z.enum(["pending", "rejected", "approved"]),
34
+ feedback: z.object({
35
+ rating: z.enum(["very-bad", "bad", "good", "very-good"]),
36
+ comment: z.string().nullable()
37
+ }).nullable().default(null)
38
+ });
39
+ const searchableColumns = ["input"];
40
+ const TableJsonSchema = Object.entries(TableSchema.shape).reduce((acc, [key, value]) => {
41
+ acc[key] = value.toJsonSchema();
42
+ acc[key]["x-zui"] ??= {};
43
+ acc[key]["x-zui"].searchable = searchableColumns.includes(key);
44
+ return acc;
45
+ }, {});
46
+ export class TableAdapter extends Adapter {
47
+ client;
48
+ tableName;
49
+ status;
50
+ constructor(props) {
51
+ super();
52
+ props = Props.parse(props);
53
+ this.client = props.client;
54
+ this.tableName = props.tableName;
55
+ this.status = "ready";
56
+ }
57
+ async getExamples({ taskType, taskId, input }) {
58
+ await this.assertTableExists();
59
+ const { rows } = await this.client.findTableRows({
60
+ table: this.tableName,
61
+ search: JSON.stringify({ value: input }).substring(0, 1023),
62
+ // Search is limited to 1024 characters
63
+ limit: 10,
64
+ // TODO
65
+ filter: {
66
+ // Proximity match of approved examples
67
+ taskType,
68
+ taskId,
69
+ status: "approved"
70
+ }
71
+ }).catch((err) => {
72
+ console.error(`Error fetching examples: ${err.message}`);
73
+ return { rows: [] };
74
+ });
75
+ return rows.map((row) => ({
76
+ key: row.key,
77
+ input: row.input.value,
78
+ output: row.output.value,
79
+ explanation: row.explanation,
80
+ similarity: row.similarity ?? 0
81
+ }));
82
+ }
83
+ async saveExample({
84
+ key,
85
+ taskType,
86
+ taskId,
87
+ instructions,
88
+ input,
89
+ output,
90
+ explanation,
91
+ metadata,
92
+ status = "pending"
93
+ }) {
94
+ await this.assertTableExists();
95
+ await this.client.upsertTableRows({
96
+ table: this.tableName,
97
+ keyColumn: "key",
98
+ rows: [
99
+ {
100
+ key,
101
+ taskType,
102
+ taskId,
103
+ instructions,
104
+ input: { value: input },
105
+ output: { value: output },
106
+ explanation: explanation ?? null,
107
+ status,
108
+ metadata
109
+ }
110
+ ]
111
+ }).catch(() => {
112
+ });
113
+ }
114
+ async assertTableExists() {
115
+ if (this.status !== "ready") {
116
+ return;
117
+ }
118
+ const { table, created } = await this.client.getOrCreateTable({
119
+ table: this.tableName,
120
+ factor: FACTOR,
121
+ frozen: true,
122
+ isComputeEnabled: false,
123
+ tags: {
124
+ ...CRITICAL_TAGS,
125
+ ...OPTIONAL_TAGS
126
+ },
127
+ schema: TableJsonSchema
128
+ }).catch(() => {
129
+ this.status = "error";
130
+ return { table: null, created: false };
131
+ });
132
+ if (!table) {
133
+ return;
134
+ }
135
+ if (!created) {
136
+ const issues = [];
137
+ if (table.factor !== FACTOR) {
138
+ issues.push(`Factor is ${table.factor} instead of ${FACTOR}`);
139
+ }
140
+ if (table.frozen !== true) {
141
+ issues.push("Table is not frozen");
142
+ }
143
+ for (const [key, value] of Object.entries(CRITICAL_TAGS)) {
144
+ if (table.tags?.[key] !== value) {
145
+ issues.push(`Tag ${key} is ${table.tags?.[key]} instead of ${value}`);
146
+ }
147
+ }
148
+ for (const key of Object.keys(TableJsonSchema)) {
149
+ const column = table.schema?.properties[key];
150
+ const expected = TableJsonSchema[key];
151
+ if (!column) {
152
+ issues.push(`Column ${key} is missing`);
153
+ continue;
154
+ }
155
+ if (column.type !== expected.type) {
156
+ issues.push(`Column ${key} has type ${column.type} instead of ${expected.type}`);
157
+ }
158
+ if (expected["x-zui"].searchable && !column["x-zui"].searchable) {
159
+ issues.push(`Column ${key} is not searchable but should be`);
160
+ }
161
+ }
162
+ if (issues.length) {
163
+ this.status = "error";
164
+ }
165
+ }
166
+ this.status = "initialized";
167
+ }
168
+ }
@@ -0,0 +1,12 @@
1
+ import { Adapter } from "./adapter";
2
+ export class MemoryAdapter extends Adapter {
3
+ constructor(examples) {
4
+ super();
5
+ this.examples = examples;
6
+ }
7
+ async getExamples() {
8
+ return this.examples;
9
+ }
10
+ async saveExample() {
11
+ }
12
+ }
package/dist/index.d.ts CHANGED
@@ -1,32 +1,33 @@
1
+ import * as _bpinternal_zui from '@bpinternal/zui';
2
+ import { z } from '@bpinternal/zui';
1
3
  import { Client } from '@botpress/client';
2
- import sdk from '@botpress/sdk';
3
4
  import { TextTokenizer } from '@botpress/wasm';
4
5
 
5
- type GenerationMetadata = sdk.z.input<typeof GenerationMetadata>;
6
- declare const GenerationMetadata: sdk.ZodObject<{
7
- model: sdk.ZodString;
8
- cost: sdk.ZodObject<{
9
- input: sdk.ZodNumber;
10
- output: sdk.ZodNumber;
11
- }, "strip", sdk.ZodTypeAny, {
6
+ type GenerationMetadata = z.input<typeof GenerationMetadata>;
7
+ declare const GenerationMetadata: _bpinternal_zui.ZodObject<{
8
+ model: _bpinternal_zui.ZodString;
9
+ cost: _bpinternal_zui.ZodObject<{
10
+ input: _bpinternal_zui.ZodNumber;
11
+ output: _bpinternal_zui.ZodNumber;
12
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
12
13
  input?: number;
13
14
  output?: number;
14
15
  }, {
15
16
  input?: number;
16
17
  output?: number;
17
18
  }>;
18
- latency: sdk.ZodNumber;
19
- tokens: sdk.ZodObject<{
20
- input: sdk.ZodNumber;
21
- output: sdk.ZodNumber;
22
- }, "strip", sdk.ZodTypeAny, {
19
+ latency: _bpinternal_zui.ZodNumber;
20
+ tokens: _bpinternal_zui.ZodObject<{
21
+ input: _bpinternal_zui.ZodNumber;
22
+ output: _bpinternal_zui.ZodNumber;
23
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
23
24
  input?: number;
24
25
  output?: number;
25
26
  }, {
26
27
  input?: number;
27
28
  output?: number;
28
29
  }>;
29
- }, "strip", sdk.ZodTypeAny, {
30
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
30
31
  model?: string;
31
32
  cost?: {
32
33
  input?: number;
@@ -558,12 +559,12 @@ declare namespace llm {
558
559
  }
559
560
  }
560
561
 
561
- type ActiveLearning = sdk.z.input<typeof ActiveLearning>;
562
- declare const ActiveLearning: sdk.ZodObject<{
563
- enable: sdk.ZodDefault<sdk.ZodBoolean>;
564
- tableName: sdk.ZodDefault<sdk.ZodString>;
565
- taskId: sdk.ZodDefault<sdk.ZodString>;
566
- }, "strip", sdk.ZodTypeAny, {
562
+ type ActiveLearning = z.input<typeof ActiveLearning>;
563
+ declare const ActiveLearning: _bpinternal_zui.ZodObject<{
564
+ enable: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodBoolean>;
565
+ tableName: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodString>;
566
+ taskId: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodString>;
567
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
567
568
  tableName?: string;
568
569
  taskId?: string;
569
570
  enable?: boolean;
@@ -572,23 +573,23 @@ declare const ActiveLearning: sdk.ZodObject<{
572
573
  taskId?: string;
573
574
  enable?: boolean;
574
575
  }>;
575
- type ZaiConfig = sdk.z.input<typeof ZaiConfig>;
576
- declare const ZaiConfig: sdk.ZodObject<{
577
- client: sdk.Schema<Client, sdk.ZodTypeDef, Client>;
578
- userId: sdk.ZodOptional<sdk.ZodString>;
579
- retry: sdk.ZodDefault<sdk.ZodObject<{
580
- maxRetries: sdk.ZodNumber;
581
- }, "strip", sdk.ZodTypeAny, {
576
+ type ZaiConfig = z.input<typeof ZaiConfig>;
577
+ declare const ZaiConfig: _bpinternal_zui.ZodObject<{
578
+ client: z.Schema<any, _bpinternal_zui.ZodTypeDef, any>;
579
+ userId: _bpinternal_zui.ZodOptional<_bpinternal_zui.ZodString>;
580
+ retry: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodObject<{
581
+ maxRetries: _bpinternal_zui.ZodNumber;
582
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
582
583
  maxRetries?: number;
583
584
  }, {
584
585
  maxRetries?: number;
585
586
  }>>;
586
- modelId: sdk.ZodDefault<sdk.Schema<string, sdk.ZodTypeDef, string>>;
587
- activeLearning: sdk.ZodDefault<sdk.ZodObject<{
588
- enable: sdk.ZodDefault<sdk.ZodBoolean>;
589
- tableName: sdk.ZodDefault<sdk.ZodString>;
590
- taskId: sdk.ZodDefault<sdk.ZodString>;
591
- }, "strip", sdk.ZodTypeAny, {
587
+ modelId: _bpinternal_zui.ZodDefault<z.Schema<string, _bpinternal_zui.ZodTypeDef, string>>;
588
+ activeLearning: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodObject<{
589
+ enable: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodBoolean>;
590
+ tableName: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodString>;
591
+ taskId: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodString>;
592
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
592
593
  tableName?: string;
593
594
  taskId?: string;
594
595
  enable?: boolean;
@@ -597,9 +598,9 @@ declare const ZaiConfig: sdk.ZodObject<{
597
598
  taskId?: string;
598
599
  enable?: boolean;
599
600
  }>>;
600
- namespace: sdk.ZodDefault<sdk.ZodString>;
601
- }, "strip", sdk.ZodTypeAny, {
602
- client?: Client;
601
+ namespace: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodString>;
602
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
603
+ client?: any;
603
604
  userId?: string;
604
605
  retry?: {
605
606
  maxRetries?: number;
@@ -612,7 +613,7 @@ declare const ZaiConfig: sdk.ZodObject<{
612
613
  };
613
614
  namespace?: string;
614
615
  }, {
615
- client?: Client;
616
+ client?: any;
616
617
  userId?: string;
617
618
  retry?: {
618
619
  maxRetries?: number;
@@ -650,10 +651,10 @@ declare class Zai {
650
651
  learn(taskId: string): Zai;
651
652
  }
652
653
 
653
- type Options$6 = sdk.z.input<typeof Options$6>;
654
- declare const Options$6: sdk.ZodObject<{
655
- length: sdk.ZodOptional<sdk.ZodNumber>;
656
- }, "strip", sdk.ZodTypeAny, {
654
+ type Options$6 = z.input<typeof Options$6>;
655
+ declare const Options$6: _bpinternal_zui.ZodObject<{
656
+ length: _bpinternal_zui.ZodOptional<_bpinternal_zui.ZodNumber>;
657
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
657
658
  length?: number;
658
659
  }, {
659
660
  length?: number;
@@ -665,20 +666,20 @@ declare module '@botpress/zai' {
665
666
  }
666
667
  }
667
668
 
668
- type Options$5 = sdk.z.input<typeof Options$5>;
669
- declare const Options$5: sdk.ZodObject<{
670
- examples: sdk.ZodDefault<sdk.ZodArray<sdk.ZodObject<{
671
- input: sdk.ZodString;
672
- output: sdk.ZodString;
673
- }, "strip", sdk.ZodTypeAny, {
669
+ type Options$5 = z.input<typeof Options$5>;
670
+ declare const Options$5: _bpinternal_zui.ZodObject<{
671
+ examples: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodArray<_bpinternal_zui.ZodObject<{
672
+ input: _bpinternal_zui.ZodString;
673
+ output: _bpinternal_zui.ZodString;
674
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
674
675
  input?: string;
675
676
  output?: string;
676
677
  }, {
677
678
  input?: string;
678
679
  output?: string;
679
680
  }>, "many">>;
680
- length: sdk.ZodOptional<sdk.ZodNumber>;
681
- }, "strip", sdk.ZodTypeAny, {
681
+ length: _bpinternal_zui.ZodOptional<_bpinternal_zui.ZodNumber>;
682
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
682
683
  length?: number;
683
684
  examples?: {
684
685
  input?: string;
@@ -698,24 +699,24 @@ declare module '@botpress/zai' {
698
699
  }
699
700
  }
700
701
 
701
- type Options$4 = sdk.z.input<typeof Options$4>;
702
- declare const Options$4: sdk.ZodObject<{
703
- prompt: sdk.ZodDefault<sdk.ZodString>;
704
- format: sdk.ZodDefault<sdk.ZodString>;
705
- length: sdk.ZodDefault<sdk.ZodNumber>;
706
- intermediateFactor: sdk.ZodDefault<sdk.ZodNumber>;
707
- maxIterations: sdk.ZodDefault<sdk.ZodNumber>;
708
- sliding: sdk.ZodDefault<sdk.ZodObject<{
709
- window: sdk.ZodNumber;
710
- overlap: sdk.ZodNumber;
711
- }, "strip", sdk.ZodTypeAny, {
702
+ type Options$4 = z.input<typeof Options$4>;
703
+ declare const Options$4: _bpinternal_zui.ZodObject<{
704
+ prompt: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodString>;
705
+ format: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodString>;
706
+ length: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodNumber>;
707
+ intermediateFactor: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodNumber>;
708
+ maxIterations: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodNumber>;
709
+ sliding: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodObject<{
710
+ window: _bpinternal_zui.ZodNumber;
711
+ overlap: _bpinternal_zui.ZodNumber;
712
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
712
713
  window?: number;
713
714
  overlap?: number;
714
715
  }, {
715
716
  window?: number;
716
717
  overlap?: number;
717
718
  }>>;
718
- }, "strip", sdk.ZodTypeAny, {
719
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
719
720
  length?: number;
720
721
  prompt?: string;
721
722
  format?: string;
@@ -743,13 +744,13 @@ declare module '@botpress/zai' {
743
744
  }
744
745
  }
745
746
 
746
- type Options$3 = sdk.z.input<typeof Options$3>;
747
- declare const Options$3: sdk.ZodObject<{
748
- examples: sdk.ZodDefault<sdk.ZodArray<sdk.ZodObject<{
749
- input: sdk.ZodAny;
750
- check: sdk.ZodBoolean;
751
- reason: sdk.ZodOptional<sdk.ZodString>;
752
- }, "strip", sdk.ZodTypeAny, {
747
+ type Options$3 = z.input<typeof Options$3>;
748
+ declare const Options$3: _bpinternal_zui.ZodObject<{
749
+ examples: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodArray<_bpinternal_zui.ZodObject<{
750
+ input: _bpinternal_zui.ZodAny;
751
+ check: _bpinternal_zui.ZodBoolean;
752
+ reason: _bpinternal_zui.ZodOptional<_bpinternal_zui.ZodString>;
753
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
753
754
  input?: any;
754
755
  check?: boolean;
755
756
  reason?: string;
@@ -758,7 +759,7 @@ declare const Options$3: sdk.ZodObject<{
758
759
  check?: boolean;
759
760
  reason?: string;
760
761
  }>, "many">>;
761
- }, "strip", sdk.ZodTypeAny, {
762
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
762
763
  examples?: {
763
764
  input?: any;
764
765
  check?: boolean;
@@ -778,14 +779,14 @@ declare module '@botpress/zai' {
778
779
  }
779
780
  }
780
781
 
781
- type Options$2 = sdk.z.input<typeof Options$2>;
782
- declare const Options$2: sdk.ZodObject<{
783
- tokensPerItem: sdk.ZodDefault<sdk.ZodOptional<sdk.ZodNumber>>;
784
- examples: sdk.ZodDefault<sdk.ZodArray<sdk.ZodObject<{
785
- input: sdk.ZodAny;
786
- filter: sdk.ZodBoolean;
787
- reason: sdk.ZodOptional<sdk.ZodString>;
788
- }, "strip", sdk.ZodTypeAny, {
782
+ type Options$2 = z.input<typeof Options$2>;
783
+ declare const Options$2: _bpinternal_zui.ZodObject<{
784
+ tokensPerItem: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodOptional<_bpinternal_zui.ZodNumber>>;
785
+ examples: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodArray<_bpinternal_zui.ZodObject<{
786
+ input: _bpinternal_zui.ZodAny;
787
+ filter: _bpinternal_zui.ZodBoolean;
788
+ reason: _bpinternal_zui.ZodOptional<_bpinternal_zui.ZodString>;
789
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
789
790
  input?: any;
790
791
  filter?: boolean;
791
792
  reason?: string;
@@ -794,7 +795,7 @@ declare const Options$2: sdk.ZodObject<{
794
795
  filter?: boolean;
795
796
  reason?: string;
796
797
  }>, "many">>;
797
- }, "strip", sdk.ZodTypeAny, {
798
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
798
799
  examples?: {
799
800
  input?: any;
800
801
  filter?: boolean;
@@ -816,11 +817,11 @@ declare module '@botpress/zai' {
816
817
  }
817
818
  }
818
819
 
819
- type Options$1 = sdk.z.input<typeof Options$1>;
820
- declare const Options$1: sdk.ZodObject<{
821
- instructions: sdk.ZodOptional<sdk.ZodString>;
822
- chunkLength: sdk.ZodDefault<sdk.ZodOptional<sdk.ZodNumber>>;
823
- }, "strip", sdk.ZodTypeAny, {
820
+ type Options$1 = z.input<typeof Options$1>;
821
+ declare const Options$1: _bpinternal_zui.ZodObject<{
822
+ instructions: _bpinternal_zui.ZodOptional<_bpinternal_zui.ZodString>;
823
+ chunkLength: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodOptional<_bpinternal_zui.ZodNumber>>;
824
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
824
825
  instructions?: string;
825
826
  chunkLength?: number;
826
827
  }, {
@@ -830,8 +831,8 @@ declare const Options$1: sdk.ZodObject<{
830
831
  declare module '@botpress/zai' {
831
832
  interface Zai {
832
833
  /** Extracts one or many elements from an arbitrary input */
833
- extract<S extends sdk.z.AnyZodObject>(input: unknown, schema: S, options?: Options$1): Promise<sdk.z.infer<S>>;
834
- extract<S extends sdk.z.AnyZodObject>(input: unknown, schema: sdk.z.ZodArray<S>, options?: Options$1): Promise<Array<sdk.z.infer<S>>>;
834
+ extract<S extends z.AnyZodObject>(input: unknown, schema: S, options?: Options$1): Promise<z.infer<S>>;
835
+ extract<S extends z.AnyZodObject>(input: unknown, schema: z.ZodArray<S>, options?: Options$1): Promise<Array<z.infer<S>>>;
835
836
  }
836
837
  }
837
838
 
@@ -850,23 +851,23 @@ type Example<T extends string> = {
850
851
  explanation?: string;
851
852
  }>>;
852
853
  };
853
- type Options<T extends string> = Omit<sdk.z.input<typeof Options>, 'examples'> & {
854
+ type Options<T extends string> = Omit<z.input<typeof Options>, 'examples'> & {
854
855
  examples?: Array<Partial<Example<T>>>;
855
856
  };
856
- declare const Options: sdk.ZodObject<{
857
- examples: sdk.ZodDefault<sdk.ZodArray<sdk.ZodObject<{
858
- input: sdk.ZodAny;
859
- labels: sdk.ZodRecord<sdk.ZodString, sdk.ZodObject<{
860
- label: sdk.ZodEnum<never>;
861
- explanation: sdk.ZodOptional<sdk.ZodString>;
862
- }, "strip", sdk.ZodTypeAny, {
857
+ declare const Options: _bpinternal_zui.ZodObject<{
858
+ examples: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodArray<_bpinternal_zui.ZodObject<{
859
+ input: _bpinternal_zui.ZodAny;
860
+ labels: _bpinternal_zui.ZodRecord<_bpinternal_zui.ZodString, _bpinternal_zui.ZodObject<{
861
+ label: _bpinternal_zui.ZodEnum<never>;
862
+ explanation: _bpinternal_zui.ZodOptional<_bpinternal_zui.ZodString>;
863
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
863
864
  label: never;
864
865
  explanation?: string;
865
866
  }, {
866
867
  label: never;
867
868
  explanation?: string;
868
869
  }>>;
869
- }, "strip", sdk.ZodTypeAny, {
870
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
870
871
  input?: any;
871
872
  labels?: Record<string, {
872
873
  label: never;
@@ -879,9 +880,9 @@ declare const Options: sdk.ZodObject<{
879
880
  explanation?: string;
880
881
  }>;
881
882
  }>, "many">>;
882
- instructions: sdk.ZodOptional<sdk.ZodString>;
883
- chunkLength: sdk.ZodDefault<sdk.ZodOptional<sdk.ZodNumber>>;
884
- }, "strip", sdk.ZodTypeAny, {
883
+ instructions: _bpinternal_zui.ZodOptional<_bpinternal_zui.ZodString>;
884
+ chunkLength: _bpinternal_zui.ZodDefault<_bpinternal_zui.ZodOptional<_bpinternal_zui.ZodNumber>>;
885
+ }, "strip", _bpinternal_zui.ZodTypeAny, {
885
886
  instructions?: string;
886
887
  examples?: {
887
888
  input?: any;
@@ -903,7 +904,7 @@ declare const Options: sdk.ZodObject<{
903
904
  chunkLength?: number;
904
905
  }>;
905
906
  type Labels<T extends string> = Record<T, string>;
906
- declare const Labels: sdk.ZodEffects<sdk.ZodRecord<sdk.ZodString, sdk.ZodString>, Record<string, string>, Record<string, string>>;
907
+ declare const Labels: z.ZodTransformer<_bpinternal_zui.ZodRecord<_bpinternal_zui.ZodString, _bpinternal_zui.ZodString>, Record<string, string>, Record<string, string>>;
907
908
  declare module '@botpress/zai' {
908
909
  interface Zai {
909
910
  /** Tags the provided input with a list of predefined labels */