@promptbook/core 0.69.0-11 → 0.69.0-13
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/esm/index.es.js +181 -184
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/_packages/types.index.d.ts +4 -0
- package/esm/typings/src/config.d.ts +7 -0
- package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorSettings.d.ts +7 -0
- package/esm/typings/src/formats/_common/FormatDefinition.d.ts +9 -6
- package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +4 -3
- package/esm/typings/src/formats/csv/CsvFormatDefinition.d.ts +3 -1
- package/esm/typings/src/formats/csv/CsvSettings.d.ts +13 -0
- package/esm/typings/src/formats/index.d.ts +1 -1
- package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +3 -2
- package/esm/typings/src/formats/text/TextFormatDefinition.d.ts +3 -1
- package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +3 -2
- package/esm/typings/src/utils/organization/{f.d.ts → empty_object.d.ts} +5 -1
- package/esm/typings/src/utils/organization/just_empty_object.d.ts +12 -0
- package/package.json +1 -1
- package/umd/index.umd.js +182 -183
- package/umd/index.umd.js.map +1 -1
package/umd/index.umd.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
/**
|
|
17
17
|
* The version of the Promptbook library
|
|
18
18
|
*/
|
|
19
|
-
var PROMPTBOOK_VERSION = '0.69.0-
|
|
19
|
+
var PROMPTBOOK_VERSION = '0.69.0-12';
|
|
20
20
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
21
21
|
|
|
22
22
|
/*! *****************************************************************************
|
|
@@ -753,6 +753,17 @@
|
|
|
753
753
|
*/
|
|
754
754
|
var DEFAULT_REMOTE_URL_PATH = '/promptbook/socket.io';
|
|
755
755
|
// <- TODO: [🧜♂️]
|
|
756
|
+
/**
|
|
757
|
+
* @@@
|
|
758
|
+
*
|
|
759
|
+
* @public exported from `@promptbook/core`
|
|
760
|
+
*/
|
|
761
|
+
var DEFAULT_CSV_SETTINGS = Object.freeze({
|
|
762
|
+
delimiter: ',',
|
|
763
|
+
quoteChar: '"',
|
|
764
|
+
newline: '\n',
|
|
765
|
+
skipEmptyLines: true,
|
|
766
|
+
});
|
|
756
767
|
/**
|
|
757
768
|
* @@@
|
|
758
769
|
*
|
|
@@ -1824,7 +1835,7 @@
|
|
|
1824
1835
|
});
|
|
1825
1836
|
}
|
|
1826
1837
|
|
|
1827
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.69.0-
|
|
1838
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.69.0-12",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.69.0-12",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.69.0-12",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.69.0-12",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
|
|
1828
1839
|
|
|
1829
1840
|
var defaultDiacriticsRemovalMap = [
|
|
1830
1841
|
{
|
|
@@ -2627,9 +2638,7 @@
|
|
|
2627
2638
|
throw new PipelineExecutionError("You have not provided any `LlmExecutionTools`");
|
|
2628
2639
|
}
|
|
2629
2640
|
else {
|
|
2630
|
-
throw new PipelineExecutionError(spaceTrim__default["default"](function (block) { return "\n You have not provided any `LlmExecutionTools` that support model variant \"".concat(prompt.modelRequirements.modelVariant, "\n\n Available `LlmExecutionTools`:\n ").concat(block(_this.llmExecutionTools
|
|
2631
|
-
.map(function (tools) { return "- ".concat(tools.title, " ").concat(tools.description || ''); })
|
|
2632
|
-
.join('\n')), "\n\n "); }));
|
|
2641
|
+
throw new PipelineExecutionError(spaceTrim__default["default"](function (block) { return "\n You have not provided any `LlmExecutionTools` that support model variant \"".concat(prompt.modelRequirements.modelVariant, "\n\n Available `LlmExecutionTools`:\n ").concat(block(_this.llmExecutionTools.map(function (tools) { return "- ".concat(tools.title); }).join('\n')), "\n\n "); }));
|
|
2633
2642
|
}
|
|
2634
2643
|
}
|
|
2635
2644
|
});
|
|
@@ -2935,6 +2944,16 @@
|
|
|
2935
2944
|
}
|
|
2936
2945
|
}
|
|
2937
2946
|
|
|
2947
|
+
/**
|
|
2948
|
+
* @@@
|
|
2949
|
+
*
|
|
2950
|
+
* @public exported from `@promptbook/core`
|
|
2951
|
+
*/
|
|
2952
|
+
var MANDATORY_CSV_SETTINGS = Object.freeze({
|
|
2953
|
+
header: true,
|
|
2954
|
+
// encoding: 'utf8',
|
|
2955
|
+
});
|
|
2956
|
+
|
|
2938
2957
|
/**
|
|
2939
2958
|
* Definition for CSV spreadsheet
|
|
2940
2959
|
*
|
|
@@ -2944,41 +2963,36 @@
|
|
|
2944
2963
|
var CsvFormatDefinition = {
|
|
2945
2964
|
formatName: 'CSV',
|
|
2946
2965
|
aliases: ['SPREADSHEET', 'TABLE'],
|
|
2947
|
-
isValid: function (value, schema) {
|
|
2966
|
+
isValid: function (value, settings, schema) {
|
|
2967
|
+
// TODO: !!!!!! Implement CSV validation
|
|
2948
2968
|
TODO_USE(value /* <- TODO: Use value here */);
|
|
2969
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2949
2970
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2950
2971
|
return true;
|
|
2951
2972
|
},
|
|
2952
|
-
canBeValid: function (partialValue, schema) {
|
|
2973
|
+
canBeValid: function (partialValue, settings, schema) {
|
|
2953
2974
|
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
2975
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2954
2976
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2955
2977
|
return true;
|
|
2956
2978
|
},
|
|
2957
|
-
heal: function (value, schema) {
|
|
2979
|
+
heal: function (value, settings, schema) {
|
|
2958
2980
|
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
2981
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2959
2982
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2960
2983
|
throw new Error('Not implemented');
|
|
2961
2984
|
},
|
|
2962
2985
|
subvalueDefinitions: [
|
|
2963
2986
|
{
|
|
2964
2987
|
subvalueName: 'ROW',
|
|
2965
|
-
mapValues: function (value, mapCallback) {
|
|
2988
|
+
mapValues: function (value, settings, mapCallback) {
|
|
2966
2989
|
return __awaiter(this, void 0, void 0, function () {
|
|
2967
2990
|
var csv, mappedData;
|
|
2968
2991
|
var _this = this;
|
|
2969
2992
|
return __generator(this, function (_a) {
|
|
2970
2993
|
switch (_a.label) {
|
|
2971
2994
|
case 0:
|
|
2972
|
-
csv = papaparse.parse(value, {
|
|
2973
|
-
header: true,
|
|
2974
|
-
delimiter: ',',
|
|
2975
|
-
quoteChar: '"',
|
|
2976
|
-
newline: '\r\n',
|
|
2977
|
-
skipEmptyLines: true,
|
|
2978
|
-
// encoding: 'utf8',
|
|
2979
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
2980
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
2981
|
-
});
|
|
2995
|
+
csv = papaparse.parse(value, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS));
|
|
2982
2996
|
if (csv.errors.length !== 0) {
|
|
2983
2997
|
throw new ParseError(// <- TODO: !!!!!! Split PipelineParseError and FormatParseError -> CsvParseError
|
|
2984
2998
|
spaceTrim__default["default"](function (block) { return "\n CSV parsing error\n\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n "); }));
|
|
@@ -2992,25 +3006,18 @@
|
|
|
2992
3006
|
_a = [__assign({}, row)];
|
|
2993
3007
|
_b = {};
|
|
2994
3008
|
// <- TODO: !!!!!! Dynamic new column name and position
|
|
3009
|
+
// <- TODO: !!!!!! Check name collisions
|
|
2995
3010
|
return [4 /*yield*/, mapCallback(row, index)];
|
|
2996
3011
|
case 1: return [2 /*return*/, (__assign.apply(void 0, _a.concat([(_b.newColumn =
|
|
2997
3012
|
// <- TODO: !!!!!! Dynamic new column name and position
|
|
3013
|
+
// <- TODO: !!!!!! Check name collisions
|
|
2998
3014
|
_c.sent(), _b)])))];
|
|
2999
3015
|
}
|
|
3000
3016
|
});
|
|
3001
3017
|
}); }))];
|
|
3002
3018
|
case 1:
|
|
3003
3019
|
mappedData = _a.sent();
|
|
3004
|
-
return [2 /*return*/, papaparse.unparse(mappedData, {
|
|
3005
|
-
header: true,
|
|
3006
|
-
delimiter: ',',
|
|
3007
|
-
quoteChar: '"',
|
|
3008
|
-
newline: '\r\n',
|
|
3009
|
-
skipEmptyLines: true,
|
|
3010
|
-
// encoding: 'utf8',
|
|
3011
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
3012
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
3013
|
-
})];
|
|
3020
|
+
return [2 /*return*/, papaparse.unparse(mappedData, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS))];
|
|
3014
3021
|
}
|
|
3015
3022
|
});
|
|
3016
3023
|
});
|
|
@@ -3018,23 +3025,14 @@
|
|
|
3018
3025
|
},
|
|
3019
3026
|
{
|
|
3020
3027
|
subvalueName: 'CELL',
|
|
3021
|
-
mapValues: function (value, mapCallback) {
|
|
3028
|
+
mapValues: function (value, settings, mapCallback) {
|
|
3022
3029
|
return __awaiter(this, void 0, void 0, function () {
|
|
3023
3030
|
var csv, mappedData;
|
|
3024
3031
|
var _this = this;
|
|
3025
3032
|
return __generator(this, function (_a) {
|
|
3026
3033
|
switch (_a.label) {
|
|
3027
3034
|
case 0:
|
|
3028
|
-
csv = papaparse.parse(value, {
|
|
3029
|
-
header: true,
|
|
3030
|
-
delimiter: ',',
|
|
3031
|
-
quoteChar: '"',
|
|
3032
|
-
newline: '\r\n',
|
|
3033
|
-
skipEmptyLines: true,
|
|
3034
|
-
// encoding: 'utf8',
|
|
3035
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
3036
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
3037
|
-
});
|
|
3035
|
+
csv = papaparse.parse(value, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS));
|
|
3038
3036
|
if (csv.errors.length !== 0) {
|
|
3039
3037
|
throw new ParseError(// <- TODO: !!!!!! Split PipelineParseError and FormatParseError -> CsvParseError
|
|
3040
3038
|
spaceTrim__default["default"](function (block) { return "\n CSV parsing error\n\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n "); }));
|
|
@@ -3057,16 +3055,7 @@
|
|
|
3057
3055
|
}); }))];
|
|
3058
3056
|
case 1:
|
|
3059
3057
|
mappedData = _a.sent();
|
|
3060
|
-
return [2 /*return*/, papaparse.unparse(mappedData, {
|
|
3061
|
-
header: true,
|
|
3062
|
-
delimiter: ',',
|
|
3063
|
-
quoteChar: '"',
|
|
3064
|
-
newline: '\r\n',
|
|
3065
|
-
skipEmptyLines: true,
|
|
3066
|
-
// encoding: 'utf8',
|
|
3067
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
3068
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
3069
|
-
})];
|
|
3058
|
+
return [2 /*return*/, papaparse.unparse(mappedData, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS))];
|
|
3070
3059
|
}
|
|
3071
3060
|
});
|
|
3072
3061
|
});
|
|
@@ -3111,17 +3100,20 @@
|
|
|
3111
3100
|
var JsonFormatDefinition = {
|
|
3112
3101
|
formatName: 'JSON',
|
|
3113
3102
|
mimeType: 'application/json',
|
|
3114
|
-
isValid: function (value, schema) {
|
|
3103
|
+
isValid: function (value, settings, schema) {
|
|
3115
3104
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3105
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3116
3106
|
return isValidJsonString(value);
|
|
3117
3107
|
},
|
|
3118
|
-
canBeValid: function (partialValue, schema) {
|
|
3108
|
+
canBeValid: function (partialValue, settings, schema) {
|
|
3119
3109
|
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
3110
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3120
3111
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3121
3112
|
return true;
|
|
3122
3113
|
},
|
|
3123
|
-
heal: function (value, schema) {
|
|
3114
|
+
heal: function (value, settings, schema) {
|
|
3124
3115
|
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
3116
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3125
3117
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3126
3118
|
throw new Error('Not implemented');
|
|
3127
3119
|
},
|
|
@@ -3130,7 +3122,7 @@
|
|
|
3130
3122
|
/**
|
|
3131
3123
|
* TODO: [🧠] Maybe propper instance of object
|
|
3132
3124
|
* TODO: [0] Make string_serialized_json
|
|
3133
|
-
* TODO: [1] Make type for JSON Schema
|
|
3125
|
+
* TODO: [1] Make type for JSON Settings and Schema
|
|
3134
3126
|
* TODO: [🧠] What to use for validating JSONs - JSON Schema, ZoD, typescript types/interfaces,...?
|
|
3135
3127
|
* TODO: [🍓] In `JsonFormatDefinition` implement simple `isValid`
|
|
3136
3128
|
* TODO: [🍓] In `JsonFormatDefinition` implement partial `canBeValid`
|
|
@@ -3160,7 +3152,7 @@
|
|
|
3160
3152
|
subvalueDefinitions: [
|
|
3161
3153
|
{
|
|
3162
3154
|
subvalueName: 'LINE',
|
|
3163
|
-
mapValues: function (value, mapCallback) {
|
|
3155
|
+
mapValues: function (value, settings, mapCallback) {
|
|
3164
3156
|
return __awaiter(this, void 0, void 0, function () {
|
|
3165
3157
|
var lines, mappedLines;
|
|
3166
3158
|
return __generator(this, function (_a) {
|
|
@@ -3186,6 +3178,7 @@
|
|
|
3186
3178
|
],
|
|
3187
3179
|
};
|
|
3188
3180
|
/**
|
|
3181
|
+
* TODO: [1] Make type for XML Text and Schema
|
|
3189
3182
|
* TODO: [🧠][🤠] Here should be all words, characters, lines, paragraphs, pages aviable as subvalues
|
|
3190
3183
|
* TODO: [🍓] In `TextFormatDefinition` implement simple `isValid`
|
|
3191
3184
|
* TODO: [🍓] In `TextFormatDefinition` implement partial `canBeValid`
|
|
@@ -3202,18 +3195,21 @@
|
|
|
3202
3195
|
var XmlFormatDefinition = {
|
|
3203
3196
|
formatName: 'XML',
|
|
3204
3197
|
mimeType: 'application/xml',
|
|
3205
|
-
isValid: function (value, schema) {
|
|
3198
|
+
isValid: function (value, settings, schema) {
|
|
3206
3199
|
TODO_USE(value /* <- TODO: Use value here */);
|
|
3200
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3207
3201
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3208
3202
|
return true;
|
|
3209
3203
|
},
|
|
3210
|
-
canBeValid: function (partialValue, schema) {
|
|
3204
|
+
canBeValid: function (partialValue, settings, schema) {
|
|
3211
3205
|
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
3206
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3212
3207
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3213
3208
|
return true;
|
|
3214
3209
|
},
|
|
3215
|
-
heal: function (value, schema) {
|
|
3210
|
+
heal: function (value, settings, schema) {
|
|
3216
3211
|
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
3212
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3217
3213
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3218
3214
|
throw new Error('Not implemented');
|
|
3219
3215
|
},
|
|
@@ -3222,7 +3218,7 @@
|
|
|
3222
3218
|
/**
|
|
3223
3219
|
* TODO: [🧠] Maybe propper instance of object
|
|
3224
3220
|
* TODO: [0] Make string_serialized_xml
|
|
3225
|
-
* TODO: [1] Make type for XML Schema
|
|
3221
|
+
* TODO: [1] Make type for XML Settings and Schema
|
|
3226
3222
|
* TODO: [🧠] What to use for validating XMLs - XSD,...
|
|
3227
3223
|
* TODO: [🍓] In `XmlFormatDefinition` implement simple `isValid`
|
|
3228
3224
|
* TODO: [🍓] In `XmlFormatDefinition` implement partial `canBeValid`
|
|
@@ -3702,10 +3698,10 @@
|
|
|
3702
3698
|
$scriptPipelineExecutionErrors: [],
|
|
3703
3699
|
};
|
|
3704
3700
|
_loop_1 = function (attempt) {
|
|
3705
|
-
var isJokerAttempt, jokerParameterName, _b, modelRequirements, _c, _d, _e, _f, _g,
|
|
3706
|
-
var e_1,
|
|
3707
|
-
return __generator(this, function (
|
|
3708
|
-
switch (
|
|
3701
|
+
var isJokerAttempt, jokerParameterName, _b, modelRequirements, _c, _d, _e, _f, _g, scriptTools, _h, error_1, e_1_1, _j, _k, _l, functionName, postprocessingError, _m, _o, scriptTools, _p, error_2, e_2_1, e_3_1, error_3;
|
|
3702
|
+
var e_1, _q, e_3, _r, e_2, _s;
|
|
3703
|
+
return __generator(this, function (_t) {
|
|
3704
|
+
switch (_t.label) {
|
|
3709
3705
|
case 0:
|
|
3710
3706
|
isJokerAttempt = attempt < 0;
|
|
3711
3707
|
jokerParameterName = jokerParameterNames[jokerParameterNames.length + attempt];
|
|
@@ -3725,21 +3721,21 @@
|
|
|
3725
3721
|
$ongoingTemplateResult.$resultString = parameters[jokerParameterName];
|
|
3726
3722
|
}
|
|
3727
3723
|
}
|
|
3728
|
-
|
|
3724
|
+
_t.label = 1;
|
|
3729
3725
|
case 1:
|
|
3730
|
-
|
|
3731
|
-
if (!!isJokerAttempt) return [3 /*break*/,
|
|
3726
|
+
_t.trys.push([1, 43, 44, 45]);
|
|
3727
|
+
if (!!isJokerAttempt) return [3 /*break*/, 25];
|
|
3732
3728
|
_b = template.templateType;
|
|
3733
3729
|
switch (_b) {
|
|
3734
3730
|
case 'SIMPLE_TEMPLATE': return [3 /*break*/, 2];
|
|
3735
3731
|
case 'PROMPT_TEMPLATE': return [3 /*break*/, 3];
|
|
3736
|
-
case 'SCRIPT_TEMPLATE': return [3 /*break*/,
|
|
3737
|
-
case 'DIALOG_TEMPLATE': return [3 /*break*/,
|
|
3732
|
+
case 'SCRIPT_TEMPLATE': return [3 /*break*/, 11];
|
|
3733
|
+
case 'DIALOG_TEMPLATE': return [3 /*break*/, 22];
|
|
3738
3734
|
}
|
|
3739
|
-
return [3 /*break*/,
|
|
3735
|
+
return [3 /*break*/, 24];
|
|
3740
3736
|
case 2:
|
|
3741
3737
|
$ongoingTemplateResult.$resultString = replaceParameters(preparedContent, parameters);
|
|
3742
|
-
return [3 /*break*/,
|
|
3738
|
+
return [3 /*break*/, 25];
|
|
3743
3739
|
case 3:
|
|
3744
3740
|
modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (template.modelRequirements || {}));
|
|
3745
3741
|
$ongoingTemplateResult.$prompt = {
|
|
@@ -3764,67 +3760,57 @@
|
|
|
3764
3760
|
case 'COMPLETION': return [3 /*break*/, 6];
|
|
3765
3761
|
case 'EMBEDDING': return [3 /*break*/, 8];
|
|
3766
3762
|
}
|
|
3767
|
-
return [3 /*break*/,
|
|
3763
|
+
return [3 /*break*/, 9];
|
|
3768
3764
|
case 4:
|
|
3769
3765
|
_d = $ongoingTemplateResult;
|
|
3770
3766
|
return [4 /*yield*/, llmTools.callChatModel($deepFreeze($ongoingTemplateResult.$prompt))];
|
|
3771
3767
|
case 5:
|
|
3772
|
-
_d.$chatResult =
|
|
3768
|
+
_d.$chatResult = _t.sent();
|
|
3773
3769
|
// TODO: [🍬] Destroy chatThread
|
|
3774
3770
|
$ongoingTemplateResult.$result = $ongoingTemplateResult.$chatResult;
|
|
3775
3771
|
$ongoingTemplateResult.$resultString = $ongoingTemplateResult.$chatResult.content;
|
|
3776
|
-
return [3 /*break*/,
|
|
3772
|
+
return [3 /*break*/, 10];
|
|
3777
3773
|
case 6:
|
|
3778
3774
|
_e = $ongoingTemplateResult;
|
|
3779
3775
|
return [4 /*yield*/, llmTools.callCompletionModel($deepFreeze($ongoingTemplateResult.$prompt))];
|
|
3780
3776
|
case 7:
|
|
3781
|
-
_e.$completionResult =
|
|
3777
|
+
_e.$completionResult = _t.sent();
|
|
3782
3778
|
$ongoingTemplateResult.$result = $ongoingTemplateResult.$completionResult;
|
|
3783
3779
|
$ongoingTemplateResult.$resultString =
|
|
3784
3780
|
$ongoingTemplateResult.$completionResult.content;
|
|
3785
|
-
return [3 /*break*/,
|
|
3786
|
-
case 8:
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
case 9:
|
|
3791
|
-
// TODO: [🧠] This is weird, embedding model can not be used such a way in the pipeline
|
|
3792
|
-
_f.$embeddingResult = _u.sent();
|
|
3793
|
-
$ongoingTemplateResult.$result = $ongoingTemplateResult.$embeddingResult;
|
|
3794
|
-
$ongoingTemplateResult.$resultString =
|
|
3795
|
-
$ongoingTemplateResult.$embeddingResult.content.join(',');
|
|
3796
|
-
return [3 /*break*/, 11];
|
|
3797
|
-
case 10: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Unknown model variant \"".concat(template.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
3798
|
-
case 11: return [3 /*break*/, 26];
|
|
3799
|
-
case 12:
|
|
3781
|
+
return [3 /*break*/, 10];
|
|
3782
|
+
case 8: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Embedding model can not be used in pipeline\n\n This should be catched during parsing\n\n ".concat(block(pipelineIdentification), "\n\n "); }));
|
|
3783
|
+
case 9: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Unknown model variant \"".concat(template.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
3784
|
+
case 10: return [3 /*break*/, 25];
|
|
3785
|
+
case 11:
|
|
3800
3786
|
if (arrayableToArray(tools.script).length === 0) {
|
|
3801
3787
|
throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n No script execution tools are available\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
3802
3788
|
}
|
|
3803
3789
|
if (!template.contentLanguage) {
|
|
3804
3790
|
throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Script language is not defined for SCRIPT TEMPLATE \"".concat(template.name, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
3805
3791
|
}
|
|
3806
|
-
|
|
3792
|
+
_t.label = 12;
|
|
3793
|
+
case 12:
|
|
3794
|
+
_t.trys.push([12, 19, 20, 21]);
|
|
3795
|
+
_f = (e_1 = void 0, __values(arrayableToArray(tools.script))), _g = _f.next();
|
|
3796
|
+
_t.label = 13;
|
|
3807
3797
|
case 13:
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3798
|
+
if (!!_g.done) return [3 /*break*/, 18];
|
|
3799
|
+
scriptTools = _g.value;
|
|
3800
|
+
_t.label = 14;
|
|
3811
3801
|
case 14:
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
_u.label = 15;
|
|
3815
|
-
case 15:
|
|
3816
|
-
_u.trys.push([15, 17, , 18]);
|
|
3817
|
-
_j = $ongoingTemplateResult;
|
|
3802
|
+
_t.trys.push([14, 16, , 17]);
|
|
3803
|
+
_h = $ongoingTemplateResult;
|
|
3818
3804
|
return [4 /*yield*/, scriptTools.execute($deepFreeze({
|
|
3819
3805
|
scriptLanguage: template.contentLanguage,
|
|
3820
3806
|
script: preparedContent,
|
|
3821
3807
|
parameters: parameters,
|
|
3822
3808
|
}))];
|
|
3809
|
+
case 15:
|
|
3810
|
+
_h.$resultString = _t.sent();
|
|
3811
|
+
return [3 /*break*/, 18];
|
|
3823
3812
|
case 16:
|
|
3824
|
-
|
|
3825
|
-
return [3 /*break*/, 19];
|
|
3826
|
-
case 17:
|
|
3827
|
-
error_1 = _u.sent();
|
|
3813
|
+
error_1 = _t.sent();
|
|
3828
3814
|
if (!(error_1 instanceof Error)) {
|
|
3829
3815
|
throw error_1;
|
|
3830
3816
|
}
|
|
@@ -3832,24 +3818,24 @@
|
|
|
3832
3818
|
throw error_1;
|
|
3833
3819
|
}
|
|
3834
3820
|
$ongoingTemplateResult.$scriptPipelineExecutionErrors.push(error_1);
|
|
3835
|
-
return [3 /*break*/,
|
|
3836
|
-
case
|
|
3837
|
-
|
|
3838
|
-
return [3 /*break*/,
|
|
3839
|
-
case
|
|
3840
|
-
case
|
|
3841
|
-
e_1_1 =
|
|
3821
|
+
return [3 /*break*/, 17];
|
|
3822
|
+
case 17:
|
|
3823
|
+
_g = _f.next();
|
|
3824
|
+
return [3 /*break*/, 13];
|
|
3825
|
+
case 18: return [3 /*break*/, 21];
|
|
3826
|
+
case 19:
|
|
3827
|
+
e_1_1 = _t.sent();
|
|
3842
3828
|
e_1 = { error: e_1_1 };
|
|
3843
|
-
return [3 /*break*/,
|
|
3844
|
-
case
|
|
3829
|
+
return [3 /*break*/, 21];
|
|
3830
|
+
case 20:
|
|
3845
3831
|
try {
|
|
3846
|
-
if (
|
|
3832
|
+
if (_g && !_g.done && (_q = _f.return)) _q.call(_f);
|
|
3847
3833
|
}
|
|
3848
3834
|
finally { if (e_1) throw e_1.error; }
|
|
3849
3835
|
return [7 /*endfinally*/];
|
|
3850
|
-
case
|
|
3836
|
+
case 21:
|
|
3851
3837
|
if ($ongoingTemplateResult.$resultString !== null) {
|
|
3852
|
-
return [3 /*break*/,
|
|
3838
|
+
return [3 /*break*/, 25];
|
|
3853
3839
|
}
|
|
3854
3840
|
if ($ongoingTemplateResult.$scriptPipelineExecutionErrors.length === 1) {
|
|
3855
3841
|
throw $ongoingTemplateResult.$scriptPipelineExecutionErrors[0];
|
|
@@ -3859,12 +3845,12 @@
|
|
|
3859
3845
|
.map(function (error) { return '- ' + error.message; })
|
|
3860
3846
|
.join('\n\n')), "\n "); }));
|
|
3861
3847
|
}
|
|
3862
|
-
case
|
|
3848
|
+
case 22:
|
|
3863
3849
|
if (tools.userInterface === undefined) {
|
|
3864
3850
|
throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n User interface tools are not available\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
3865
3851
|
}
|
|
3866
3852
|
// TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
|
|
3867
|
-
|
|
3853
|
+
_j = $ongoingTemplateResult;
|
|
3868
3854
|
return [4 /*yield*/, tools.userInterface.promptDialog($deepFreeze({
|
|
3869
3855
|
promptTitle: template.title,
|
|
3870
3856
|
promptMessage: replaceParameters(template.description || '', parameters),
|
|
@@ -3873,34 +3859,34 @@
|
|
|
3873
3859
|
placeholder: undefined,
|
|
3874
3860
|
priority: priority,
|
|
3875
3861
|
}))];
|
|
3876
|
-
case
|
|
3862
|
+
case 23:
|
|
3877
3863
|
// TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
|
|
3878
|
-
|
|
3879
|
-
return [3 /*break*/,
|
|
3880
|
-
case
|
|
3864
|
+
_j.$resultString = _t.sent();
|
|
3865
|
+
return [3 /*break*/, 25];
|
|
3866
|
+
case 24: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Unknown execution type \"".concat(template.templateType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
3867
|
+
case 25:
|
|
3868
|
+
if (!(!isJokerAttempt && template.postprocessingFunctionNames)) return [3 /*break*/, 42];
|
|
3869
|
+
_t.label = 26;
|
|
3881
3870
|
case 26:
|
|
3882
|
-
|
|
3883
|
-
|
|
3871
|
+
_t.trys.push([26, 40, 41, 42]);
|
|
3872
|
+
_k = (e_3 = void 0, __values(template.postprocessingFunctionNames)), _l = _k.next();
|
|
3873
|
+
_t.label = 27;
|
|
3884
3874
|
case 27:
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
_u.label = 28;
|
|
3888
|
-
case 28:
|
|
3889
|
-
if (!!_m.done) return [3 /*break*/, 40];
|
|
3890
|
-
functionName = _m.value;
|
|
3875
|
+
if (!!_l.done) return [3 /*break*/, 39];
|
|
3876
|
+
functionName = _l.value;
|
|
3891
3877
|
postprocessingError = null;
|
|
3892
|
-
|
|
3878
|
+
_t.label = 28;
|
|
3879
|
+
case 28:
|
|
3880
|
+
_t.trys.push([28, 35, 36, 37]);
|
|
3881
|
+
_m = (e_2 = void 0, __values(arrayableToArray(tools.script))), _o = _m.next();
|
|
3882
|
+
_t.label = 29;
|
|
3893
3883
|
case 29:
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3884
|
+
if (!!_o.done) return [3 /*break*/, 34];
|
|
3885
|
+
scriptTools = _o.value;
|
|
3886
|
+
_t.label = 30;
|
|
3897
3887
|
case 30:
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
_u.label = 31;
|
|
3901
|
-
case 31:
|
|
3902
|
-
_u.trys.push([31, 33, , 34]);
|
|
3903
|
-
_q = $ongoingTemplateResult;
|
|
3888
|
+
_t.trys.push([30, 32, , 33]);
|
|
3889
|
+
_p = $ongoingTemplateResult;
|
|
3904
3890
|
return [4 /*yield*/, scriptTools.execute({
|
|
3905
3891
|
scriptLanguage: "javascript" /* <- TODO: Try it in each languages; In future allow postprocessing with arbitrary combination of languages to combine */,
|
|
3906
3892
|
script: "".concat(functionName, "(resultString)"),
|
|
@@ -3909,12 +3895,12 @@
|
|
|
3909
3895
|
// Note: No ...parametersForTemplate, because working with result only
|
|
3910
3896
|
},
|
|
3911
3897
|
})];
|
|
3912
|
-
case
|
|
3913
|
-
|
|
3898
|
+
case 31:
|
|
3899
|
+
_p.$resultString = _t.sent();
|
|
3914
3900
|
postprocessingError = null;
|
|
3915
|
-
return [3 /*break*/,
|
|
3916
|
-
case
|
|
3917
|
-
error_2 =
|
|
3901
|
+
return [3 /*break*/, 34];
|
|
3902
|
+
case 32:
|
|
3903
|
+
error_2 = _t.sent();
|
|
3918
3904
|
if (!(error_2 instanceof Error)) {
|
|
3919
3905
|
throw error_2;
|
|
3920
3906
|
}
|
|
@@ -3923,41 +3909,41 @@
|
|
|
3923
3909
|
}
|
|
3924
3910
|
postprocessingError = error_2;
|
|
3925
3911
|
$ongoingTemplateResult.$scriptPipelineExecutionErrors.push(error_2);
|
|
3926
|
-
return [3 /*break*/,
|
|
3927
|
-
case
|
|
3928
|
-
|
|
3929
|
-
return [3 /*break*/,
|
|
3930
|
-
case
|
|
3931
|
-
case
|
|
3932
|
-
e_2_1 =
|
|
3912
|
+
return [3 /*break*/, 33];
|
|
3913
|
+
case 33:
|
|
3914
|
+
_o = _m.next();
|
|
3915
|
+
return [3 /*break*/, 29];
|
|
3916
|
+
case 34: return [3 /*break*/, 37];
|
|
3917
|
+
case 35:
|
|
3918
|
+
e_2_1 = _t.sent();
|
|
3933
3919
|
e_2 = { error: e_2_1 };
|
|
3934
|
-
return [3 /*break*/,
|
|
3935
|
-
case
|
|
3920
|
+
return [3 /*break*/, 37];
|
|
3921
|
+
case 36:
|
|
3936
3922
|
try {
|
|
3937
|
-
if (
|
|
3923
|
+
if (_o && !_o.done && (_s = _m.return)) _s.call(_m);
|
|
3938
3924
|
}
|
|
3939
3925
|
finally { if (e_2) throw e_2.error; }
|
|
3940
3926
|
return [7 /*endfinally*/];
|
|
3941
|
-
case
|
|
3927
|
+
case 37:
|
|
3942
3928
|
if (postprocessingError) {
|
|
3943
3929
|
throw postprocessingError;
|
|
3944
3930
|
}
|
|
3945
|
-
|
|
3946
|
-
case
|
|
3947
|
-
|
|
3948
|
-
return [3 /*break*/,
|
|
3949
|
-
case
|
|
3950
|
-
case
|
|
3951
|
-
e_3_1 =
|
|
3931
|
+
_t.label = 38;
|
|
3932
|
+
case 38:
|
|
3933
|
+
_l = _k.next();
|
|
3934
|
+
return [3 /*break*/, 27];
|
|
3935
|
+
case 39: return [3 /*break*/, 42];
|
|
3936
|
+
case 40:
|
|
3937
|
+
e_3_1 = _t.sent();
|
|
3952
3938
|
e_3 = { error: e_3_1 };
|
|
3953
|
-
return [3 /*break*/,
|
|
3954
|
-
case
|
|
3939
|
+
return [3 /*break*/, 42];
|
|
3940
|
+
case 41:
|
|
3955
3941
|
try {
|
|
3956
|
-
if (
|
|
3942
|
+
if (_l && !_l.done && (_r = _k.return)) _r.call(_k);
|
|
3957
3943
|
}
|
|
3958
3944
|
finally { if (e_3) throw e_3.error; }
|
|
3959
3945
|
return [7 /*endfinally*/];
|
|
3960
|
-
case
|
|
3946
|
+
case 42:
|
|
3961
3947
|
// TODO: [💝] Unite object for expecting amount and format
|
|
3962
3948
|
if (template.format) {
|
|
3963
3949
|
if (template.format === 'JSON') {
|
|
@@ -3982,14 +3968,14 @@
|
|
|
3982
3968
|
checkExpectations(template.expectations, $ongoingTemplateResult.$resultString || '');
|
|
3983
3969
|
}
|
|
3984
3970
|
return [2 /*return*/, "break-attempts"];
|
|
3985
|
-
case
|
|
3986
|
-
error_3 =
|
|
3971
|
+
case 43:
|
|
3972
|
+
error_3 = _t.sent();
|
|
3987
3973
|
if (!(error_3 instanceof ExpectError)) {
|
|
3988
3974
|
throw error_3;
|
|
3989
3975
|
}
|
|
3990
3976
|
$ongoingTemplateResult.$expectError = error_3;
|
|
3991
|
-
return [3 /*break*/,
|
|
3992
|
-
case
|
|
3977
|
+
return [3 /*break*/, 45];
|
|
3978
|
+
case 44:
|
|
3993
3979
|
if (!isJokerAttempt &&
|
|
3994
3980
|
template.templateType === 'PROMPT_TEMPLATE' &&
|
|
3995
3981
|
$ongoingTemplateResult.$prompt
|
|
@@ -4006,7 +3992,7 @@
|
|
|
4006
3992
|
});
|
|
4007
3993
|
}
|
|
4008
3994
|
return [7 /*endfinally*/];
|
|
4009
|
-
case
|
|
3995
|
+
case 45:
|
|
4010
3996
|
if ($ongoingTemplateResult.$expectError !== null && attempt === maxAttempts - 1) {
|
|
4011
3997
|
throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) {
|
|
4012
3998
|
var _a, _b, _c;
|
|
@@ -4062,12 +4048,12 @@
|
|
|
4062
4048
|
*/
|
|
4063
4049
|
function executeFormatCells(options) {
|
|
4064
4050
|
return __awaiter(this, void 0, void 0, function () {
|
|
4065
|
-
var template, jokerParameterNames, parameters, priority, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, resultString;
|
|
4051
|
+
var template, jokerParameterNames, parameters, priority, pipelineIdentification, settings, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
|
|
4066
4052
|
var _this = this;
|
|
4067
4053
|
return __generator(this, function (_a) {
|
|
4068
4054
|
switch (_a.label) {
|
|
4069
4055
|
case 0:
|
|
4070
|
-
template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, pipelineIdentification = options.pipelineIdentification;
|
|
4056
|
+
template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, pipelineIdentification = options.pipelineIdentification, settings = options.settings;
|
|
4071
4057
|
if (template.foreach === undefined) {
|
|
4072
4058
|
return [2 /*return*/, /* not await */ executeAttempts(options)];
|
|
4073
4059
|
}
|
|
@@ -4096,11 +4082,17 @@
|
|
|
4096
4082
|
.map(function (subvalueName) { return "- ".concat(subvalueName); })
|
|
4097
4083
|
.join('\n')), "\n\n [\u26F7] This should never happen because cell name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
4098
4084
|
}
|
|
4099
|
-
|
|
4085
|
+
if (formatDefinition.formatName === 'CSV') {
|
|
4086
|
+
formatSettings = settings.csvSettings;
|
|
4087
|
+
// <- TODO: !!!!!! More universal, make simmilar pattern for other formats for example \n vs \r\n in text
|
|
4088
|
+
}
|
|
4089
|
+
return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
4100
4090
|
var mappedParameters, allSubparameters, subresultString;
|
|
4101
4091
|
return __generator(this, function (_a) {
|
|
4102
4092
|
switch (_a.label) {
|
|
4103
4093
|
case 0:
|
|
4094
|
+
// TODO: !!!!!!! Limit to N concurrent executions
|
|
4095
|
+
// TODO: !!!!!!! Report progress
|
|
4104
4096
|
try {
|
|
4105
4097
|
mappedParameters = mapAvailableToExpectedParameters({
|
|
4106
4098
|
expectedParameters: Object.fromEntries(template.foreach.subparameterNames.map(function (subparameterName) { return [subparameterName, null]; })),
|
|
@@ -4731,7 +4723,7 @@
|
|
|
4731
4723
|
function createPipelineExecutor(options) {
|
|
4732
4724
|
var _this = this;
|
|
4733
4725
|
var pipeline = options.pipeline, tools = options.tools, _a = options.settings, settings = _a === void 0 ? {} : _a;
|
|
4734
|
-
var _b = settings.maxExecutionAttempts, maxExecutionAttempts = _b === void 0 ? MAX_EXECUTION_ATTEMPTS : _b, _c = settings.maxParallelCount, maxParallelCount = _c === void 0 ? MAX_PARALLEL_COUNT : _c, _d = settings.
|
|
4726
|
+
var _b = settings.maxExecutionAttempts, maxExecutionAttempts = _b === void 0 ? MAX_EXECUTION_ATTEMPTS : _b, _c = settings.maxParallelCount, maxParallelCount = _c === void 0 ? MAX_PARALLEL_COUNT : _c, _d = settings.csvSettings, csvSettings = _d === void 0 ? DEFAULT_CSV_SETTINGS : _d, _e = settings.isVerbose, isVerbose = _e === void 0 ? IS_VERBOSE : _e, _f = settings.isNotPreparedWarningSupressed, isNotPreparedWarningSupressed = _f === void 0 ? false : _f;
|
|
4735
4727
|
validatePipeline(pipeline);
|
|
4736
4728
|
var pipelineIdentification = (function () {
|
|
4737
4729
|
// Note: This is a 😐 implementation of [🚞]
|
|
@@ -4766,6 +4758,7 @@
|
|
|
4766
4758
|
settings: {
|
|
4767
4759
|
maxExecutionAttempts: maxExecutionAttempts,
|
|
4768
4760
|
maxParallelCount: maxParallelCount,
|
|
4761
|
+
csvSettings: csvSettings,
|
|
4769
4762
|
isVerbose: isVerbose,
|
|
4770
4763
|
isNotPreparedWarningSupressed: isNotPreparedWarningSupressed,
|
|
4771
4764
|
},
|
|
@@ -4883,8 +4876,13 @@
|
|
|
4883
4876
|
case 6: return [3 /*break*/, 8];
|
|
4884
4877
|
case 7:
|
|
4885
4878
|
error_1 = _c.sent();
|
|
4879
|
+
// Note: Here is expected error:
|
|
4880
|
+
// > PipelineExecutionError: You have not provided any `LlmExecutionTools` that support model variant "EMBEDDING
|
|
4881
|
+
if (!(error_1 instanceof PipelineExecutionError)) {
|
|
4882
|
+
throw error_1;
|
|
4883
|
+
}
|
|
4886
4884
|
// TODO: [🟥] Detect browser / node and make it colorfull
|
|
4887
|
-
console.error(error_1);
|
|
4885
|
+
console.error(error_1, "<- Note: This error is not critical to prepare the pipeline, just knowledge pieces won't have embeddings");
|
|
4888
4886
|
return [3 /*break*/, 8];
|
|
4889
4887
|
case 8: return [2 /*return*/, {
|
|
4890
4888
|
name: name,
|
|
@@ -6369,6 +6367,9 @@
|
|
|
6369
6367
|
*/
|
|
6370
6368
|
parse: function (input) {
|
|
6371
6369
|
var args = input.args, normalized = input.normalized;
|
|
6370
|
+
var availableVariantsMessage = spaceTrim__default["default"](function (block) { return "\n Available variants are:\n ".concat(block(MODEL_VARIANTS.map(function (variantName) {
|
|
6371
|
+
return "- ".concat(variantName).concat(variantName !== 'EMBEDDING' ? '' : ' (Not available in pipeline)');
|
|
6372
|
+
}).join('\n')), "\n "); });
|
|
6372
6373
|
// TODO: Make this more elegant and dynamically
|
|
6373
6374
|
if (normalized.startsWith('MODEL_VARIANT')) {
|
|
6374
6375
|
if (normalized === 'MODEL_VARIANT_CHAT') {
|
|
@@ -6384,17 +6385,13 @@
|
|
|
6384
6385
|
key: 'modelVariant',
|
|
6385
6386
|
value: 'COMPLETION',
|
|
6386
6387
|
};
|
|
6388
|
+
// <- Note: [🤖]
|
|
6387
6389
|
}
|
|
6388
6390
|
else if (normalized.startsWith('MODEL_VARIANT_EMBED')) {
|
|
6389
|
-
return
|
|
6390
|
-
type: 'MODEL',
|
|
6391
|
-
key: 'modelVariant',
|
|
6392
|
-
value: 'EMBEDDING',
|
|
6393
|
-
};
|
|
6394
|
-
// <- Note: [🤖]
|
|
6391
|
+
spaceTrim__default["default"](function (block) { return "\n Embedding model can not be used in pipeline\n\n ".concat(block(availableVariantsMessage), "\n "); });
|
|
6395
6392
|
}
|
|
6396
6393
|
else {
|
|
6397
|
-
throw new ParseError(spaceTrim__default["default"](function (block) { return "\n Unknown model variant in command:\n\n
|
|
6394
|
+
throw new ParseError(spaceTrim__default["default"](function (block) { return "\n Unknown model variant in command:\n\n ".concat(block(availableVariantsMessage), "\n "); }));
|
|
6398
6395
|
}
|
|
6399
6396
|
}
|
|
6400
6397
|
if (normalized.startsWith('MODEL_NAME')) {
|
|
@@ -9234,6 +9231,7 @@
|
|
|
9234
9231
|
exports.CallbackInterfaceTools = CallbackInterfaceTools;
|
|
9235
9232
|
exports.CollectionError = CollectionError;
|
|
9236
9233
|
exports.CsvFormatDefinition = CsvFormatDefinition;
|
|
9234
|
+
exports.DEFAULT_CSV_SETTINGS = DEFAULT_CSV_SETTINGS;
|
|
9237
9235
|
exports.DEFAULT_REMOTE_URL = DEFAULT_REMOTE_URL;
|
|
9238
9236
|
exports.DEFAULT_REMOTE_URL_PATH = DEFAULT_REMOTE_URL_PATH;
|
|
9239
9237
|
exports.ERRORS = ERRORS;
|
|
@@ -9244,6 +9242,7 @@
|
|
|
9244
9242
|
exports.ExpectError = ExpectError;
|
|
9245
9243
|
exports.IS_VERBOSE = IS_VERBOSE;
|
|
9246
9244
|
exports.LimitReachedError = LimitReachedError;
|
|
9245
|
+
exports.MANDATORY_CSV_SETTINGS = MANDATORY_CSV_SETTINGS;
|
|
9247
9246
|
exports.MAX_EXECUTION_ATTEMPTS = MAX_EXECUTION_ATTEMPTS;
|
|
9248
9247
|
exports.MAX_FILENAME_LENGTH = MAX_FILENAME_LENGTH;
|
|
9249
9248
|
exports.MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH = MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH;
|