@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,36 +0,0 @@
1
- import { z } from '@bpinternal/zui';
2
- export type Options = z.input<typeof Options>;
3
- declare const Options: import("@bpinternal/zui").ZodObject<{
4
- examples: import("@bpinternal/zui").ZodDefault<import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
5
- input: import("@bpinternal/zui").ZodAny;
6
- check: import("@bpinternal/zui").ZodBoolean;
7
- reason: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
8
- }, "strip", import("@bpinternal/zui").ZodTypeAny, {
9
- check: boolean;
10
- input?: any;
11
- reason?: string | undefined;
12
- }, {
13
- check: boolean;
14
- input?: any;
15
- reason?: string | undefined;
16
- }>, "many">>;
17
- }, "strip", import("@bpinternal/zui").ZodTypeAny, {
18
- examples: {
19
- check: boolean;
20
- input?: any;
21
- reason?: string | undefined;
22
- }[];
23
- }, {
24
- examples?: {
25
- check: boolean;
26
- input?: any;
27
- reason?: string | undefined;
28
- }[] | undefined;
29
- }>;
30
- declare module '../zai' {
31
- interface Zai {
32
- /** Checks wether a condition is true or not */
33
- check(input: unknown, condition: string, options?: Options): Promise<boolean>;
34
- }
35
- }
36
- export {};
@@ -1,146 +0,0 @@
1
- import { z } from '@bpinternal/zui';
2
- import { fastHash, stringify, takeUntilTokens } from '../utils';
3
- import { Zai } from '../zai';
4
- import { PROMPT_INPUT_BUFFER } from './constants';
5
- const Example = z.object({
6
- input: z.any(),
7
- check: z.boolean(),
8
- reason: z.string().optional()
9
- });
10
- const Options = z.object({
11
- examples: z.array(Example).describe('Examples to check the condition against').default([])
12
- });
13
- const TRUE = '■TRUE■';
14
- const FALSE = '■FALSE■';
15
- const END = '■END■';
16
- Zai.prototype.check = async function (input, condition, _options) {
17
- const options = Options.parse(_options ?? {});
18
- const tokenizer = await this.getTokenizer();
19
- const PROMPT_COMPONENT = Math.max(this.Model.input.maxTokens - PROMPT_INPUT_BUFFER, 100);
20
- const taskId = this.taskId;
21
- const taskType = 'zai.check';
22
- const PROMPT_TOKENS = {
23
- INPUT: Math.floor(0.5 * PROMPT_COMPONENT),
24
- CONDITION: Math.floor(0.2 * PROMPT_COMPONENT)
25
- };
26
- // Truncate the input to fit the model's input size
27
- const inputAsString = tokenizer.truncate(stringify(input), PROMPT_TOKENS.INPUT);
28
- condition = tokenizer.truncate(condition, PROMPT_TOKENS.CONDITION);
29
- // All tokens remaining after the input and condition are accounted can be used for examples
30
- const EXAMPLES_TOKENS = PROMPT_COMPONENT - tokenizer.count(inputAsString) - tokenizer.count(condition);
31
- const Key = fastHash(JSON.stringify({
32
- taskType,
33
- taskId,
34
- input: inputAsString,
35
- condition
36
- }));
37
- const examples = taskId
38
- ? await this.adapter.getExamples({
39
- input: inputAsString,
40
- taskType,
41
- taskId
42
- })
43
- : [];
44
- const exactMatch = examples.find((x) => x.key === Key);
45
- if (exactMatch) {
46
- return exactMatch.output;
47
- }
48
- const defaultExamples = [
49
- { input: '50 Cent', check: true, reason: '50 Cent is widely recognized as a public personality.' },
50
- {
51
- input: ['apple', 'banana', 'carrot', 'house'],
52
- check: false,
53
- reason: 'The list contains a house, which is not a fruit. Also, the list contains a carrot, which is a vegetable.'
54
- }
55
- ];
56
- const userExamples = [
57
- ...examples.map((e) => ({ input: e.input, check: e.output, reason: e.explanation })),
58
- ...options.examples
59
- ];
60
- let exampleId = 1;
61
- const formatInput = (input, condition) => {
62
- const header = userExamples.length ? `Expert Example #${exampleId++}` : `Example of condition: "${condition}"`;
63
- return `
64
- ${header}
65
- <|start_input|>
66
- ${input.trim()}
67
- <|end_input|>
68
- `.trim();
69
- };
70
- const formatOutput = (answer, justification) => {
71
- return `
72
- Analysis: ${justification}
73
- Final Answer: ${answer ? TRUE : FALSE}
74
- ${END}
75
- `.trim();
76
- };
77
- const formatExample = (example) => [
78
- { type: 'text', content: formatInput(stringify(example.input ?? null), condition), role: 'user' },
79
- {
80
- type: 'text',
81
- content: formatOutput(example.check, example.reason ?? ''),
82
- role: 'assistant'
83
- }
84
- ];
85
- const allExamples = takeUntilTokens(userExamples.length ? userExamples : defaultExamples, EXAMPLES_TOKENS, (el) => tokenizer.count(stringify(el.input)) + tokenizer.count(el.reason ?? ''))
86
- .map(formatExample)
87
- .flat();
88
- const specialInstructions = userExamples.length
89
- ? `
90
- - You have been provided with examples from previous experts. Make sure to read them carefully before making your decision.
91
- - Make sure to refer to the examples provided by the experts to justify your decision (when applicable).
92
- - When in doubt, ground your decision on the examples provided by the experts instead of your own intuition.
93
- - When no example is similar to the input, make sure to provide a clear justification for your decision while inferring the decision-making process from the examples provided by the experts.
94
- `.trim()
95
- : '';
96
- const output = await this.callModel({
97
- systemPrompt: `
98
- Check if the following condition is true or false for the given input. Before answering, make sure to read the input and the condition carefully.
99
- Justify your answer, then answer with either ${TRUE} or ${FALSE} at the very end, then add ${END} to finish the response.
100
- IMPORTANT: Make sure to answer with either ${TRUE} or ${FALSE} at the end of your response, but NOT both.
101
- ---
102
- Expert Examples (#1 to #${exampleId - 1}):
103
- ${specialInstructions}
104
- `.trim(),
105
- stopSequences: [END],
106
- messages: [
107
- ...allExamples,
108
- {
109
- type: 'text',
110
- content: `
111
- Considering the below input and above examples, is the following condition true or false?
112
- ${formatInput(inputAsString, condition)}
113
- In your "Analysis", please refer to the Expert Examples # to justify your decision.`.trim(),
114
- role: 'user'
115
- }
116
- ]
117
- });
118
- const answer = output.choices[0].content;
119
- const hasTrue = answer.includes(TRUE);
120
- const hasFalse = answer.includes(FALSE);
121
- if (!hasTrue && !hasFalse) {
122
- throw new Error(`The model did not return a valid answer. The response was: ${answer}`);
123
- }
124
- let finalAnswer;
125
- if (hasTrue && hasFalse) {
126
- // If both TRUE and FALSE are present, we need to check which one was answered last
127
- finalAnswer = answer.lastIndexOf(TRUE) > answer.lastIndexOf(FALSE);
128
- }
129
- else {
130
- finalAnswer = hasTrue;
131
- }
132
- if (taskId) {
133
- await this.adapter.saveExample({
134
- key: Key,
135
- taskType,
136
- taskId,
137
- input: inputAsString,
138
- instructions: condition,
139
- metadata: output.metadata,
140
- output: finalAnswer,
141
- explanation: answer.replace(TRUE, '').replace(FALSE, '').replace(END, '').replace('Final Answer:', '').trim()
142
- });
143
- }
144
- return finalAnswer;
145
- };
146
- //# sourceMappingURL=check.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"check.js","sourceRoot":"","sources":["../../../src/operations/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAA;AAEnC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/D,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEjD,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC;IACvB,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE;IACd,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE;IAClB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAA;AAGF,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC;IACvB,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,yCAAyC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CAC3F,CAAC,CAAA;AASF,MAAM,IAAI,GAAG,QAAQ,CAAA;AACrB,MAAM,KAAK,GAAG,SAAS,CAAA;AACvB,MAAM,GAAG,GAAG,OAAO,CAAA;AAEnB,GAAG,CAAC,SAAS,CAAC,KAAK,G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
1
- export {};
@@ -1,129 +0,0 @@
1
- import { describe, it, expect, afterAll, beforeEach, afterEach } from 'vitest';
2
- import { BotpressDocumentation, getClient, getZai, metadata } from './__tests';
3
- import { TableAdapter } from '../adapters/botpress-table';
4
- describe('zai.check', { timeout: 60_000 }, () => {
5
- const zai = getZai();
6
- it('basic check on a string', async () => {
7
- const value = await zai.check('This text is very clearly written in English.', 'is an english sentence');
8
- expect(value).toBe(true);
9
- });
10
- it('text that is too long gets truncated', async () => {
11
- const isBotpressDocumentation = await zai.check(BotpressDocumentation, 'is about botpress and looks like documentation');
12
- const isAboutBirds = await zai.check(BotpressDocumentation, 'is a book about birds and their species');
13
- expect(isBotpressDocumentation).toBe(true);
14
- expect(isAboutBirds).toBe(false);
15
- });
16
- it('works with any input type', async () => {
17
- const sly = { name: 'Sylvain Perron', age: 30, job: 'CEO', company: 'Botpress', location: 'Quebec' };
18
- const american = await zai.check(sly, 'person lives in north america');
19
- const european = await zai.check(sly, 'person lives in europe');
20
- expect(american).toBe(true);
21
- expect(european).toBe(false);
22
- });
23
- it('check with examples', async () => {
24
- const examples = [
25
- {
26
- input: 'Rasa (framework)',
27
- check: true,
28
- reason: 'Rasa is a chatbot framework, so it competes with us (Botpress).'
29
- },
30
- {
31
- input: 'Rasa (coffee company)',
32
- check: false,
33
- reason: 'Rasa (coffee company) is not in the chatbot or AI agent industry, therefore it does not compete with us (Botpress).'
34
- },
35
- {
36
- input: 'Dialogflow',
37
- check: true,
38
- reason: 'Dialogflow is a chatbot development product, so it competes with us (Botpress).'
39
- }
40
- ];
41
- const moveworks = await zai.check('Moveworks', 'competes with us', { examples });
42
- const ada = await zai.check('Ada.cx', 'competes with us', { examples });
43
- const voiceflow = await zai.check('Voiceflow', 'competes with us', { examples });
44
- const nike = await zai.check('Nike', 'competes with us', { examples });
45
- const adidas = await zai.check('Adidas', 'competes with us', { examples });
46
- expect(moveworks).toBe(true);
47
- expect(ada).toBe(true);
48
- expect(voiceflow).toBe(true);
49
- expect(nike).toBe(false);
50
- expect(adidas).toBe(false);
51
- });
52
- });
53
- describe('zai.learn.check', { timeout: 60_000 }, () => {
54
- const client = getClient();
55
- let tableName = 'ZaiTestCheckInternalTable';
56
- let taskId = 'check';
57
- let zai = getZai();
58
- beforeEach(async () => {
59
- zai = getZai().with({
60
- activeLearning: {
61
- enable: true,
62
- taskId,
63
- tableName
64
- }
65
- });
66
- });
67
- afterEach(async () => {
68
- try {
69
- await client.deleteTableRows({ table: tableName, deleteAllRows: true });
70
- }
71
- catch (err) { }
72
- });
73
- afterAll(async () => {
74
- try {
75
- await client.deleteTable({ table: tableName });
76
- }
77
- catch (err) { }
78
- });
79
- it('learns a contradiction from examples', async () => {
80
- const adapter = new TableAdapter({
81
- client,
82
- tableName
83
- });
84
- const value = await zai.learn(taskId).check(`What's up`, 'is a greeting');
85
- expect(value).toBe(true);
86
- let rows = await client.findTableRows({ table: tableName });
87
- expect(rows.rows.length).toBe(1);
88
- expect(rows.rows[0].output.value).toEqual(value);
89
- await adapter.saveExample({
90
- key: 't1',
91
- taskId: `zai/${taskId}`,
92
- taskType: 'zai.check',
93
- instructions: 'is a greeting',
94
- input: 'what is up',
95
- output: false,
96
- explanation: `"What's up" is our business scenario is NOT considered an official greeting.`,
97
- metadata,
98
- status: 'approved'
99
- });
100
- await adapter.saveExample({
101
- key: 't2',
102
- taskId: `zai/${taskId}`,
103
- taskType: 'zai.check',
104
- instructions: 'is a greeting',
105
- input: 'hello! how are you?',
106
- output: true,
107
- explanation: `"hello!" is a common greeting in English.`,
108
- metadata,
109
- status: 'approved'
110
- });
111
- await adapter.saveExample({
112
- key: 't3',
113
- taskId: `zai/${taskId}`,
114
- taskType: 'zai.check',
115
- instructions: 'is a greeting',
116
- input: 'wassup',
117
- output: false,
118
- explanation: `"wassup" is a slang term and not considered a formal greeting. It is therefore NOT considered a greeting.`,
119
- metadata,
120
- status: 'approved'
121
- });
122
- const second = await zai.learn(taskId).check(`What's up`, 'is a greeting');
123
- expect(second).toBe(false);
124
- rows = await client.findTableRows({ table: tableName });
125
- expect(rows.rows.length).toBe(4);
126
- expect(rows.rows[0].output.value).toEqual(second);
127
- });
128
- });
129
- //# sourceMappingURL=check.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"check.test.js","sourceRoot":"","sources":["../../../src/operations/check.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAE9E,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAEzD,QAAQ,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE;IAC9C,MAAM,GAAG,GAAG,MAAM,EAAE,CAAA;IAEpB,EAAE,CAAC,yBAAyB,EAAE,KAAK,IAAI,EAAE;QACvC,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,+CAA+C,EAAE,wBAAwB,CAAC,CAAA;QACxG,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QACpD,MAAM,uBAAuB,GAAG,MAAM,GAAG,CAAC,KAAK,CAC7C,qBAAqB,EACrB,gDAAgD,CACjD,CAAA;QAED,MAAM,YAAY,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,qBAAqB,EAAE,yCAAyC,CAAC,CAAA;QAEtG,MAAM,CAAC,uBAAuB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC1C,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,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,MAAM,EAAE;YACvB,QAAQ,EAAE,WAAW;YACrB,YAAY,EAAE,eAAe;YAC7B,KAAK,EAAE,qBAAqB;YAC5B,MAAM,EAAE,IAAI;YACZ,WAAW,EAAE,2CAA2C;YACxD,QAAQ;YACR,MAAM,EAAE,UAAU;SACnB,CAAC,CAAA;QAEF,MAAM,OAAO,CAAC,WAAW,CAAC;YACxB,GAAG,EAAE,IAAI;YACT,MAAM,EAAE,OAAO,MAAM,EAAE;YACvB,QAAQ,EAAE,WAAW;YACrB,YAAY,EAAE,eAAe;YAC7B,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,KAAK;YACb,WAAW,EAAE,2GAA2G;YACxH,QAAQ;YACR,MAAM,EAAE,UAAU;SACnB,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,eAAe,CAAC,CAAA;QAC1E,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAE1B,IAAI,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;QACvD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAChC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACnD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export declare const PROMPT_INPUT_BUFFER = 1048;
2
- export declare const PROMPT_OUTPUT_BUFFER = 512;
@@ -1,3 +0,0 @@
1
- export const PROMPT_INPUT_BUFFER = 1048;
2
- export const PROMPT_OUTPUT_BUFFER = 512;
3
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/operations/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAA;AACvC,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAA"}
@@ -1,5 +0,0 @@
1
- export declare class JsonParsingError extends Error {
2
- json: unknown;
3
- error: Error;
4
- constructor(json: unknown, error: Error);
5
- }
@@ -1,11 +0,0 @@
1
- export class JsonParsingError extends Error {
2
- json;
3
- error;
4
- constructor(json, error) {
5
- const message = `Error parsing JSON:\n\n---JSON---\n${json}\n\n---Error---\n\n ${error}`;
6
- super(message);
7
- this.json = json;
8
- this.error = error;
9
- }
10
- }
11
- //# sourceMappingURL=errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/operations/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAEhC;IACA;IAFT,YACS,IAAa,EACb,KAAY;QAEnB,MAAM,OAAO,GAAG,sCAAsC,IAAI,uBAAuB,KAAK,EAAE,CAAA;QACxF,KAAK,CAAC,OAAO,CAAC,CAAA;QAJP,SAAI,GAAJ,IAAI,CAAS;QACb,UAAK,GAAL,KAAK,CAAO;IAIrB,CAAC;CACF"}
@@ -1,20 +0,0 @@
1
- import { ZodObject, z } from '@bpinternal/zui';
2
- export type Options = z.input<typeof Options>;
3
- declare const Options: ZodObject<{
4
- instructions: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
5
- chunkLength: import("@bpinternal/zui").ZodDefault<import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodNumber>>;
6
- }, "strip", import("@bpinternal/zui").ZodTypeAny, {
7
- chunkLength: number;
8
- instructions?: string | undefined;
9
- }, {
10
- instructions?: string | undefined;
11
- chunkLength?: number | undefined;
12
- }>;
13
- declare module '../zai' {
14
- interface Zai {
15
- /** Extracts one or many elements from an arbitrary input */
16
- extract<S extends z.AnyZodObject>(input: unknown, schema: S, options?: Options): Promise<z.infer<S>>;
17
- extract<S extends z.AnyZodObject>(input: unknown, schema: z.ZodArray<S>, options?: Options): Promise<Array<z.infer<S>>>;
18
- }
19
- }
20
- export {};
@@ -1,235 +0,0 @@
1
- import { ZodArray, ZodObject, z } from '@bpinternal/zui';
2
- import JSON5 from 'json5';
3
- import { jsonrepair } from 'jsonrepair';
4
- import _ from 'lodash';
5
- import { fastHash, stringify, takeUntilTokens } from '../utils';
6
- import { Zai } from '../zai';
7
- import { PROMPT_INPUT_BUFFER } from './constants';
8
- import { JsonParsingError } from './errors';
9
- const Options = z.object({
10
- instructions: z.string().optional().describe('Instructions to guide the user on how to extract the data'),
11
- chunkLength: z
12
- .number()
13
- .min(100)
14
- .max(100_000)
15
- .optional()
16
- .describe('The maximum number of tokens per chunk')
17
- .default(16_000)
18
- });
19
- const START = '■json_start■';
20
- const END = '■json_end■';
21
- const NO_MORE = '■NO_MORE_ELEMENT■';
22
- Zai.prototype.extract = async function (input, schema, _options) {
23
- const options = Options.parse(_options ?? {});
24
- const tokenizer = await this.getTokenizer();
25
- const taskId = this.taskId;
26
- const taskType = 'zai.extract';
27
- const PROMPT_COMPONENT = Math.max(this.Model.input.maxTokens - PROMPT_INPUT_BUFFER, 100);
28
- let isArrayOfObjects = false;
29
- const originalSchema = schema;
30
- if (schema instanceof ZodObject) {
31
- // Do nothing
32
- }
33
- else if (schema instanceof ZodArray) {
34
- if (schema._def.type instanceof ZodObject) {
35
- isArrayOfObjects = true;
36
- schema = schema._def.type;
37
- }
38
- else {
39
- throw new Error('Schema must be a ZodObject or a ZodArray<ZodObject>');
40
- }
41
- }
42
- else {
43
- throw new Error('Schema must be either a ZuiObject or a ZuiArray<ZuiObject>');
44
- }
45
- const schemaTypescript = schema.toTypescript({ declaration: false });
46
- const schemaLength = tokenizer.count(schemaTypescript);
47
- options.chunkLength = Math.min(options.chunkLength, this.Model.input.maxTokens - PROMPT_INPUT_BUFFER - schemaLength);
48
- const keys = Object.keys(schema.shape);
49
- let inputAsString = stringify(input);
50
- if (tokenizer.count(inputAsString) > options.chunkLength) {
51
- // If we want to extract an array of objects, we will run this function recursively
52
- if (isArrayOfObjects) {
53
- const tokens = tokenizer.split(inputAsString);
54
- const chunks = _.chunk(tokens, options.chunkLength).map((x) => x.join(''));
55
- const all = await Promise.all(chunks.map((chunk) => this.extract(chunk, originalSchema)));
56
- return all.flat();
57
- }
58
- else {
59
- // Truncate the input to fit the model's input size
60
- inputAsString = tokenizer.truncate(stringify(input), options.chunkLength);
61
- }
62
- }
63
- const instructions = [];
64
- if (options.instructions) {
65
- instructions.push(options.instructions);
66
- }
67
- const shape = `{ ${keys.map((key) => `"${key}": ...`).join(', ')} }`;
68
- const abbv = '{ ... }';
69
- if (isArrayOfObjects) {
70
- instructions.push('You may have multiple elements, or zero elements in the input.');
71
- instructions.push('You must extract each element separately.');
72
- instructions.push(`Each element must be a JSON object with exactly the format: ${START}${shape}${END}`);
73
- instructions.push(`When you are done extracting all elements, type "${NO_MORE}" to finish.`);
74
- instructions.push(`For example, if you have zero elements, the output should look like this: ${NO_MORE}`);
75
- instructions.push(`For example, if you have two elements, the output should look like this: ${START}${abbv}${END}${START}${abbv}${END}${NO_MORE}`);
76
- }
77
- else {
78
- instructions.push('You may have exactly one element in the input.');
79
- instructions.push(`The element must be a JSON object with exactly the format: ${START}${shape}${END}`);
80
- }
81
- // All tokens remaining after the input and condition are accounted can be used for examples
82
- const EXAMPLES_TOKENS = PROMPT_COMPONENT - tokenizer.count(inputAsString) - tokenizer.count(instructions.join('\n'));
83
- const Key = fastHash(JSON.stringify({
84
- taskType,
85
- taskId,
86
- input: inputAsString,
87
- instructions: options.instructions
88
- }));
89
- const examples = taskId
90
- ? await this.adapter.getExamples({
91
- input: inputAsString,
92
- taskType,
93
- taskId
94
- })
95
- : [];
96
- const exactMatch = examples.find((x) => x.key === Key);
97
- if (exactMatch) {
98
- return exactMatch.output;
99
- }
100
- const defaultExample = isArrayOfObjects
101
- ? {
102
- input: `The story goes as follow.
103
- Once upon a time, there was a person named Alice who was 30 years old.
104
- Then, there was a person named Bob who was 25 years old.
105
- The end.`,
106
- schema: 'Array<{ name: string, age: number }>',
107
- instructions: 'Extract all people',
108
- extracted: [
109
- {
110
- name: 'Alice',
111
- age: 30
112
- },
113
- {
114
- name: 'Bob',
115
- age: 25
116
- }
117
- ]
118
- }
119
- : {
120
- input: `The story goes as follow.
121
- Once upon a time, there was a person named Alice who was 30 years old.
122
- The end.`,
123
- schema: '{ name: string, age: number }',
124
- instructions: 'Extract the person',
125
- extracted: { name: 'Alice', age: 30 }
126
- };
127
- const userExamples = examples.map((e) => ({
128
- input: e.input,
129
- extracted: e.output,
130
- schema: schemaTypescript,
131
- instructions: options.instructions
132
- }));
133
- let exampleId = 1;
134
- const formatInput = (input, schema, instructions) => {
135
- const header = userExamples.length
136
- ? `Expert Example #${exampleId++}`
137
- : "Here's an example to help you understand the format:";
138
- return `
139
- ${header}
140
-
141
- <|start_schema|>
142
- ${schema}
143
- <|end_schema|>
144
-
145
- <|start_instructions|>
146
- ${instructions ?? 'No specific instructions, just follow the schema above.'}
147
- <|end_instructions|>
148
-
149
- <|start_input|>
150
- ${input.trim()}
151
- <|end_input|>
152
- `.trim();
153
- };
154
- const formatOutput = (extracted) => {
155
- extracted = _.isArray(extracted) ? extracted : [extracted];
156
- return (extracted
157
- .map((x) => `
158
- ${START}
159
- ${JSON.stringify(x, null, 2)}
160
- ${END}`.trim())
161
- .join('\n') + NO_MORE);
162
- };
163
- const formatExample = (example) => [
164
- {
165
- type: 'text',
166
- content: formatInput(stringify(example.input ?? null), example.schema, example.instructions),
167
- role: 'user'
168
- },
169
- {
170
- type: 'text',
171
- content: formatOutput(example.extracted),
172
- role: 'assistant'
173
- }
174
- ];
175
- const allExamples = takeUntilTokens(userExamples.length ? userExamples : [defaultExample], EXAMPLES_TOKENS, (el) => tokenizer.count(stringify(el.input)) + tokenizer.count(stringify(el.extracted)))
176
- .map(formatExample)
177
- .flat();
178
- const output = await this.callModel({
179
- systemPrompt: `
180
- Extract the following information from the input:
181
- ${schemaTypescript}
182
- ====
183
-
184
- ${instructions.map((x) => `• ${x}`).join('\n')}
185
- `.trim(),
186
- stopSequences: [isArrayOfObjects ? NO_MORE : END],
187
- messages: [
188
- ...allExamples,
189
- {
190
- role: 'user',
191
- type: 'text',
192
- content: formatInput(inputAsString, schemaTypescript, options.instructions ?? '')
193
- }
194
- ]
195
- });
196
- const answer = output.choices[0].content;
197
- const elements = answer
198
- .split(START)
199
- .filter((x) => x.trim().length > 0)
200
- .map((x) => {
201
- try {
202
- const json = x.slice(0, x.indexOf(END)).trim();
203
- const repairedJson = jsonrepair(json);
204
- const parsedJson = JSON5.parse(repairedJson);
205
- return schema.parse(parsedJson);
206
- }
207
- catch (error) {
208
- throw new JsonParsingError(x, error);
209
- }
210
- })
211
- .filter((x) => x !== null);
212
- let final;
213
- if (isArrayOfObjects) {
214
- final = elements;
215
- }
216
- else if (elements.length === 0) {
217
- final = schema.parse({});
218
- }
219
- else {
220
- final = elements[0];
221
- }
222
- if (taskId) {
223
- await this.adapter.saveExample({
224
- key: Key,
225
- taskId: `zai/${taskId}`,
226
- taskType,
227
- instructions: options.instructions ?? 'No specific instructions',
228
- input: inputAsString,
229
- output: final,
230
- metadata: output.metadata
231
- });
232
- }
233
- return final;
234
- };
235
- //# sourceMappingURL=extract.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extract.js","sourceRoot":"","sources":["../../../src/operations/extract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAA;AAExD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvC,OAAO,CAAC,MAAM,QAAQ,CAAA;AACtB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/D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