@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/esm/index.es.js
CHANGED
|
@@ -11,7 +11,7 @@ import moment from 'moment';
|
|
|
11
11
|
/**
|
|
12
12
|
* The version of the Promptbook library
|
|
13
13
|
*/
|
|
14
|
-
var PROMPTBOOK_VERSION = '0.69.0-
|
|
14
|
+
var PROMPTBOOK_VERSION = '0.69.0-12';
|
|
15
15
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
16
16
|
|
|
17
17
|
/*! *****************************************************************************
|
|
@@ -748,6 +748,17 @@ var DEFAULT_REMOTE_URL = 'https://api.pavolhejny.com/';
|
|
|
748
748
|
*/
|
|
749
749
|
var DEFAULT_REMOTE_URL_PATH = '/promptbook/socket.io';
|
|
750
750
|
// <- TODO: [🧜♂️]
|
|
751
|
+
/**
|
|
752
|
+
* @@@
|
|
753
|
+
*
|
|
754
|
+
* @public exported from `@promptbook/core`
|
|
755
|
+
*/
|
|
756
|
+
var DEFAULT_CSV_SETTINGS = Object.freeze({
|
|
757
|
+
delimiter: ',',
|
|
758
|
+
quoteChar: '"',
|
|
759
|
+
newline: '\n',
|
|
760
|
+
skipEmptyLines: true,
|
|
761
|
+
});
|
|
751
762
|
/**
|
|
752
763
|
* @@@
|
|
753
764
|
*
|
|
@@ -1819,7 +1830,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
1819
1830
|
});
|
|
1820
1831
|
}
|
|
1821
1832
|
|
|
1822
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.69.0-
|
|
1833
|
+
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"}];
|
|
1823
1834
|
|
|
1824
1835
|
var defaultDiacriticsRemovalMap = [
|
|
1825
1836
|
{
|
|
@@ -2622,9 +2633,7 @@ var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
|
2622
2633
|
throw new PipelineExecutionError("You have not provided any `LlmExecutionTools`");
|
|
2623
2634
|
}
|
|
2624
2635
|
else {
|
|
2625
|
-
throw new PipelineExecutionError(spaceTrim(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
|
|
2626
|
-
.map(function (tools) { return "- ".concat(tools.title, " ").concat(tools.description || ''); })
|
|
2627
|
-
.join('\n')), "\n\n "); }));
|
|
2636
|
+
throw new PipelineExecutionError(spaceTrim(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 "); }));
|
|
2628
2637
|
}
|
|
2629
2638
|
}
|
|
2630
2639
|
});
|
|
@@ -2930,6 +2939,16 @@ function TODO_USE() {
|
|
|
2930
2939
|
}
|
|
2931
2940
|
}
|
|
2932
2941
|
|
|
2942
|
+
/**
|
|
2943
|
+
* @@@
|
|
2944
|
+
*
|
|
2945
|
+
* @public exported from `@promptbook/core`
|
|
2946
|
+
*/
|
|
2947
|
+
var MANDATORY_CSV_SETTINGS = Object.freeze({
|
|
2948
|
+
header: true,
|
|
2949
|
+
// encoding: 'utf8',
|
|
2950
|
+
});
|
|
2951
|
+
|
|
2933
2952
|
/**
|
|
2934
2953
|
* Definition for CSV spreadsheet
|
|
2935
2954
|
*
|
|
@@ -2939,41 +2958,36 @@ function TODO_USE() {
|
|
|
2939
2958
|
var CsvFormatDefinition = {
|
|
2940
2959
|
formatName: 'CSV',
|
|
2941
2960
|
aliases: ['SPREADSHEET', 'TABLE'],
|
|
2942
|
-
isValid: function (value, schema) {
|
|
2961
|
+
isValid: function (value, settings, schema) {
|
|
2962
|
+
// TODO: !!!!!! Implement CSV validation
|
|
2943
2963
|
TODO_USE(value /* <- TODO: Use value here */);
|
|
2964
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2944
2965
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2945
2966
|
return true;
|
|
2946
2967
|
},
|
|
2947
|
-
canBeValid: function (partialValue, schema) {
|
|
2968
|
+
canBeValid: function (partialValue, settings, schema) {
|
|
2948
2969
|
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
2970
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2949
2971
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2950
2972
|
return true;
|
|
2951
2973
|
},
|
|
2952
|
-
heal: function (value, schema) {
|
|
2974
|
+
heal: function (value, settings, schema) {
|
|
2953
2975
|
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
2976
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2954
2977
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2955
2978
|
throw new Error('Not implemented');
|
|
2956
2979
|
},
|
|
2957
2980
|
subvalueDefinitions: [
|
|
2958
2981
|
{
|
|
2959
2982
|
subvalueName: 'ROW',
|
|
2960
|
-
mapValues: function (value, mapCallback) {
|
|
2983
|
+
mapValues: function (value, settings, mapCallback) {
|
|
2961
2984
|
return __awaiter(this, void 0, void 0, function () {
|
|
2962
2985
|
var csv, mappedData;
|
|
2963
2986
|
var _this = this;
|
|
2964
2987
|
return __generator(this, function (_a) {
|
|
2965
2988
|
switch (_a.label) {
|
|
2966
2989
|
case 0:
|
|
2967
|
-
csv = parse(value, {
|
|
2968
|
-
header: true,
|
|
2969
|
-
delimiter: ',',
|
|
2970
|
-
quoteChar: '"',
|
|
2971
|
-
newline: '\r\n',
|
|
2972
|
-
skipEmptyLines: true,
|
|
2973
|
-
// encoding: 'utf8',
|
|
2974
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
2975
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
2976
|
-
});
|
|
2990
|
+
csv = parse(value, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS));
|
|
2977
2991
|
if (csv.errors.length !== 0) {
|
|
2978
2992
|
throw new ParseError(// <- TODO: !!!!!! Split PipelineParseError and FormatParseError -> CsvParseError
|
|
2979
2993
|
spaceTrim(function (block) { return "\n CSV parsing error\n\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n "); }));
|
|
@@ -2987,25 +3001,18 @@ var CsvFormatDefinition = {
|
|
|
2987
3001
|
_a = [__assign({}, row)];
|
|
2988
3002
|
_b = {};
|
|
2989
3003
|
// <- TODO: !!!!!! Dynamic new column name and position
|
|
3004
|
+
// <- TODO: !!!!!! Check name collisions
|
|
2990
3005
|
return [4 /*yield*/, mapCallback(row, index)];
|
|
2991
3006
|
case 1: return [2 /*return*/, (__assign.apply(void 0, _a.concat([(_b.newColumn =
|
|
2992
3007
|
// <- TODO: !!!!!! Dynamic new column name and position
|
|
3008
|
+
// <- TODO: !!!!!! Check name collisions
|
|
2993
3009
|
_c.sent(), _b)])))];
|
|
2994
3010
|
}
|
|
2995
3011
|
});
|
|
2996
3012
|
}); }))];
|
|
2997
3013
|
case 1:
|
|
2998
3014
|
mappedData = _a.sent();
|
|
2999
|
-
return [2 /*return*/, unparse(mappedData, {
|
|
3000
|
-
header: true,
|
|
3001
|
-
delimiter: ',',
|
|
3002
|
-
quoteChar: '"',
|
|
3003
|
-
newline: '\r\n',
|
|
3004
|
-
skipEmptyLines: true,
|
|
3005
|
-
// encoding: 'utf8',
|
|
3006
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
3007
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
3008
|
-
})];
|
|
3015
|
+
return [2 /*return*/, unparse(mappedData, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS))];
|
|
3009
3016
|
}
|
|
3010
3017
|
});
|
|
3011
3018
|
});
|
|
@@ -3013,23 +3020,14 @@ var CsvFormatDefinition = {
|
|
|
3013
3020
|
},
|
|
3014
3021
|
{
|
|
3015
3022
|
subvalueName: 'CELL',
|
|
3016
|
-
mapValues: function (value, mapCallback) {
|
|
3023
|
+
mapValues: function (value, settings, mapCallback) {
|
|
3017
3024
|
return __awaiter(this, void 0, void 0, function () {
|
|
3018
3025
|
var csv, mappedData;
|
|
3019
3026
|
var _this = this;
|
|
3020
3027
|
return __generator(this, function (_a) {
|
|
3021
3028
|
switch (_a.label) {
|
|
3022
3029
|
case 0:
|
|
3023
|
-
csv = parse(value, {
|
|
3024
|
-
header: true,
|
|
3025
|
-
delimiter: ',',
|
|
3026
|
-
quoteChar: '"',
|
|
3027
|
-
newline: '\r\n',
|
|
3028
|
-
skipEmptyLines: true,
|
|
3029
|
-
// encoding: 'utf8',
|
|
3030
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
3031
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
3032
|
-
});
|
|
3030
|
+
csv = parse(value, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS));
|
|
3033
3031
|
if (csv.errors.length !== 0) {
|
|
3034
3032
|
throw new ParseError(// <- TODO: !!!!!! Split PipelineParseError and FormatParseError -> CsvParseError
|
|
3035
3033
|
spaceTrim(function (block) { return "\n CSV parsing error\n\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n "); }));
|
|
@@ -3052,16 +3050,7 @@ var CsvFormatDefinition = {
|
|
|
3052
3050
|
}); }))];
|
|
3053
3051
|
case 1:
|
|
3054
3052
|
mappedData = _a.sent();
|
|
3055
|
-
return [2 /*return*/, unparse(mappedData, {
|
|
3056
|
-
header: true,
|
|
3057
|
-
delimiter: ',',
|
|
3058
|
-
quoteChar: '"',
|
|
3059
|
-
newline: '\r\n',
|
|
3060
|
-
skipEmptyLines: true,
|
|
3061
|
-
// encoding: 'utf8',
|
|
3062
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
3063
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
3064
|
-
})];
|
|
3053
|
+
return [2 /*return*/, unparse(mappedData, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS))];
|
|
3065
3054
|
}
|
|
3066
3055
|
});
|
|
3067
3056
|
});
|
|
@@ -3106,17 +3095,20 @@ function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
|
3106
3095
|
var JsonFormatDefinition = {
|
|
3107
3096
|
formatName: 'JSON',
|
|
3108
3097
|
mimeType: 'application/json',
|
|
3109
|
-
isValid: function (value, schema) {
|
|
3098
|
+
isValid: function (value, settings, schema) {
|
|
3110
3099
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3100
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3111
3101
|
return isValidJsonString(value);
|
|
3112
3102
|
},
|
|
3113
|
-
canBeValid: function (partialValue, schema) {
|
|
3103
|
+
canBeValid: function (partialValue, settings, schema) {
|
|
3114
3104
|
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
3105
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3115
3106
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3116
3107
|
return true;
|
|
3117
3108
|
},
|
|
3118
|
-
heal: function (value, schema) {
|
|
3109
|
+
heal: function (value, settings, schema) {
|
|
3119
3110
|
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
3111
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3120
3112
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3121
3113
|
throw new Error('Not implemented');
|
|
3122
3114
|
},
|
|
@@ -3125,7 +3117,7 @@ var JsonFormatDefinition = {
|
|
|
3125
3117
|
/**
|
|
3126
3118
|
* TODO: [🧠] Maybe propper instance of object
|
|
3127
3119
|
* TODO: [0] Make string_serialized_json
|
|
3128
|
-
* TODO: [1] Make type for JSON Schema
|
|
3120
|
+
* TODO: [1] Make type for JSON Settings and Schema
|
|
3129
3121
|
* TODO: [🧠] What to use for validating JSONs - JSON Schema, ZoD, typescript types/interfaces,...?
|
|
3130
3122
|
* TODO: [🍓] In `JsonFormatDefinition` implement simple `isValid`
|
|
3131
3123
|
* TODO: [🍓] In `JsonFormatDefinition` implement partial `canBeValid`
|
|
@@ -3155,7 +3147,7 @@ var TextFormatDefinition = {
|
|
|
3155
3147
|
subvalueDefinitions: [
|
|
3156
3148
|
{
|
|
3157
3149
|
subvalueName: 'LINE',
|
|
3158
|
-
mapValues: function (value, mapCallback) {
|
|
3150
|
+
mapValues: function (value, settings, mapCallback) {
|
|
3159
3151
|
return __awaiter(this, void 0, void 0, function () {
|
|
3160
3152
|
var lines, mappedLines;
|
|
3161
3153
|
return __generator(this, function (_a) {
|
|
@@ -3181,6 +3173,7 @@ var TextFormatDefinition = {
|
|
|
3181
3173
|
],
|
|
3182
3174
|
};
|
|
3183
3175
|
/**
|
|
3176
|
+
* TODO: [1] Make type for XML Text and Schema
|
|
3184
3177
|
* TODO: [🧠][🤠] Here should be all words, characters, lines, paragraphs, pages aviable as subvalues
|
|
3185
3178
|
* TODO: [🍓] In `TextFormatDefinition` implement simple `isValid`
|
|
3186
3179
|
* TODO: [🍓] In `TextFormatDefinition` implement partial `canBeValid`
|
|
@@ -3197,18 +3190,21 @@ var TextFormatDefinition = {
|
|
|
3197
3190
|
var XmlFormatDefinition = {
|
|
3198
3191
|
formatName: 'XML',
|
|
3199
3192
|
mimeType: 'application/xml',
|
|
3200
|
-
isValid: function (value, schema) {
|
|
3193
|
+
isValid: function (value, settings, schema) {
|
|
3201
3194
|
TODO_USE(value /* <- TODO: Use value here */);
|
|
3195
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3202
3196
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3203
3197
|
return true;
|
|
3204
3198
|
},
|
|
3205
|
-
canBeValid: function (partialValue, schema) {
|
|
3199
|
+
canBeValid: function (partialValue, settings, schema) {
|
|
3206
3200
|
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
3201
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3207
3202
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3208
3203
|
return true;
|
|
3209
3204
|
},
|
|
3210
|
-
heal: function (value, schema) {
|
|
3205
|
+
heal: function (value, settings, schema) {
|
|
3211
3206
|
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
3207
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3212
3208
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3213
3209
|
throw new Error('Not implemented');
|
|
3214
3210
|
},
|
|
@@ -3217,7 +3213,7 @@ var XmlFormatDefinition = {
|
|
|
3217
3213
|
/**
|
|
3218
3214
|
* TODO: [🧠] Maybe propper instance of object
|
|
3219
3215
|
* TODO: [0] Make string_serialized_xml
|
|
3220
|
-
* TODO: [1] Make type for XML Schema
|
|
3216
|
+
* TODO: [1] Make type for XML Settings and Schema
|
|
3221
3217
|
* TODO: [🧠] What to use for validating XMLs - XSD,...
|
|
3222
3218
|
* TODO: [🍓] In `XmlFormatDefinition` implement simple `isValid`
|
|
3223
3219
|
* TODO: [🍓] In `XmlFormatDefinition` implement partial `canBeValid`
|
|
@@ -3697,10 +3693,10 @@ function executeAttempts(options) {
|
|
|
3697
3693
|
$scriptPipelineExecutionErrors: [],
|
|
3698
3694
|
};
|
|
3699
3695
|
_loop_1 = function (attempt) {
|
|
3700
|
-
var isJokerAttempt, jokerParameterName, _b, modelRequirements, _c, _d, _e, _f, _g,
|
|
3701
|
-
var e_1,
|
|
3702
|
-
return __generator(this, function (
|
|
3703
|
-
switch (
|
|
3696
|
+
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;
|
|
3697
|
+
var e_1, _q, e_3, _r, e_2, _s;
|
|
3698
|
+
return __generator(this, function (_t) {
|
|
3699
|
+
switch (_t.label) {
|
|
3704
3700
|
case 0:
|
|
3705
3701
|
isJokerAttempt = attempt < 0;
|
|
3706
3702
|
jokerParameterName = jokerParameterNames[jokerParameterNames.length + attempt];
|
|
@@ -3720,21 +3716,21 @@ function executeAttempts(options) {
|
|
|
3720
3716
|
$ongoingTemplateResult.$resultString = parameters[jokerParameterName];
|
|
3721
3717
|
}
|
|
3722
3718
|
}
|
|
3723
|
-
|
|
3719
|
+
_t.label = 1;
|
|
3724
3720
|
case 1:
|
|
3725
|
-
|
|
3726
|
-
if (!!isJokerAttempt) return [3 /*break*/,
|
|
3721
|
+
_t.trys.push([1, 43, 44, 45]);
|
|
3722
|
+
if (!!isJokerAttempt) return [3 /*break*/, 25];
|
|
3727
3723
|
_b = template.templateType;
|
|
3728
3724
|
switch (_b) {
|
|
3729
3725
|
case 'SIMPLE_TEMPLATE': return [3 /*break*/, 2];
|
|
3730
3726
|
case 'PROMPT_TEMPLATE': return [3 /*break*/, 3];
|
|
3731
|
-
case 'SCRIPT_TEMPLATE': return [3 /*break*/,
|
|
3732
|
-
case 'DIALOG_TEMPLATE': return [3 /*break*/,
|
|
3727
|
+
case 'SCRIPT_TEMPLATE': return [3 /*break*/, 11];
|
|
3728
|
+
case 'DIALOG_TEMPLATE': return [3 /*break*/, 22];
|
|
3733
3729
|
}
|
|
3734
|
-
return [3 /*break*/,
|
|
3730
|
+
return [3 /*break*/, 24];
|
|
3735
3731
|
case 2:
|
|
3736
3732
|
$ongoingTemplateResult.$resultString = replaceParameters(preparedContent, parameters);
|
|
3737
|
-
return [3 /*break*/,
|
|
3733
|
+
return [3 /*break*/, 25];
|
|
3738
3734
|
case 3:
|
|
3739
3735
|
modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (template.modelRequirements || {}));
|
|
3740
3736
|
$ongoingTemplateResult.$prompt = {
|
|
@@ -3759,67 +3755,57 @@ function executeAttempts(options) {
|
|
|
3759
3755
|
case 'COMPLETION': return [3 /*break*/, 6];
|
|
3760
3756
|
case 'EMBEDDING': return [3 /*break*/, 8];
|
|
3761
3757
|
}
|
|
3762
|
-
return [3 /*break*/,
|
|
3758
|
+
return [3 /*break*/, 9];
|
|
3763
3759
|
case 4:
|
|
3764
3760
|
_d = $ongoingTemplateResult;
|
|
3765
3761
|
return [4 /*yield*/, llmTools.callChatModel($deepFreeze($ongoingTemplateResult.$prompt))];
|
|
3766
3762
|
case 5:
|
|
3767
|
-
_d.$chatResult =
|
|
3763
|
+
_d.$chatResult = _t.sent();
|
|
3768
3764
|
// TODO: [🍬] Destroy chatThread
|
|
3769
3765
|
$ongoingTemplateResult.$result = $ongoingTemplateResult.$chatResult;
|
|
3770
3766
|
$ongoingTemplateResult.$resultString = $ongoingTemplateResult.$chatResult.content;
|
|
3771
|
-
return [3 /*break*/,
|
|
3767
|
+
return [3 /*break*/, 10];
|
|
3772
3768
|
case 6:
|
|
3773
3769
|
_e = $ongoingTemplateResult;
|
|
3774
3770
|
return [4 /*yield*/, llmTools.callCompletionModel($deepFreeze($ongoingTemplateResult.$prompt))];
|
|
3775
3771
|
case 7:
|
|
3776
|
-
_e.$completionResult =
|
|
3772
|
+
_e.$completionResult = _t.sent();
|
|
3777
3773
|
$ongoingTemplateResult.$result = $ongoingTemplateResult.$completionResult;
|
|
3778
3774
|
$ongoingTemplateResult.$resultString =
|
|
3779
3775
|
$ongoingTemplateResult.$completionResult.content;
|
|
3780
|
-
return [3 /*break*/,
|
|
3781
|
-
case 8:
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
case 9:
|
|
3786
|
-
// TODO: [🧠] This is weird, embedding model can not be used such a way in the pipeline
|
|
3787
|
-
_f.$embeddingResult = _u.sent();
|
|
3788
|
-
$ongoingTemplateResult.$result = $ongoingTemplateResult.$embeddingResult;
|
|
3789
|
-
$ongoingTemplateResult.$resultString =
|
|
3790
|
-
$ongoingTemplateResult.$embeddingResult.content.join(',');
|
|
3791
|
-
return [3 /*break*/, 11];
|
|
3792
|
-
case 10: throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Unknown model variant \"".concat(template.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
3793
|
-
case 11: return [3 /*break*/, 26];
|
|
3794
|
-
case 12:
|
|
3776
|
+
return [3 /*break*/, 10];
|
|
3777
|
+
case 8: throw new PipelineExecutionError(spaceTrim$1(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 "); }));
|
|
3778
|
+
case 9: throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Unknown model variant \"".concat(template.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
3779
|
+
case 10: return [3 /*break*/, 25];
|
|
3780
|
+
case 11:
|
|
3795
3781
|
if (arrayableToArray(tools.script).length === 0) {
|
|
3796
3782
|
throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n No script execution tools are available\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
3797
3783
|
}
|
|
3798
3784
|
if (!template.contentLanguage) {
|
|
3799
3785
|
throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Script language is not defined for SCRIPT TEMPLATE \"".concat(template.name, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
3800
3786
|
}
|
|
3801
|
-
|
|
3787
|
+
_t.label = 12;
|
|
3788
|
+
case 12:
|
|
3789
|
+
_t.trys.push([12, 19, 20, 21]);
|
|
3790
|
+
_f = (e_1 = void 0, __values(arrayableToArray(tools.script))), _g = _f.next();
|
|
3791
|
+
_t.label = 13;
|
|
3802
3792
|
case 13:
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3793
|
+
if (!!_g.done) return [3 /*break*/, 18];
|
|
3794
|
+
scriptTools = _g.value;
|
|
3795
|
+
_t.label = 14;
|
|
3806
3796
|
case 14:
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
_u.label = 15;
|
|
3810
|
-
case 15:
|
|
3811
|
-
_u.trys.push([15, 17, , 18]);
|
|
3812
|
-
_j = $ongoingTemplateResult;
|
|
3797
|
+
_t.trys.push([14, 16, , 17]);
|
|
3798
|
+
_h = $ongoingTemplateResult;
|
|
3813
3799
|
return [4 /*yield*/, scriptTools.execute($deepFreeze({
|
|
3814
3800
|
scriptLanguage: template.contentLanguage,
|
|
3815
3801
|
script: preparedContent,
|
|
3816
3802
|
parameters: parameters,
|
|
3817
3803
|
}))];
|
|
3804
|
+
case 15:
|
|
3805
|
+
_h.$resultString = _t.sent();
|
|
3806
|
+
return [3 /*break*/, 18];
|
|
3818
3807
|
case 16:
|
|
3819
|
-
|
|
3820
|
-
return [3 /*break*/, 19];
|
|
3821
|
-
case 17:
|
|
3822
|
-
error_1 = _u.sent();
|
|
3808
|
+
error_1 = _t.sent();
|
|
3823
3809
|
if (!(error_1 instanceof Error)) {
|
|
3824
3810
|
throw error_1;
|
|
3825
3811
|
}
|
|
@@ -3827,24 +3813,24 @@ function executeAttempts(options) {
|
|
|
3827
3813
|
throw error_1;
|
|
3828
3814
|
}
|
|
3829
3815
|
$ongoingTemplateResult.$scriptPipelineExecutionErrors.push(error_1);
|
|
3830
|
-
return [3 /*break*/,
|
|
3831
|
-
case
|
|
3832
|
-
|
|
3833
|
-
return [3 /*break*/,
|
|
3834
|
-
case
|
|
3835
|
-
case
|
|
3836
|
-
e_1_1 =
|
|
3816
|
+
return [3 /*break*/, 17];
|
|
3817
|
+
case 17:
|
|
3818
|
+
_g = _f.next();
|
|
3819
|
+
return [3 /*break*/, 13];
|
|
3820
|
+
case 18: return [3 /*break*/, 21];
|
|
3821
|
+
case 19:
|
|
3822
|
+
e_1_1 = _t.sent();
|
|
3837
3823
|
e_1 = { error: e_1_1 };
|
|
3838
|
-
return [3 /*break*/,
|
|
3839
|
-
case
|
|
3824
|
+
return [3 /*break*/, 21];
|
|
3825
|
+
case 20:
|
|
3840
3826
|
try {
|
|
3841
|
-
if (
|
|
3827
|
+
if (_g && !_g.done && (_q = _f.return)) _q.call(_f);
|
|
3842
3828
|
}
|
|
3843
3829
|
finally { if (e_1) throw e_1.error; }
|
|
3844
3830
|
return [7 /*endfinally*/];
|
|
3845
|
-
case
|
|
3831
|
+
case 21:
|
|
3846
3832
|
if ($ongoingTemplateResult.$resultString !== null) {
|
|
3847
|
-
return [3 /*break*/,
|
|
3833
|
+
return [3 /*break*/, 25];
|
|
3848
3834
|
}
|
|
3849
3835
|
if ($ongoingTemplateResult.$scriptPipelineExecutionErrors.length === 1) {
|
|
3850
3836
|
throw $ongoingTemplateResult.$scriptPipelineExecutionErrors[0];
|
|
@@ -3854,12 +3840,12 @@ function executeAttempts(options) {
|
|
|
3854
3840
|
.map(function (error) { return '- ' + error.message; })
|
|
3855
3841
|
.join('\n\n')), "\n "); }));
|
|
3856
3842
|
}
|
|
3857
|
-
case
|
|
3843
|
+
case 22:
|
|
3858
3844
|
if (tools.userInterface === undefined) {
|
|
3859
3845
|
throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n User interface tools are not available\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
3860
3846
|
}
|
|
3861
3847
|
// TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
|
|
3862
|
-
|
|
3848
|
+
_j = $ongoingTemplateResult;
|
|
3863
3849
|
return [4 /*yield*/, tools.userInterface.promptDialog($deepFreeze({
|
|
3864
3850
|
promptTitle: template.title,
|
|
3865
3851
|
promptMessage: replaceParameters(template.description || '', parameters),
|
|
@@ -3868,34 +3854,34 @@ function executeAttempts(options) {
|
|
|
3868
3854
|
placeholder: undefined,
|
|
3869
3855
|
priority: priority,
|
|
3870
3856
|
}))];
|
|
3871
|
-
case
|
|
3857
|
+
case 23:
|
|
3872
3858
|
// TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
|
|
3873
|
-
|
|
3874
|
-
return [3 /*break*/,
|
|
3875
|
-
case
|
|
3859
|
+
_j.$resultString = _t.sent();
|
|
3860
|
+
return [3 /*break*/, 25];
|
|
3861
|
+
case 24: throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Unknown execution type \"".concat(template.templateType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
3862
|
+
case 25:
|
|
3863
|
+
if (!(!isJokerAttempt && template.postprocessingFunctionNames)) return [3 /*break*/, 42];
|
|
3864
|
+
_t.label = 26;
|
|
3876
3865
|
case 26:
|
|
3877
|
-
|
|
3878
|
-
|
|
3866
|
+
_t.trys.push([26, 40, 41, 42]);
|
|
3867
|
+
_k = (e_3 = void 0, __values(template.postprocessingFunctionNames)), _l = _k.next();
|
|
3868
|
+
_t.label = 27;
|
|
3879
3869
|
case 27:
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
_u.label = 28;
|
|
3883
|
-
case 28:
|
|
3884
|
-
if (!!_m.done) return [3 /*break*/, 40];
|
|
3885
|
-
functionName = _m.value;
|
|
3870
|
+
if (!!_l.done) return [3 /*break*/, 39];
|
|
3871
|
+
functionName = _l.value;
|
|
3886
3872
|
postprocessingError = null;
|
|
3887
|
-
|
|
3873
|
+
_t.label = 28;
|
|
3874
|
+
case 28:
|
|
3875
|
+
_t.trys.push([28, 35, 36, 37]);
|
|
3876
|
+
_m = (e_2 = void 0, __values(arrayableToArray(tools.script))), _o = _m.next();
|
|
3877
|
+
_t.label = 29;
|
|
3888
3878
|
case 29:
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3879
|
+
if (!!_o.done) return [3 /*break*/, 34];
|
|
3880
|
+
scriptTools = _o.value;
|
|
3881
|
+
_t.label = 30;
|
|
3892
3882
|
case 30:
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
_u.label = 31;
|
|
3896
|
-
case 31:
|
|
3897
|
-
_u.trys.push([31, 33, , 34]);
|
|
3898
|
-
_q = $ongoingTemplateResult;
|
|
3883
|
+
_t.trys.push([30, 32, , 33]);
|
|
3884
|
+
_p = $ongoingTemplateResult;
|
|
3899
3885
|
return [4 /*yield*/, scriptTools.execute({
|
|
3900
3886
|
scriptLanguage: "javascript" /* <- TODO: Try it in each languages; In future allow postprocessing with arbitrary combination of languages to combine */,
|
|
3901
3887
|
script: "".concat(functionName, "(resultString)"),
|
|
@@ -3904,12 +3890,12 @@ function executeAttempts(options) {
|
|
|
3904
3890
|
// Note: No ...parametersForTemplate, because working with result only
|
|
3905
3891
|
},
|
|
3906
3892
|
})];
|
|
3907
|
-
case
|
|
3908
|
-
|
|
3893
|
+
case 31:
|
|
3894
|
+
_p.$resultString = _t.sent();
|
|
3909
3895
|
postprocessingError = null;
|
|
3910
|
-
return [3 /*break*/,
|
|
3911
|
-
case
|
|
3912
|
-
error_2 =
|
|
3896
|
+
return [3 /*break*/, 34];
|
|
3897
|
+
case 32:
|
|
3898
|
+
error_2 = _t.sent();
|
|
3913
3899
|
if (!(error_2 instanceof Error)) {
|
|
3914
3900
|
throw error_2;
|
|
3915
3901
|
}
|
|
@@ -3918,41 +3904,41 @@ function executeAttempts(options) {
|
|
|
3918
3904
|
}
|
|
3919
3905
|
postprocessingError = error_2;
|
|
3920
3906
|
$ongoingTemplateResult.$scriptPipelineExecutionErrors.push(error_2);
|
|
3921
|
-
return [3 /*break*/,
|
|
3922
|
-
case
|
|
3923
|
-
|
|
3924
|
-
return [3 /*break*/,
|
|
3925
|
-
case
|
|
3926
|
-
case
|
|
3927
|
-
e_2_1 =
|
|
3907
|
+
return [3 /*break*/, 33];
|
|
3908
|
+
case 33:
|
|
3909
|
+
_o = _m.next();
|
|
3910
|
+
return [3 /*break*/, 29];
|
|
3911
|
+
case 34: return [3 /*break*/, 37];
|
|
3912
|
+
case 35:
|
|
3913
|
+
e_2_1 = _t.sent();
|
|
3928
3914
|
e_2 = { error: e_2_1 };
|
|
3929
|
-
return [3 /*break*/,
|
|
3930
|
-
case
|
|
3915
|
+
return [3 /*break*/, 37];
|
|
3916
|
+
case 36:
|
|
3931
3917
|
try {
|
|
3932
|
-
if (
|
|
3918
|
+
if (_o && !_o.done && (_s = _m.return)) _s.call(_m);
|
|
3933
3919
|
}
|
|
3934
3920
|
finally { if (e_2) throw e_2.error; }
|
|
3935
3921
|
return [7 /*endfinally*/];
|
|
3936
|
-
case
|
|
3922
|
+
case 37:
|
|
3937
3923
|
if (postprocessingError) {
|
|
3938
3924
|
throw postprocessingError;
|
|
3939
3925
|
}
|
|
3940
|
-
|
|
3941
|
-
case
|
|
3942
|
-
|
|
3943
|
-
return [3 /*break*/,
|
|
3944
|
-
case
|
|
3945
|
-
case
|
|
3946
|
-
e_3_1 =
|
|
3926
|
+
_t.label = 38;
|
|
3927
|
+
case 38:
|
|
3928
|
+
_l = _k.next();
|
|
3929
|
+
return [3 /*break*/, 27];
|
|
3930
|
+
case 39: return [3 /*break*/, 42];
|
|
3931
|
+
case 40:
|
|
3932
|
+
e_3_1 = _t.sent();
|
|
3947
3933
|
e_3 = { error: e_3_1 };
|
|
3948
|
-
return [3 /*break*/,
|
|
3949
|
-
case
|
|
3934
|
+
return [3 /*break*/, 42];
|
|
3935
|
+
case 41:
|
|
3950
3936
|
try {
|
|
3951
|
-
if (
|
|
3937
|
+
if (_l && !_l.done && (_r = _k.return)) _r.call(_k);
|
|
3952
3938
|
}
|
|
3953
3939
|
finally { if (e_3) throw e_3.error; }
|
|
3954
3940
|
return [7 /*endfinally*/];
|
|
3955
|
-
case
|
|
3941
|
+
case 42:
|
|
3956
3942
|
// TODO: [💝] Unite object for expecting amount and format
|
|
3957
3943
|
if (template.format) {
|
|
3958
3944
|
if (template.format === 'JSON') {
|
|
@@ -3977,14 +3963,14 @@ function executeAttempts(options) {
|
|
|
3977
3963
|
checkExpectations(template.expectations, $ongoingTemplateResult.$resultString || '');
|
|
3978
3964
|
}
|
|
3979
3965
|
return [2 /*return*/, "break-attempts"];
|
|
3980
|
-
case
|
|
3981
|
-
error_3 =
|
|
3966
|
+
case 43:
|
|
3967
|
+
error_3 = _t.sent();
|
|
3982
3968
|
if (!(error_3 instanceof ExpectError)) {
|
|
3983
3969
|
throw error_3;
|
|
3984
3970
|
}
|
|
3985
3971
|
$ongoingTemplateResult.$expectError = error_3;
|
|
3986
|
-
return [3 /*break*/,
|
|
3987
|
-
case
|
|
3972
|
+
return [3 /*break*/, 45];
|
|
3973
|
+
case 44:
|
|
3988
3974
|
if (!isJokerAttempt &&
|
|
3989
3975
|
template.templateType === 'PROMPT_TEMPLATE' &&
|
|
3990
3976
|
$ongoingTemplateResult.$prompt
|
|
@@ -4001,7 +3987,7 @@ function executeAttempts(options) {
|
|
|
4001
3987
|
});
|
|
4002
3988
|
}
|
|
4003
3989
|
return [7 /*endfinally*/];
|
|
4004
|
-
case
|
|
3990
|
+
case 45:
|
|
4005
3991
|
if ($ongoingTemplateResult.$expectError !== null && attempt === maxAttempts - 1) {
|
|
4006
3992
|
throw new PipelineExecutionError(spaceTrim$1(function (block) {
|
|
4007
3993
|
var _a, _b, _c;
|
|
@@ -4057,12 +4043,12 @@ function executeAttempts(options) {
|
|
|
4057
4043
|
*/
|
|
4058
4044
|
function executeFormatCells(options) {
|
|
4059
4045
|
return __awaiter(this, void 0, void 0, function () {
|
|
4060
|
-
var template, jokerParameterNames, parameters, priority, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, resultString;
|
|
4046
|
+
var template, jokerParameterNames, parameters, priority, pipelineIdentification, settings, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
|
|
4061
4047
|
var _this = this;
|
|
4062
4048
|
return __generator(this, function (_a) {
|
|
4063
4049
|
switch (_a.label) {
|
|
4064
4050
|
case 0:
|
|
4065
|
-
template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, pipelineIdentification = options.pipelineIdentification;
|
|
4051
|
+
template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, pipelineIdentification = options.pipelineIdentification, settings = options.settings;
|
|
4066
4052
|
if (template.foreach === undefined) {
|
|
4067
4053
|
return [2 /*return*/, /* not await */ executeAttempts(options)];
|
|
4068
4054
|
}
|
|
@@ -4091,11 +4077,17 @@ function executeFormatCells(options) {
|
|
|
4091
4077
|
.map(function (subvalueName) { return "- ".concat(subvalueName); })
|
|
4092
4078
|
.join('\n')), "\n\n [\u26F7] This should never happen because cell name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
4093
4079
|
}
|
|
4094
|
-
|
|
4080
|
+
if (formatDefinition.formatName === 'CSV') {
|
|
4081
|
+
formatSettings = settings.csvSettings;
|
|
4082
|
+
// <- TODO: !!!!!! More universal, make simmilar pattern for other formats for example \n vs \r\n in text
|
|
4083
|
+
}
|
|
4084
|
+
return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
4095
4085
|
var mappedParameters, allSubparameters, subresultString;
|
|
4096
4086
|
return __generator(this, function (_a) {
|
|
4097
4087
|
switch (_a.label) {
|
|
4098
4088
|
case 0:
|
|
4089
|
+
// TODO: !!!!!!! Limit to N concurrent executions
|
|
4090
|
+
// TODO: !!!!!!! Report progress
|
|
4099
4091
|
try {
|
|
4100
4092
|
mappedParameters = mapAvailableToExpectedParameters({
|
|
4101
4093
|
expectedParameters: Object.fromEntries(template.foreach.subparameterNames.map(function (subparameterName) { return [subparameterName, null]; })),
|
|
@@ -4726,7 +4718,7 @@ function executePipeline(options) {
|
|
|
4726
4718
|
function createPipelineExecutor(options) {
|
|
4727
4719
|
var _this = this;
|
|
4728
4720
|
var pipeline = options.pipeline, tools = options.tools, _a = options.settings, settings = _a === void 0 ? {} : _a;
|
|
4729
|
-
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.
|
|
4721
|
+
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;
|
|
4730
4722
|
validatePipeline(pipeline);
|
|
4731
4723
|
var pipelineIdentification = (function () {
|
|
4732
4724
|
// Note: This is a 😐 implementation of [🚞]
|
|
@@ -4761,6 +4753,7 @@ function createPipelineExecutor(options) {
|
|
|
4761
4753
|
settings: {
|
|
4762
4754
|
maxExecutionAttempts: maxExecutionAttempts,
|
|
4763
4755
|
maxParallelCount: maxParallelCount,
|
|
4756
|
+
csvSettings: csvSettings,
|
|
4764
4757
|
isVerbose: isVerbose,
|
|
4765
4758
|
isNotPreparedWarningSupressed: isNotPreparedWarningSupressed,
|
|
4766
4759
|
},
|
|
@@ -4878,8 +4871,13 @@ function prepareKnowledgeFromMarkdown(knowledgeContent /* <- TODO: [🖖] (?mayb
|
|
|
4878
4871
|
case 6: return [3 /*break*/, 8];
|
|
4879
4872
|
case 7:
|
|
4880
4873
|
error_1 = _c.sent();
|
|
4874
|
+
// Note: Here is expected error:
|
|
4875
|
+
// > PipelineExecutionError: You have not provided any `LlmExecutionTools` that support model variant "EMBEDDING
|
|
4876
|
+
if (!(error_1 instanceof PipelineExecutionError)) {
|
|
4877
|
+
throw error_1;
|
|
4878
|
+
}
|
|
4881
4879
|
// TODO: [🟥] Detect browser / node and make it colorfull
|
|
4882
|
-
console.error(error_1);
|
|
4880
|
+
console.error(error_1, "<- Note: This error is not critical to prepare the pipeline, just knowledge pieces won't have embeddings");
|
|
4883
4881
|
return [3 /*break*/, 8];
|
|
4884
4882
|
case 8: return [2 /*return*/, {
|
|
4885
4883
|
name: name,
|
|
@@ -6364,6 +6362,9 @@ var modelCommandParser = {
|
|
|
6364
6362
|
*/
|
|
6365
6363
|
parse: function (input) {
|
|
6366
6364
|
var args = input.args, normalized = input.normalized;
|
|
6365
|
+
var availableVariantsMessage = spaceTrim(function (block) { return "\n Available variants are:\n ".concat(block(MODEL_VARIANTS.map(function (variantName) {
|
|
6366
|
+
return "- ".concat(variantName).concat(variantName !== 'EMBEDDING' ? '' : ' (Not available in pipeline)');
|
|
6367
|
+
}).join('\n')), "\n "); });
|
|
6367
6368
|
// TODO: Make this more elegant and dynamically
|
|
6368
6369
|
if (normalized.startsWith('MODEL_VARIANT')) {
|
|
6369
6370
|
if (normalized === 'MODEL_VARIANT_CHAT') {
|
|
@@ -6379,17 +6380,13 @@ var modelCommandParser = {
|
|
|
6379
6380
|
key: 'modelVariant',
|
|
6380
6381
|
value: 'COMPLETION',
|
|
6381
6382
|
};
|
|
6383
|
+
// <- Note: [🤖]
|
|
6382
6384
|
}
|
|
6383
6385
|
else if (normalized.startsWith('MODEL_VARIANT_EMBED')) {
|
|
6384
|
-
return
|
|
6385
|
-
type: 'MODEL',
|
|
6386
|
-
key: 'modelVariant',
|
|
6387
|
-
value: 'EMBEDDING',
|
|
6388
|
-
};
|
|
6389
|
-
// <- Note: [🤖]
|
|
6386
|
+
spaceTrim(function (block) { return "\n Embedding model can not be used in pipeline\n\n ".concat(block(availableVariantsMessage), "\n "); });
|
|
6390
6387
|
}
|
|
6391
6388
|
else {
|
|
6392
|
-
throw new ParseError(spaceTrim(function (block) { return "\n Unknown model variant in command:\n\n
|
|
6389
|
+
throw new ParseError(spaceTrim(function (block) { return "\n Unknown model variant in command:\n\n ".concat(block(availableVariantsMessage), "\n "); }));
|
|
6393
6390
|
}
|
|
6394
6391
|
}
|
|
6395
6392
|
if (normalized.startsWith('MODEL_NAME')) {
|
|
@@ -9223,5 +9220,5 @@ function executionReportJsonToString(executionReportJson, options) {
|
|
|
9223
9220
|
* TODO: [🧠] Should be in generated file GENERATOR_WARNING
|
|
9224
9221
|
*/
|
|
9225
9222
|
|
|
9226
|
-
export { $llmToolsMetadataRegister, $llmToolsRegister, CLAIM, CallbackInterfaceTools, CollectionError, CsvFormatDefinition, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, ERRORS, EXECUTIONS_CACHE_DIRNAME, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, IS_VERBOSE, LimitReachedError, MAX_EXECUTION_ATTEMPTS, MAX_FILENAME_LENGTH, MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, MAX_PARALLEL_COUNT, MODEL_VARIANTS, MemoryStorage, NotFoundError, NotYetImplementedError, PIPELINE_COLLECTION_BASE_FILENAME, PROMPTBOOK_VERSION, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, TemplateTypes, TextFormatDefinition, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _OpenAiMetadataRegistration, addUsage, assertsExecutionSuccessful, cacheLlmTools, collectionToJson, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, isPassingExpectations, isPipelinePrepared, joinLlmExecutionTools, limitTotalUsage, pipelineJsonToString, pipelineStringToJson, pipelineStringToJsonSync, prepareKnowledgeFromMarkdown, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTemplates, prettifyPipelineString, stringifyPipelineJson, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline };
|
|
9223
|
+
export { $llmToolsMetadataRegister, $llmToolsRegister, CLAIM, CallbackInterfaceTools, CollectionError, CsvFormatDefinition, DEFAULT_CSV_SETTINGS, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, ERRORS, EXECUTIONS_CACHE_DIRNAME, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, IS_VERBOSE, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_EXECUTION_ATTEMPTS, MAX_FILENAME_LENGTH, MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, MAX_PARALLEL_COUNT, MODEL_VARIANTS, MemoryStorage, NotFoundError, NotYetImplementedError, PIPELINE_COLLECTION_BASE_FILENAME, PROMPTBOOK_VERSION, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, TemplateTypes, TextFormatDefinition, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _OpenAiMetadataRegistration, addUsage, assertsExecutionSuccessful, cacheLlmTools, collectionToJson, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, isPassingExpectations, isPipelinePrepared, joinLlmExecutionTools, limitTotalUsage, pipelineJsonToString, pipelineStringToJson, pipelineStringToJsonSync, prepareKnowledgeFromMarkdown, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTemplates, prettifyPipelineString, stringifyPipelineJson, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline };
|
|
9227
9224
|
//# sourceMappingURL=index.es.js.map
|