@promptbook/utils 0.50.0 → 0.52.0-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.
- package/README.md +6 -2
- package/esm/index.es.js +189 -72
- package/esm/index.es.js.map +1 -1
- package/esm/typings/_packages/execute-javascript.index.d.ts +44 -1
- package/esm/typings/_packages/openai.index.d.ts +2 -1
- package/esm/typings/_packages/types.index.d.ts +3 -2
- package/esm/typings/_packages/utils.index.d.ts +9 -2
- package/esm/typings/conversion/utils/extractParametersFromPromptTemplate.d.ts +13 -0
- package/esm/typings/conversion/utils/extractParametersFromPromptTemplate.test.d.ts +1 -0
- package/esm/typings/conversion/utils/extractVariables.d.ts +4 -3
- package/esm/typings/execution/plugins/llm-execution-tools/openai/computeOpenaiUsage.d.ts +0 -3
- package/esm/typings/execution/plugins/llm-execution-tools/openai/computeUsage.d.ts +13 -0
- package/esm/typings/execution/plugins/llm-execution-tools/openai/computeUsage.test.d.ts +1 -0
- package/esm/typings/execution/plugins/llm-execution-tools/openai/models.d.ts +25 -0
- package/esm/typings/types/ModelRequirements.d.ts +1 -0
- package/esm/typings/types/PromptbookJson/PromptTemplateJson.d.ts +2 -1
- package/esm/typings/utils/extractParameters.d.ts +1 -3
- package/esm/typings/utils/sets/difference.d.ts +4 -0
- package/esm/typings/utils/sets/difference.test.d.ts +1 -0
- package/esm/typings/utils/sets/intersection.d.ts +4 -0
- package/esm/typings/utils/sets/intersection.test.d.ts +1 -0
- package/esm/typings/utils/sets/union.d.ts +4 -0
- package/esm/typings/utils/sets/union.test.d.ts +1 -0
- package/package.json +2 -2
- package/umd/index.umd.js +194 -71
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/_packages/execute-javascript.index.d.ts +44 -1
- package/umd/typings/_packages/openai.index.d.ts +2 -1
- package/umd/typings/_packages/types.index.d.ts +3 -2
- package/umd/typings/_packages/utils.index.d.ts +9 -2
- package/umd/typings/conversion/utils/extractParametersFromPromptTemplate.d.ts +13 -0
- package/umd/typings/conversion/utils/extractParametersFromPromptTemplate.test.d.ts +1 -0
- package/umd/typings/conversion/utils/extractVariables.d.ts +4 -3
- package/umd/typings/execution/plugins/llm-execution-tools/openai/computeOpenaiUsage.d.ts +0 -3
- package/umd/typings/execution/plugins/llm-execution-tools/openai/computeUsage.d.ts +13 -0
- package/umd/typings/execution/plugins/llm-execution-tools/openai/computeUsage.test.d.ts +1 -0
- package/umd/typings/execution/plugins/llm-execution-tools/openai/models.d.ts +25 -0
- package/umd/typings/types/ModelRequirements.d.ts +1 -0
- package/umd/typings/types/PromptbookJson/PromptTemplateJson.d.ts +2 -1
- package/umd/typings/utils/extractParameters.d.ts +1 -3
- package/umd/typings/utils/sets/difference.d.ts +4 -0
- package/umd/typings/utils/sets/difference.test.d.ts +1 -0
- package/umd/typings/utils/sets/intersection.d.ts +4 -0
- package/umd/typings/utils/sets/intersection.test.d.ts +1 -0
- package/umd/typings/utils/sets/union.d.ts +4 -0
- package/umd/typings/utils/sets/union.test.d.ts +1 -0
|
@@ -32,7 +32,7 @@ export type Expectations = Partial<Record<Lowercase<ExpectationUnit>, {
|
|
|
32
32
|
/**
|
|
33
33
|
* Units of text measurement
|
|
34
34
|
*/
|
|
35
|
-
export declare const EXPECTATION_UNITS: readonly ["CHARACTERS", "WORDS", "SENTENCES", "
|
|
35
|
+
export declare const EXPECTATION_UNITS: readonly ["CHARACTERS", "WORDS", "SENTENCES", "LINES", "PARAGRAPHS", "PAGES"];
|
|
36
36
|
/**
|
|
37
37
|
* Unit of text measurement
|
|
38
38
|
*/
|
|
@@ -133,4 +133,5 @@ export {};
|
|
|
133
133
|
/**
|
|
134
134
|
* TODO: [💝] Unite object for expecting amount and format - remove expectFormat
|
|
135
135
|
* TODO: use one helper type> (string_prompt | string_javascript | string_markdown) & string_template
|
|
136
|
+
* TODO: [👙][🧠] Just selecting gpt3 or gpt4 level of model
|
|
136
137
|
*/
|
|
@@ -4,7 +4,5 @@ import { string_name, string_template } from '../types/typeAliases';
|
|
|
4
4
|
*
|
|
5
5
|
* @param template the template with parameters in {curly} braces
|
|
6
6
|
* @returns the list of parameter names
|
|
7
|
-
*
|
|
8
|
-
* @private within the library
|
|
9
7
|
*/
|
|
10
|
-
export declare function extractParameters(template: string_template):
|
|
8
|
+
export declare function extractParameters(template: string_template): Set<string_name>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.52.0-0",
|
|
4
4
|
"description": "Library to supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"moment": "2.30.1",
|
|
38
38
|
"prettier": "2.8.1",
|
|
39
|
-
"spacetrim": "0.11.
|
|
39
|
+
"spacetrim": "0.11.25"
|
|
40
40
|
},
|
|
41
41
|
"funding": [
|
|
42
42
|
{
|
package/umd/index.umd.js
CHANGED
|
@@ -109,37 +109,6 @@
|
|
|
109
109
|
*/
|
|
110
110
|
var SUPPORTED_SCRIPT_LANGUAGES = ['javascript', 'typescript', 'python'];
|
|
111
111
|
|
|
112
|
-
/**
|
|
113
|
-
* Parses the template and returns the list of all parameter names
|
|
114
|
-
*
|
|
115
|
-
* @param template the template with parameters in {curly} braces
|
|
116
|
-
* @returns the list of parameter names
|
|
117
|
-
*
|
|
118
|
-
* @private within the library
|
|
119
|
-
*/
|
|
120
|
-
function extractParameters(template) {
|
|
121
|
-
var e_1, _a;
|
|
122
|
-
var matches = template.matchAll(/{\w+}/g);
|
|
123
|
-
var parameterNames = [];
|
|
124
|
-
try {
|
|
125
|
-
for (var matches_1 = __values(matches), matches_1_1 = matches_1.next(); !matches_1_1.done; matches_1_1 = matches_1.next()) {
|
|
126
|
-
var match = matches_1_1.value;
|
|
127
|
-
var parameterName = match[0].slice(1, -1);
|
|
128
|
-
if (!parameterNames.includes(parameterName)) {
|
|
129
|
-
parameterNames.push(parameterName);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
134
|
-
finally {
|
|
135
|
-
try {
|
|
136
|
-
if (matches_1_1 && !matches_1_1.done && (_a = matches_1.return)) _a.call(matches_1);
|
|
137
|
-
}
|
|
138
|
-
finally { if (e_1) throw e_1.error; }
|
|
139
|
-
}
|
|
140
|
-
return parameterNames;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
112
|
/**
|
|
144
113
|
* Computes the deepness of the markdown structure.
|
|
145
114
|
*
|
|
@@ -405,10 +374,75 @@
|
|
|
405
374
|
return spacetrim.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
|
|
406
375
|
}
|
|
407
376
|
|
|
377
|
+
/**
|
|
378
|
+
* Creates a new set with all elements that are present in either set
|
|
379
|
+
*/
|
|
380
|
+
function union() {
|
|
381
|
+
var e_1, _a, e_2, _b;
|
|
382
|
+
var sets = [];
|
|
383
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
384
|
+
sets[_i] = arguments[_i];
|
|
385
|
+
}
|
|
386
|
+
var union = new Set();
|
|
387
|
+
try {
|
|
388
|
+
for (var sets_1 = __values(sets), sets_1_1 = sets_1.next(); !sets_1_1.done; sets_1_1 = sets_1.next()) {
|
|
389
|
+
var set = sets_1_1.value;
|
|
390
|
+
try {
|
|
391
|
+
for (var _c = (e_2 = void 0, __values(Array.from(set))), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
392
|
+
var item = _d.value;
|
|
393
|
+
union.add(item);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
397
|
+
finally {
|
|
398
|
+
try {
|
|
399
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
400
|
+
}
|
|
401
|
+
finally { if (e_2) throw e_2.error; }
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
406
|
+
finally {
|
|
407
|
+
try {
|
|
408
|
+
if (sets_1_1 && !sets_1_1.done && (_a = sets_1.return)) _a.call(sets_1);
|
|
409
|
+
}
|
|
410
|
+
finally { if (e_1) throw e_1.error; }
|
|
411
|
+
}
|
|
412
|
+
return union;
|
|
413
|
+
}
|
|
414
|
+
|
|
408
415
|
/**
|
|
409
416
|
* The version of the Promptbook library
|
|
410
417
|
*/
|
|
411
|
-
var PROMPTBOOK_VERSION = '0.
|
|
418
|
+
var PROMPTBOOK_VERSION = '0.51.0';
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Parses the template and returns the list of all parameter names
|
|
422
|
+
*
|
|
423
|
+
* @param template the template with parameters in {curly} braces
|
|
424
|
+
* @returns the list of parameter names
|
|
425
|
+
*/
|
|
426
|
+
function extractParameters(template) {
|
|
427
|
+
var e_1, _a;
|
|
428
|
+
var matches = template.matchAll(/{\w+}/g);
|
|
429
|
+
var parameterNames = new Set();
|
|
430
|
+
try {
|
|
431
|
+
for (var matches_1 = __values(matches), matches_1_1 = matches_1.next(); !matches_1_1.done; matches_1_1 = matches_1.next()) {
|
|
432
|
+
var match = matches_1_1.value;
|
|
433
|
+
var parameterName = match[0].slice(1, -1);
|
|
434
|
+
parameterNames.add(parameterName);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
438
|
+
finally {
|
|
439
|
+
try {
|
|
440
|
+
if (matches_1_1 && !matches_1_1.done && (_a = matches_1.return)) _a.call(matches_1);
|
|
441
|
+
}
|
|
442
|
+
finally { if (e_1) throw e_1.error; }
|
|
443
|
+
}
|
|
444
|
+
return parameterNames;
|
|
445
|
+
}
|
|
412
446
|
|
|
413
447
|
/**
|
|
414
448
|
* Parses the given script and returns the list of all used variables that are not defined in the script
|
|
@@ -416,11 +450,9 @@
|
|
|
416
450
|
* @param script from which to extract the variables
|
|
417
451
|
* @returns the list of variable names
|
|
418
452
|
* @throws {PromptbookSyntaxError} if the script is invalid
|
|
419
|
-
*
|
|
420
|
-
* @private within the promptbookStringToJson
|
|
421
453
|
*/
|
|
422
454
|
function extractVariables(script) {
|
|
423
|
-
var variables =
|
|
455
|
+
var variables = new Set();
|
|
424
456
|
script = "(()=>{".concat(script, "})()");
|
|
425
457
|
try {
|
|
426
458
|
for (var i = 0; i < 100 /* <- TODO: This limit to configuration */; i++)
|
|
@@ -444,7 +476,7 @@
|
|
|
444
476
|
script = "const ".concat(undefinedName, " = ()=>'';") + script;
|
|
445
477
|
}
|
|
446
478
|
else {
|
|
447
|
-
variables.
|
|
479
|
+
variables.add(undefinedName);
|
|
448
480
|
script = "const ".concat(undefinedName, " = '';") + script;
|
|
449
481
|
}
|
|
450
482
|
}
|
|
@@ -457,6 +489,53 @@
|
|
|
457
489
|
}
|
|
458
490
|
return variables;
|
|
459
491
|
}
|
|
492
|
+
/**
|
|
493
|
+
* TODO: [🔣] Support for multiple languages - python, java,...
|
|
494
|
+
*/
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Parses the prompt template and returns the set of all used parameters
|
|
498
|
+
*
|
|
499
|
+
* @param promptTemplate the template with used parameters
|
|
500
|
+
* @returns the set of parameter names
|
|
501
|
+
* @throws {PromptbookSyntaxError} if the script is invalid
|
|
502
|
+
*/
|
|
503
|
+
function extractParametersFromPromptTemplate(promptTemplate) {
|
|
504
|
+
var e_1, _a, e_2, _b;
|
|
505
|
+
var parameterNames = new Set();
|
|
506
|
+
try {
|
|
507
|
+
for (var _c = __values(__spreadArray(__spreadArray(__spreadArray([], __read(extractParameters(promptTemplate.title)), false), __read(extractParameters(promptTemplate.description || '')), false), __read(extractParameters(promptTemplate.content)), false)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
508
|
+
var parameterName = _d.value;
|
|
509
|
+
parameterNames.add(parameterName);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
513
|
+
finally {
|
|
514
|
+
try {
|
|
515
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
516
|
+
}
|
|
517
|
+
finally { if (e_1) throw e_1.error; }
|
|
518
|
+
}
|
|
519
|
+
if (promptTemplate.executionType === 'SCRIPT') {
|
|
520
|
+
try {
|
|
521
|
+
for (var _e = __values(extractVariables(promptTemplate.content)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
522
|
+
var parameterName = _f.value;
|
|
523
|
+
parameterNames.add(parameterName);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
527
|
+
finally {
|
|
528
|
+
try {
|
|
529
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
530
|
+
}
|
|
531
|
+
finally { if (e_2) throw e_2.error; }
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
return parameterNames;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* TODO: [🔣] If script require contentLanguage
|
|
538
|
+
*/
|
|
460
539
|
|
|
461
540
|
/**
|
|
462
541
|
* Execution type describes the way how the block is executed
|
|
@@ -474,10 +553,11 @@
|
|
|
474
553
|
/**
|
|
475
554
|
* Units of text measurement
|
|
476
555
|
*/
|
|
477
|
-
var EXPECTATION_UNITS = ['CHARACTERS', 'WORDS', 'SENTENCES', '
|
|
556
|
+
var EXPECTATION_UNITS = ['CHARACTERS', 'WORDS', 'SENTENCES', 'LINES', 'PARAGRAPHS', 'PAGES'];
|
|
478
557
|
/**
|
|
479
558
|
* TODO: [💝] Unite object for expecting amount and format - remove expectFormat
|
|
480
559
|
* TODO: use one helper type> (string_prompt | string_javascript | string_markdown) & string_template
|
|
560
|
+
* TODO: [👙][🧠] Just selecting gpt3 or gpt4 level of model
|
|
481
561
|
*/
|
|
482
562
|
|
|
483
563
|
/**
|
|
@@ -933,11 +1013,11 @@
|
|
|
933
1013
|
finally { if (e_1) throw e_1.error; }
|
|
934
1014
|
}
|
|
935
1015
|
var _loop_1 = function (section) {
|
|
936
|
-
var e_3, _e
|
|
1016
|
+
var e_3, _e;
|
|
937
1017
|
// TODO: Parse prompt template description (the content out of the codeblock and lists)
|
|
938
1018
|
var templateModelRequirements = __assign({}, defaultModelRequirements);
|
|
939
1019
|
var listItems_3 = extractAllListItemsFromMarkdown(section.content);
|
|
940
|
-
var dependentParameterNames =
|
|
1020
|
+
var dependentParameterNames = new Set();
|
|
941
1021
|
var executionType = 'PROMPT_TEMPLATE';
|
|
942
1022
|
var jokers = [];
|
|
943
1023
|
var postprocessing = [];
|
|
@@ -951,7 +1031,7 @@
|
|
|
951
1031
|
switch (command.type) {
|
|
952
1032
|
case 'JOKER':
|
|
953
1033
|
jokers.push(command.parameterName);
|
|
954
|
-
dependentParameterNames.
|
|
1034
|
+
dependentParameterNames.add(command.parameterName);
|
|
955
1035
|
break;
|
|
956
1036
|
case 'EXECUTE':
|
|
957
1037
|
if (isExecutionTypeChanged) {
|
|
@@ -1005,7 +1085,7 @@
|
|
|
1005
1085
|
}
|
|
1006
1086
|
finally { if (e_3) throw e_3.error; }
|
|
1007
1087
|
}
|
|
1008
|
-
var
|
|
1088
|
+
var _f = extractOneBlockFromMarkdown(section.content), language = _f.language, content = _f.content;
|
|
1009
1089
|
if (executionType === 'SCRIPT') {
|
|
1010
1090
|
if (!language) {
|
|
1011
1091
|
throw new PromptbookSyntaxError('You must specify the language of the script in the prompt template');
|
|
@@ -1044,40 +1124,12 @@
|
|
|
1044
1124
|
if (Object.keys(postprocessing).length === 0) {
|
|
1045
1125
|
postprocessing = undefined;
|
|
1046
1126
|
}
|
|
1047
|
-
|
|
1048
|
-
for (var _j = (e_4 = void 0, __values(__spreadArray(__spreadArray(__spreadArray([], __read(extractParameters(section.title)), false), __read(extractParameters(description_1 || '')), false), __read(extractParameters(content)), false))), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
1049
|
-
var parameterName = _k.value;
|
|
1050
|
-
dependentParameterNames.push(parameterName);
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1054
|
-
finally {
|
|
1055
|
-
try {
|
|
1056
|
-
if (_k && !_k.done && (_f = _j.return)) _f.call(_j);
|
|
1057
|
-
}
|
|
1058
|
-
finally { if (e_4) throw e_4.error; }
|
|
1059
|
-
}
|
|
1060
|
-
if (executionType === 'SCRIPT') {
|
|
1061
|
-
try {
|
|
1062
|
-
for (var _l = (e_5 = void 0, __values(extractVariables(content))), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
1063
|
-
var parameterName = _m.value;
|
|
1064
|
-
dependentParameterNames.push(parameterName);
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1068
|
-
finally {
|
|
1069
|
-
try {
|
|
1070
|
-
if (_m && !_m.done && (_g = _l.return)) _g.call(_l);
|
|
1071
|
-
}
|
|
1072
|
-
finally { if (e_5) throw e_5.error; }
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
dependentParameterNames = __spreadArray([], __read(new Set(dependentParameterNames)), false);
|
|
1127
|
+
dependentParameterNames = union(dependentParameterNames, extractParametersFromPromptTemplate(__assign(__assign({}, section), { description: description_1, executionType: executionType, content: content })));
|
|
1076
1128
|
promptbookJson.promptTemplates.push({
|
|
1077
1129
|
name: titleToName(section.title),
|
|
1078
1130
|
title: section.title,
|
|
1079
1131
|
description: description_1,
|
|
1080
|
-
dependentParameterNames: dependentParameterNames,
|
|
1132
|
+
dependentParameterNames: Array.from(dependentParameterNames),
|
|
1081
1133
|
executionType: executionType,
|
|
1082
1134
|
jokers: jokers,
|
|
1083
1135
|
postprocessing: postprocessing,
|
|
@@ -2515,6 +2567,71 @@
|
|
|
2515
2567
|
return text;
|
|
2516
2568
|
}
|
|
2517
2569
|
|
|
2570
|
+
/**
|
|
2571
|
+
* Create difference set of two sets.
|
|
2572
|
+
*/
|
|
2573
|
+
function difference(a, b, isEqual) {
|
|
2574
|
+
var e_1, _a;
|
|
2575
|
+
if (isEqual === void 0) { isEqual = function (a, b) { return a === b; }; }
|
|
2576
|
+
var diff = new Set();
|
|
2577
|
+
var _loop_1 = function (itemA) {
|
|
2578
|
+
if (!Array.from(b).some(function (itemB) { return isEqual(itemA, itemB); })) {
|
|
2579
|
+
diff.add(itemA);
|
|
2580
|
+
}
|
|
2581
|
+
};
|
|
2582
|
+
try {
|
|
2583
|
+
for (var _b = __values(Array.from(a)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2584
|
+
var itemA = _c.value;
|
|
2585
|
+
_loop_1(itemA);
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2589
|
+
finally {
|
|
2590
|
+
try {
|
|
2591
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2592
|
+
}
|
|
2593
|
+
finally { if (e_1) throw e_1.error; }
|
|
2594
|
+
}
|
|
2595
|
+
return diff;
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
/**
|
|
2599
|
+
* Creates a new set with all elements that are present in all sets
|
|
2600
|
+
*/
|
|
2601
|
+
function intersection() {
|
|
2602
|
+
var e_1, _a;
|
|
2603
|
+
var sets = [];
|
|
2604
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2605
|
+
sets[_i] = arguments[_i];
|
|
2606
|
+
}
|
|
2607
|
+
var intersection = new Set();
|
|
2608
|
+
if (sets[0]) {
|
|
2609
|
+
try {
|
|
2610
|
+
for (var _b = __values(Array.from(sets[0])), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2611
|
+
var item = _c.value;
|
|
2612
|
+
var isPresentInAllSets = true;
|
|
2613
|
+
for (var i = 1; i < sets.length; i++) {
|
|
2614
|
+
if (sets[i] !== undefined && !sets[i].has(item)) {
|
|
2615
|
+
isPresentInAllSets = false;
|
|
2616
|
+
break;
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
if (isPresentInAllSets) {
|
|
2620
|
+
intersection.add(item);
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2625
|
+
finally {
|
|
2626
|
+
try {
|
|
2627
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2628
|
+
}
|
|
2629
|
+
finally { if (e_1) throw e_1.error; }
|
|
2630
|
+
}
|
|
2631
|
+
}
|
|
2632
|
+
return intersection;
|
|
2633
|
+
}
|
|
2634
|
+
|
|
2518
2635
|
/**
|
|
2519
2636
|
* Function trimCodeBlock will trim starting and ending code block from the string if it is present.
|
|
2520
2637
|
*
|
|
@@ -2649,11 +2766,16 @@
|
|
|
2649
2766
|
exports.countSentences = countSentences;
|
|
2650
2767
|
exports.countWords = countWords;
|
|
2651
2768
|
exports.decapitalize = decapitalize;
|
|
2769
|
+
exports.difference = difference;
|
|
2652
2770
|
exports.executionReportJsonToString = executionReportJsonToString;
|
|
2653
2771
|
exports.extractAllBlocksFromMarkdown = extractAllBlocksFromMarkdown;
|
|
2654
2772
|
exports.extractAllListItemsFromMarkdown = extractAllListItemsFromMarkdown;
|
|
2655
2773
|
exports.extractBlock = extractBlock;
|
|
2656
2774
|
exports.extractOneBlockFromMarkdown = extractOneBlockFromMarkdown;
|
|
2775
|
+
exports.extractParameters = extractParameters;
|
|
2776
|
+
exports.extractParametersFromPromptTemplate = extractParametersFromPromptTemplate;
|
|
2777
|
+
exports.extractVariables = extractVariables;
|
|
2778
|
+
exports.intersection = intersection;
|
|
2657
2779
|
exports.isPassingExpectations = isPassingExpectations;
|
|
2658
2780
|
exports.isValidJsonString = isValidJsonString;
|
|
2659
2781
|
exports.isValidKeyword = isValidKeyword;
|
|
@@ -2683,6 +2805,7 @@
|
|
|
2683
2805
|
exports.titleToName = titleToName;
|
|
2684
2806
|
exports.trimCodeBlock = trimCodeBlock;
|
|
2685
2807
|
exports.trimEndOfCodeBlock = trimEndOfCodeBlock;
|
|
2808
|
+
exports.union = union;
|
|
2686
2809
|
exports.unwrapResult = unwrapResult;
|
|
2687
2810
|
|
|
2688
2811
|
Object.defineProperty(exports, '__esModule', { value: true });
|