@botpress/zai 1.0.0-beta.2 → 1.0.0-beta.4

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 (133) hide show
  1. package/dist/index.cjs +1898 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +916 -0
  4. package/dist/index.d.ts +916 -0
  5. package/dist/index.js +1868 -0
  6. package/dist/index.js.map +1 -0
  7. package/ensure-env.cjs +9 -0
  8. package/package.json +25 -17
  9. package/tsconfig.json +23 -18
  10. package/tsup.config.ts +16 -0
  11. package/vitest.config.ts +2 -16
  12. package/vitest.setup.ts +11 -15
  13. package/dist/src/adapters/adapter.d.ts +0 -27
  14. package/dist/src/adapters/adapter.js +0 -3
  15. package/dist/src/adapters/adapter.js.map +0 -1
  16. package/dist/src/adapters/botpress-table.d.ts +0 -155
  17. package/dist/src/adapters/botpress-table.js +0 -170
  18. package/dist/src/adapters/botpress-table.js.map +0 -1
  19. package/dist/src/adapters/memory.d.ts +0 -7
  20. package/dist/src/adapters/memory.js +0 -13
  21. package/dist/src/adapters/memory.js.map +0 -1
  22. package/dist/src/env.d.ts +0 -1
  23. package/dist/src/env.js +0 -27
  24. package/dist/src/env.js.map +0 -1
  25. package/dist/src/index.d.ts +0 -9
  26. package/dist/src/index.js +0 -10
  27. package/dist/src/index.js.map +0 -1
  28. package/dist/src/models.d.ts +0 -253
  29. package/dist/src/models.js +0 -348
  30. package/dist/src/models.js.map +0 -1
  31. package/dist/src/operations/__tests/index.d.ts +0 -19
  32. package/dist/src/operations/__tests/index.js +0 -24
  33. package/dist/src/operations/__tests/index.js.map +0 -1
  34. package/dist/src/operations/check.d.ts +0 -36
  35. package/dist/src/operations/check.js +0 -146
  36. package/dist/src/operations/check.js.map +0 -1
  37. package/dist/src/operations/check.test.d.ts +0 -1
  38. package/dist/src/operations/check.test.js +0 -129
  39. package/dist/src/operations/check.test.js.map +0 -1
  40. package/dist/src/operations/constants.d.ts +0 -2
  41. package/dist/src/operations/constants.js +0 -3
  42. package/dist/src/operations/constants.js.map +0 -1
  43. package/dist/src/operations/errors.d.ts +0 -5
  44. package/dist/src/operations/errors.js +0 -11
  45. package/dist/src/operations/errors.js.map +0 -1
  46. package/dist/src/operations/extract.d.ts +0 -20
  47. package/dist/src/operations/extract.js +0 -235
  48. package/dist/src/operations/extract.js.map +0 -1
  49. package/dist/src/operations/extract.test.d.ts +0 -1
  50. package/dist/src/operations/extract.test.js +0 -163
  51. package/dist/src/operations/extract.test.js.map +0 -1
  52. package/dist/src/operations/filter.d.ts +0 -39
  53. package/dist/src/operations/filter.js +0 -184
  54. package/dist/src/operations/filter.js.map +0 -1
  55. package/dist/src/operations/filter.test.d.ts +0 -1
  56. package/dist/src/operations/filter.test.js +0 -151
  57. package/dist/src/operations/filter.test.js.map +0 -1
  58. package/dist/src/operations/label.d.ts +0 -79
  59. package/dist/src/operations/label.js +0 -250
  60. package/dist/src/operations/label.js.map +0 -1
  61. package/dist/src/operations/label.test.d.ts +0 -1
  62. package/dist/src/operations/label.test.js +0 -213
  63. package/dist/src/operations/label.test.js.map +0 -1
  64. package/dist/src/operations/rewrite.d.ts +0 -34
  65. package/dist/src/operations/rewrite.js +0 -106
  66. package/dist/src/operations/rewrite.js.map +0 -1
  67. package/dist/src/operations/rewrite.test.d.ts +0 -1
  68. package/dist/src/operations/rewrite.test.js +0 -96
  69. package/dist/src/operations/rewrite.test.js.map +0 -1
  70. package/dist/src/operations/summarize.d.ts +0 -46
  71. package/dist/src/operations/summarize.js +0 -139
  72. package/dist/src/operations/summarize.js.map +0 -1
  73. package/dist/src/operations/summarize.test.d.ts +0 -1
  74. package/dist/src/operations/summarize.test.js +0 -22
  75. package/dist/src/operations/summarize.test.js.map +0 -1
  76. package/dist/src/operations/text.d.ts +0 -16
  77. package/dist/src/operations/text.js +0 -47
  78. package/dist/src/operations/text.js.map +0 -1
  79. package/dist/src/operations/text.test.d.ts +0 -1
  80. package/dist/src/operations/text.test.js +0 -51
  81. package/dist/src/operations/text.test.js.map +0 -1
  82. package/dist/src/operations/zai-learn.test.d.ts +0 -1
  83. package/dist/src/operations/zai-learn.test.js +0 -71
  84. package/dist/src/operations/zai-learn.test.js.map +0 -1
  85. package/dist/src/operations/zai-retry.test.d.ts +0 -1
  86. package/dist/src/operations/zai-retry.test.js +0 -50
  87. package/dist/src/operations/zai-retry.test.js.map +0 -1
  88. package/dist/src/utils.d.ts +0 -53
  89. package/dist/src/utils.js +0 -49
  90. package/dist/src/utils.js.map +0 -1
  91. package/dist/src/zai.d.ts +0 -91
  92. package/dist/src/zai.js +0 -139
  93. package/dist/src/zai.js.map +0 -1
  94. package/dist/tsconfig.tsbuildinfo +0 -1
  95. package/dist/typings.d.ts +0 -901
  96. package/dist/typings.tsbuildinfo +0 -1
  97. package/dist/vitest.config.d.ts +0 -2
  98. package/dist/vitest.config.js +0 -21
  99. package/dist/vitest.config.js.map +0 -1
  100. package/dist/vitest.setup.d.ts +0 -1
  101. package/dist/vitest.setup.js +0 -22
  102. package/dist/vitest.setup.js.map +0 -1
  103. package/src/adapters/adapter.ts +0 -35
  104. package/src/adapters/botpress-table.ts +0 -213
  105. package/src/adapters/memory.ts +0 -13
  106. package/src/env.ts +0 -54
  107. package/src/index.ts +0 -11
  108. package/src/models.ts +0 -347
  109. package/src/operations/__tests/botpress_docs.txt +0 -26040
  110. package/src/operations/__tests/index.ts +0 -30
  111. package/src/operations/check.test.ts +0 -155
  112. package/src/operations/check.ts +0 -187
  113. package/src/operations/constants.ts +0 -2
  114. package/src/operations/errors.ts +0 -9
  115. package/src/operations/extract.test.ts +0 -209
  116. package/src/operations/extract.ts +0 -291
  117. package/src/operations/filter.test.ts +0 -182
  118. package/src/operations/filter.ts +0 -231
  119. package/src/operations/label.test.ts +0 -239
  120. package/src/operations/label.ts +0 -332
  121. package/src/operations/rewrite.test.ts +0 -114
  122. package/src/operations/rewrite.ts +0 -148
  123. package/src/operations/summarize.test.ts +0 -25
  124. package/src/operations/summarize.ts +0 -193
  125. package/src/operations/text.test.ts +0 -60
  126. package/src/operations/text.ts +0 -63
  127. package/src/operations/zai-learn.test.ts +0 -85
  128. package/src/operations/zai-retry.test.ts +0 -64
  129. package/src/scripts/update-models.ts +0 -74
  130. package/src/utils.ts +0 -61
  131. package/src/zai.ts +0 -185
  132. package/tsconfig.types.json +0 -22
  133. package/turbo.json +0 -14
@@ -1,155 +0,0 @@
1
- import { type Client } from '@botpress/client';
2
- import { z } from '@bpinternal/zui';
3
- import { Adapter, GetExamplesProps, SaveExampleProps } from './adapter';
4
- declare const Props: import("@bpinternal/zui").ZodObject<{
5
- client: z.Schema<Client, import("@bpinternal/zui").ZodTypeDef, Client>;
6
- tableName: import("@bpinternal/zui").ZodString;
7
- }, "strip", import("@bpinternal/zui").ZodTypeAny, {
8
- client: Client;
9
- tableName: string;
10
- }, {
11
- client: Client;
12
- tableName: string;
13
- }>;
14
- export type TableSchema = z.input<typeof TableSchema>;
15
- declare const TableSchema: import("@bpinternal/zui").ZodObject<{
16
- taskType: import("@bpinternal/zui").ZodString;
17
- taskId: import("@bpinternal/zui").ZodString;
18
- key: import("@bpinternal/zui").ZodString;
19
- instructions: import("@bpinternal/zui").ZodString;
20
- input: import("@bpinternal/zui").ZodObject<{}, "passthrough", import("@bpinternal/zui").ZodTypeAny, import("@bpinternal/zui").objectOutputType<{}, import("@bpinternal/zui").ZodTypeAny, "passthrough">, import("@bpinternal/zui").objectInputType<{}, import("@bpinternal/zui").ZodTypeAny, "passthrough">>;
21
- output: import("@bpinternal/zui").ZodObject<{}, "passthrough", import("@bpinternal/zui").ZodTypeAny, import("@bpinternal/zui").objectOutputType<{}, import("@bpinternal/zui").ZodTypeAny, "passthrough">, import("@bpinternal/zui").objectInputType<{}, import("@bpinternal/zui").ZodTypeAny, "passthrough">>;
22
- explanation: import("@bpinternal/zui").ZodNullable<import("@bpinternal/zui").ZodString>;
23
- metadata: import("@bpinternal/zui").ZodObject<{
24
- model: import("@bpinternal/zui").ZodString;
25
- cost: import("@bpinternal/zui").ZodObject<{
26
- input: import("@bpinternal/zui").ZodNumber;
27
- output: import("@bpinternal/zui").ZodNumber;
28
- }, "strip", import("@bpinternal/zui").ZodTypeAny, {
29
- input: number;
30
- output: number;
31
- }, {
32
- input: number;
33
- output: number;
34
- }>;
35
- latency: import("@bpinternal/zui").ZodNumber;
36
- tokens: import("@bpinternal/zui").ZodObject<{
37
- input: import("@bpinternal/zui").ZodNumber;
38
- output: import("@bpinternal/zui").ZodNumber;
39
- }, "strip", import("@bpinternal/zui").ZodTypeAny, {
40
- input: number;
41
- output: number;
42
- }, {
43
- input: number;
44
- output: number;
45
- }>;
46
- }, "strip", import("@bpinternal/zui").ZodTypeAny, {
47
- model: string;
48
- cost: {
49
- input: number;
50
- output: number;
51
- };
52
- latency: number;
53
- tokens: {
54
- input: number;
55
- output: number;
56
- };
57
- }, {
58
- model: string;
59
- cost: {
60
- input: number;
61
- output: number;
62
- };
63
- latency: number;
64
- tokens: {
65
- input: number;
66
- output: number;
67
- };
68
- }>;
69
- status: import("@bpinternal/zui").ZodEnum<["pending", "rejected", "approved"]>;
70
- feedback: import("@bpinternal/zui").ZodDefault<import("@bpinternal/zui").ZodNullable<import("@bpinternal/zui").ZodObject<{
71
- rating: import("@bpinternal/zui").ZodEnum<["very-bad", "bad", "good", "very-good"]>;
72
- comment: import("@bpinternal/zui").ZodNullable<import("@bpinternal/zui").ZodString>;
73
- }, "strip", import("@bpinternal/zui").ZodTypeAny, {
74
- rating: "very-bad" | "bad" | "good" | "very-good";
75
- comment: string | null;
76
- }, {
77
- rating: "very-bad" | "bad" | "good" | "very-good";
78
- comment: string | null;
79
- }>>>;
80
- }, "strip", import("@bpinternal/zui").ZodTypeAny, {
81
- status: "pending" | "approved" | "rejected";
82
- input: {} & {
83
- [k: string]: unknown;
84
- };
85
- output: {} & {
86
- [k: string]: unknown;
87
- };
88
- taskType: string;
89
- taskId: string;
90
- key: string;
91
- instructions: string;
92
- explanation: string | null;
93
- metadata: {
94
- model: string;
95
- cost: {
96
- input: number;
97
- output: number;
98
- };
99
- latency: number;
100
- tokens: {
101
- input: number;
102
- output: number;
103
- };
104
- };
105
- feedback: {
106
- rating: "very-bad" | "bad" | "good" | "very-good";
107
- comment: string | null;
108
- } | null;
109
- }, {
110
- status: "pending" | "approved" | "rejected";
111
- input: {} & {
112
- [k: string]: unknown;
113
- };
114
- output: {} & {
115
- [k: string]: unknown;
116
- };
117
- taskType: string;
118
- taskId: string;
119
- key: string;
120
- instructions: string;
121
- explanation: string | null;
122
- metadata: {
123
- model: string;
124
- cost: {
125
- input: number;
126
- output: number;
127
- };
128
- latency: number;
129
- tokens: {
130
- input: number;
131
- output: number;
132
- };
133
- };
134
- feedback?: {
135
- rating: "very-bad" | "bad" | "good" | "very-good";
136
- comment: string | null;
137
- } | null | undefined;
138
- }>;
139
- export declare class TableAdapter extends Adapter {
140
- private client;
141
- private tableName;
142
- private status;
143
- private errors;
144
- constructor(props: z.input<typeof Props>);
145
- getExamples<TInput, TOutput>({ taskType, taskId, input }: GetExamplesProps<TInput>): Promise<{
146
- key: any;
147
- input: TInput;
148
- output: TOutput;
149
- explanation: any;
150
- similarity: any;
151
- }[]>;
152
- saveExample<TInput, TOutput>({ key, taskType, taskId, instructions, input, output, explanation, metadata, status }: SaveExampleProps<TInput, TOutput>): Promise<void>;
153
- private assertTableExists;
154
- }
155
- export {};
@@ -1,170 +0,0 @@
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
20
- .string()
21
- .regex(/^[a-zA-Z0-9_]{1,45}Table$/, 'Table name must be lowercase and contain only letters, numbers and underscores')
22
- });
23
- const TableSchema = z.object({
24
- taskType: z.string().describe('The type of the task (filter, extract, etc.)'),
25
- taskId: z.string(),
26
- key: z.string().describe('A unique key for the task (e.g. a hash of the input, taskId, taskType and instructions)'),
27
- instructions: z.string(),
28
- input: z.object({}).passthrough().describe('The input to the task'),
29
- output: z.object({}).passthrough().describe('The expected output'),
30
- explanation: z.string().nullable(),
31
- metadata: GenerationMetadata,
32
- status: z.enum(['pending', 'rejected', 'approved']),
33
- feedback: z
34
- .object({
35
- rating: z.enum(['very-bad', 'bad', 'good', 'very-good']),
36
- comment: z.string().nullable()
37
- })
38
- .nullable()
39
- .default(null)
40
- });
41
- const searchableColumns = ['input'];
42
- const TableJsonSchema = Object.entries(TableSchema.shape).reduce((acc, [key, value]) => {
43
- acc[key] = value.toJsonSchema();
44
- acc[key]['x-zui'] ??= {};
45
- acc[key]['x-zui'].searchable = searchableColumns.includes(key);
46
- return acc;
47
- }, {});
48
- export class TableAdapter extends Adapter {
49
- client;
50
- tableName;
51
- status;
52
- errors = [];
53
- constructor(props) {
54
- super();
55
- props = Props.parse(props);
56
- this.client = props.client;
57
- this.tableName = props.tableName;
58
- this.status = 'ready';
59
- }
60
- async getExamples({ taskType, taskId, input }) {
61
- await this.assertTableExists();
62
- const { rows } = await this.client
63
- .findTableRows({
64
- table: this.tableName,
65
- search: JSON.stringify({ value: input }).substring(0, 1023), // Search is limited to 1024 characters
66
- limit: 10, // TODO
67
- filter: {
68
- // Proximity match of approved examples
69
- taskType,
70
- taskId,
71
- status: 'approved'
72
- }
73
- })
74
- .catch((err) => {
75
- // TODO: handle error
76
- console.error(`Error fetching examples: ${err.message}`);
77
- return { rows: [] };
78
- });
79
- return rows.map((row) => ({
80
- key: row.key,
81
- input: row.input.value,
82
- output: row.output.value,
83
- explanation: row.explanation,
84
- similarity: row.similarity ?? 0
85
- }));
86
- }
87
- async saveExample({ key, taskType, taskId, instructions, input, output, explanation, metadata, status = 'pending' }) {
88
- await this.assertTableExists();
89
- await this.client
90
- .upsertTableRows({
91
- table: this.tableName,
92
- keyColumn: 'key',
93
- rows: [
94
- {
95
- key,
96
- taskType,
97
- taskId,
98
- instructions,
99
- input: { value: input },
100
- output: { value: output },
101
- explanation: explanation ?? null,
102
- status,
103
- metadata
104
- }
105
- ]
106
- })
107
- .catch(() => {
108
- // TODO: handle error
109
- });
110
- }
111
- async assertTableExists() {
112
- if (this.status !== 'ready') {
113
- return;
114
- }
115
- const { table, created } = await this.client
116
- .getOrCreateTable({
117
- table: this.tableName,
118
- factor: FACTOR,
119
- frozen: true,
120
- isComputeEnabled: false,
121
- tags: {
122
- ...CRITICAL_TAGS,
123
- ...OPTIONAL_TAGS
124
- },
125
- schema: TableJsonSchema
126
- })
127
- .catch((err) => {
128
- this.status = 'error';
129
- this.errors = [err.message];
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
- this.errors = issues;
165
- }
166
- }
167
- this.status = 'initialized';
168
- }
169
- }
170
- //# sourceMappingURL=botpress-table.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"botpress-table.js","sourceRoot":"","sources":["../../../src/adapters/botpress-table.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAA;AAEnC,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAsC,MAAM,WAAW,CAAA;AAEvE,MAAM,aAAa,GAAG;IACpB,MAAM,EAAE,MAAM;IACd,gBAAgB,EAAE,iBAAiB;IACnC,gBAAgB,EAAE,UAAU;CACpB,CAAA;AAEV,MAAM,aAAa,GAAG;IACpB,gBAAgB,EAAE,iBAAiB;IACnC,sBAAsB,EAAE,sDAAsD;IAC9E,mBAAmB,EAAE,MAAM;IAC3B,eAAe,EAAE,eAAe;IAChC,gBAAgB,EAAE,OAAO;CACjB,CAAA;AAEV,MAAM,MAAM,GAAG,EAAE,CAAA;AAEjB,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC;IACrB,MAAM,EAAE,cAAc;IACtB,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,KAAK,CACJ,2BAA2B,EAC3B,gFAAgF,CACjF;CACJ,CAAC,CAAA;AAGF,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8CAA8C,CAAC;IAC7E,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yFAAyF,CAAC;IACnH,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;I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,CAAC;oBAClC,MAAM,CAAC,IAAI,CAAC,UAAU,GAAG,aAAa,MAAM,CAAC,IAAI,eAAe,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;gBAClF,CAAC;gBAED,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,CAAC;oBAChE,MAAM,CAAC,IAAI,CAAC,UAAU,GAAG,kCAAkC,CAAC,CAAA;gBAC9D,CAAC;YACH,CAAC;YAED,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBAClB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAA;gBACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;YACtB,CAAC;QACH,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,aAAa,CAAA;IAC7B,CAAC;CACF"}
@@ -1,7 +0,0 @@
1
- import { Adapter } from './adapter';
2
- export declare class MemoryAdapter extends Adapter {
3
- examples: any[];
4
- constructor(examples: any[]);
5
- getExamples(): Promise<any[]>;
6
- saveExample(): Promise<void>;
7
- }
@@ -1,13 +0,0 @@
1
- import { Adapter } from './adapter';
2
- export class MemoryAdapter extends Adapter {
3
- examples;
4
- constructor(examples) {
5
- super();
6
- this.examples = examples;
7
- }
8
- async getExamples() {
9
- return this.examples;
10
- }
11
- async saveExample() { }
12
- }
13
- //# sourceMappingURL=memory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../src/adapters/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,OAAO,aAAc,SAAQ,OAAO;IACrB;IAAnB,YAAmB,QAAe;QAChC,KAAK,EAAE,CAAA;QADU,aAAQ,GAAR,QAAQ,CAAO;IAElC,CAAC;IAED,KAAK,CAAC,WAAW;QACf,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,WAAW,KAAI,CAAC;CACvB"}
package/dist/src/env.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
package/dist/src/env.js DELETED
@@ -1,27 +0,0 @@
1
- import { z } from '@bpinternal/zui';
2
- import dotenv from 'dotenv';
3
- dotenv.config({ override: false });
4
- dotenv.populate(process.env, {
5
- VITE_CLOUD_API_ENDPOINT: 'https://api.botpress.dev'
6
- }, { override: false });
7
- const envVariables = z.object({
8
- CI: z.coerce.boolean().optional().describe('Indicates whether the tests are running in a CI environment'),
9
- VITE_CLOUD_API_ENDPOINT: z.string(),
10
- VITE_BOT_ID: z.string(),
11
- VITE_CLOUD_PAT: z.string(),
12
- // for CI
13
- VITEST_CLOUD_PAT: z.string().optional(),
14
- VITEST_BOT_ID: z.string().optional()
15
- });
16
- const result = envVariables.safeParse(process.env);
17
- if (!result.success) {
18
- for (const error of result.error.errors) {
19
- if (error.code === 'invalid_type') {
20
- console.error(`Missing environment variable: ${error.path.join('.')}`);
21
- }
22
- else {
23
- console.error(error);
24
- }
25
- }
26
- }
27
- //# sourceMappingURL=env.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAA;AACnC,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAA;AAClC,MAAM,CAAC,QAAQ,CACb,OAAO,CAAC,GAAG,EACX;IACE,uBAAuB,EAAE,0BAA0B;CACpD,EACD,EAAE,QAAQ,EAAE,KAAK,EAAE,CACpB,CAAA;AAED,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6DAA6D,CAAC;IACzG,uBAAuB,EAAE,CAAC,CAAC,MAAM,EAAE;IACnC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,SAAS;IACT,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACvC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAA;AAEF,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;AAElD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACpB,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QACxC,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YAClC,OAAO,CAAC,KAAK,CAAC,iCAAiC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QACxE,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACtB,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,9 +0,0 @@
1
- import { Zai } from './zai';
2
- import './operations/text';
3
- import './operations/rewrite';
4
- import './operations/summarize';
5
- import './operations/check';
6
- import './operations/filter';
7
- import './operations/extract';
8
- import './operations/label';
9
- export { Zai };
package/dist/src/index.js DELETED
@@ -1,10 +0,0 @@
1
- import { Zai } from './zai';
2
- import './operations/text';
3
- import './operations/rewrite';
4
- import './operations/summarize';
5
- import './operations/check';
6
- import './operations/filter';
7
- import './operations/extract';
8
- import './operations/label';
9
- export { Zai };
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAE3B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,sBAAsB,CAAA;AAC7B,OAAO,wBAAwB,CAAA;AAC/B,OAAO,oBAAoB,CAAA;AAC3B,OAAO,qBAAqB,CAAA;AAC5B,OAAO,sBAAsB,CAAA;AAC7B,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,GAAG,EAAE,CAAA"}