@promptbook/cli 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 +180 -183
- 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 +180 -183
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -21,7 +21,7 @@ import OpenAI from 'openai';
|
|
|
21
21
|
/**
|
|
22
22
|
* The version of the Promptbook library
|
|
23
23
|
*/
|
|
24
|
-
var PROMPTBOOK_VERSION = '0.69.0-
|
|
24
|
+
var PROMPTBOOK_VERSION = '0.69.0-12';
|
|
25
25
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
26
26
|
|
|
27
27
|
/*! *****************************************************************************
|
|
@@ -503,6 +503,17 @@ var DEFAULT_REMOTE_URL = 'https://api.pavolhejny.com/';
|
|
|
503
503
|
*/
|
|
504
504
|
var DEFAULT_REMOTE_URL_PATH = '/promptbook/socket.io';
|
|
505
505
|
// <- TODO: [🧜♂️]
|
|
506
|
+
/**
|
|
507
|
+
* @@@
|
|
508
|
+
*
|
|
509
|
+
* @public exported from `@promptbook/core`
|
|
510
|
+
*/
|
|
511
|
+
var DEFAULT_CSV_SETTINGS = Object.freeze({
|
|
512
|
+
delimiter: ',',
|
|
513
|
+
quoteChar: '"',
|
|
514
|
+
newline: '\n',
|
|
515
|
+
skipEmptyLines: true,
|
|
516
|
+
});
|
|
506
517
|
/**
|
|
507
518
|
* @@@
|
|
508
519
|
*
|
|
@@ -1051,7 +1062,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
1051
1062
|
});
|
|
1052
1063
|
}
|
|
1053
1064
|
|
|
1054
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.69.0-
|
|
1065
|
+
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"}];
|
|
1055
1066
|
|
|
1056
1067
|
/**
|
|
1057
1068
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -2474,9 +2485,7 @@ var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
|
2474
2485
|
throw new PipelineExecutionError("You have not provided any `LlmExecutionTools`");
|
|
2475
2486
|
}
|
|
2476
2487
|
else {
|
|
2477
|
-
throw new PipelineExecutionError(spaceTrim$1(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
|
|
2478
|
-
.map(function (tools) { return "- ".concat(tools.title, " ").concat(tools.description || ''); })
|
|
2479
|
-
.join('\n')), "\n\n "); }));
|
|
2488
|
+
throw new PipelineExecutionError(spaceTrim$1(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 "); }));
|
|
2480
2489
|
}
|
|
2481
2490
|
}
|
|
2482
2491
|
});
|
|
@@ -2782,6 +2791,16 @@ function TODO_USE() {
|
|
|
2782
2791
|
}
|
|
2783
2792
|
}
|
|
2784
2793
|
|
|
2794
|
+
/**
|
|
2795
|
+
* @@@
|
|
2796
|
+
*
|
|
2797
|
+
* @public exported from `@promptbook/core`
|
|
2798
|
+
*/
|
|
2799
|
+
var MANDATORY_CSV_SETTINGS = Object.freeze({
|
|
2800
|
+
header: true,
|
|
2801
|
+
// encoding: 'utf8',
|
|
2802
|
+
});
|
|
2803
|
+
|
|
2785
2804
|
/**
|
|
2786
2805
|
* Definition for CSV spreadsheet
|
|
2787
2806
|
*
|
|
@@ -2791,41 +2810,36 @@ function TODO_USE() {
|
|
|
2791
2810
|
var CsvFormatDefinition = {
|
|
2792
2811
|
formatName: 'CSV',
|
|
2793
2812
|
aliases: ['SPREADSHEET', 'TABLE'],
|
|
2794
|
-
isValid: function (value, schema) {
|
|
2813
|
+
isValid: function (value, settings, schema) {
|
|
2814
|
+
// TODO: !!!!!! Implement CSV validation
|
|
2795
2815
|
TODO_USE(value /* <- TODO: Use value here */);
|
|
2816
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2796
2817
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2797
2818
|
return true;
|
|
2798
2819
|
},
|
|
2799
|
-
canBeValid: function (partialValue, schema) {
|
|
2820
|
+
canBeValid: function (partialValue, settings, schema) {
|
|
2800
2821
|
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
2822
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2801
2823
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2802
2824
|
return true;
|
|
2803
2825
|
},
|
|
2804
|
-
heal: function (value, schema) {
|
|
2826
|
+
heal: function (value, settings, schema) {
|
|
2805
2827
|
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
2828
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2806
2829
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2807
2830
|
throw new Error('Not implemented');
|
|
2808
2831
|
},
|
|
2809
2832
|
subvalueDefinitions: [
|
|
2810
2833
|
{
|
|
2811
2834
|
subvalueName: 'ROW',
|
|
2812
|
-
mapValues: function (value, mapCallback) {
|
|
2835
|
+
mapValues: function (value, settings, mapCallback) {
|
|
2813
2836
|
return __awaiter(this, void 0, void 0, function () {
|
|
2814
2837
|
var csv, mappedData;
|
|
2815
2838
|
var _this = this;
|
|
2816
2839
|
return __generator(this, function (_a) {
|
|
2817
2840
|
switch (_a.label) {
|
|
2818
2841
|
case 0:
|
|
2819
|
-
csv = parse(value, {
|
|
2820
|
-
header: true,
|
|
2821
|
-
delimiter: ',',
|
|
2822
|
-
quoteChar: '"',
|
|
2823
|
-
newline: '\r\n',
|
|
2824
|
-
skipEmptyLines: true,
|
|
2825
|
-
// encoding: 'utf8',
|
|
2826
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
2827
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
2828
|
-
});
|
|
2842
|
+
csv = parse(value, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS));
|
|
2829
2843
|
if (csv.errors.length !== 0) {
|
|
2830
2844
|
throw new ParseError(// <- TODO: !!!!!! Split PipelineParseError and FormatParseError -> CsvParseError
|
|
2831
2845
|
spaceTrim$1(function (block) { return "\n CSV parsing error\n\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n "); }));
|
|
@@ -2839,25 +2853,18 @@ var CsvFormatDefinition = {
|
|
|
2839
2853
|
_a = [__assign({}, row)];
|
|
2840
2854
|
_b = {};
|
|
2841
2855
|
// <- TODO: !!!!!! Dynamic new column name and position
|
|
2856
|
+
// <- TODO: !!!!!! Check name collisions
|
|
2842
2857
|
return [4 /*yield*/, mapCallback(row, index)];
|
|
2843
2858
|
case 1: return [2 /*return*/, (__assign.apply(void 0, _a.concat([(_b.newColumn =
|
|
2844
2859
|
// <- TODO: !!!!!! Dynamic new column name and position
|
|
2860
|
+
// <- TODO: !!!!!! Check name collisions
|
|
2845
2861
|
_c.sent(), _b)])))];
|
|
2846
2862
|
}
|
|
2847
2863
|
});
|
|
2848
2864
|
}); }))];
|
|
2849
2865
|
case 1:
|
|
2850
2866
|
mappedData = _a.sent();
|
|
2851
|
-
return [2 /*return*/, unparse(mappedData, {
|
|
2852
|
-
header: true,
|
|
2853
|
-
delimiter: ',',
|
|
2854
|
-
quoteChar: '"',
|
|
2855
|
-
newline: '\r\n',
|
|
2856
|
-
skipEmptyLines: true,
|
|
2857
|
-
// encoding: 'utf8',
|
|
2858
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
2859
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
2860
|
-
})];
|
|
2867
|
+
return [2 /*return*/, unparse(mappedData, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS))];
|
|
2861
2868
|
}
|
|
2862
2869
|
});
|
|
2863
2870
|
});
|
|
@@ -2865,23 +2872,14 @@ var CsvFormatDefinition = {
|
|
|
2865
2872
|
},
|
|
2866
2873
|
{
|
|
2867
2874
|
subvalueName: 'CELL',
|
|
2868
|
-
mapValues: function (value, mapCallback) {
|
|
2875
|
+
mapValues: function (value, settings, mapCallback) {
|
|
2869
2876
|
return __awaiter(this, void 0, void 0, function () {
|
|
2870
2877
|
var csv, mappedData;
|
|
2871
2878
|
var _this = this;
|
|
2872
2879
|
return __generator(this, function (_a) {
|
|
2873
2880
|
switch (_a.label) {
|
|
2874
2881
|
case 0:
|
|
2875
|
-
csv = parse(value, {
|
|
2876
|
-
header: true,
|
|
2877
|
-
delimiter: ',',
|
|
2878
|
-
quoteChar: '"',
|
|
2879
|
-
newline: '\r\n',
|
|
2880
|
-
skipEmptyLines: true,
|
|
2881
|
-
// encoding: 'utf8',
|
|
2882
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
2883
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
2884
|
-
});
|
|
2882
|
+
csv = parse(value, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS));
|
|
2885
2883
|
if (csv.errors.length !== 0) {
|
|
2886
2884
|
throw new ParseError(// <- TODO: !!!!!! Split PipelineParseError and FormatParseError -> CsvParseError
|
|
2887
2885
|
spaceTrim$1(function (block) { return "\n CSV parsing error\n\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n "); }));
|
|
@@ -2904,16 +2902,7 @@ var CsvFormatDefinition = {
|
|
|
2904
2902
|
}); }))];
|
|
2905
2903
|
case 1:
|
|
2906
2904
|
mappedData = _a.sent();
|
|
2907
|
-
return [2 /*return*/, unparse(mappedData, {
|
|
2908
|
-
header: true,
|
|
2909
|
-
delimiter: ',',
|
|
2910
|
-
quoteChar: '"',
|
|
2911
|
-
newline: '\r\n',
|
|
2912
|
-
skipEmptyLines: true,
|
|
2913
|
-
// encoding: 'utf8',
|
|
2914
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
2915
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
2916
|
-
})];
|
|
2905
|
+
return [2 /*return*/, unparse(mappedData, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS))];
|
|
2917
2906
|
}
|
|
2918
2907
|
});
|
|
2919
2908
|
});
|
|
@@ -2958,17 +2947,20 @@ function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
|
2958
2947
|
var JsonFormatDefinition = {
|
|
2959
2948
|
formatName: 'JSON',
|
|
2960
2949
|
mimeType: 'application/json',
|
|
2961
|
-
isValid: function (value, schema) {
|
|
2950
|
+
isValid: function (value, settings, schema) {
|
|
2962
2951
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2952
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2963
2953
|
return isValidJsonString(value);
|
|
2964
2954
|
},
|
|
2965
|
-
canBeValid: function (partialValue, schema) {
|
|
2955
|
+
canBeValid: function (partialValue, settings, schema) {
|
|
2966
2956
|
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
2957
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2967
2958
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2968
2959
|
return true;
|
|
2969
2960
|
},
|
|
2970
|
-
heal: function (value, schema) {
|
|
2961
|
+
heal: function (value, settings, schema) {
|
|
2971
2962
|
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
2963
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2972
2964
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2973
2965
|
throw new Error('Not implemented');
|
|
2974
2966
|
},
|
|
@@ -2977,7 +2969,7 @@ var JsonFormatDefinition = {
|
|
|
2977
2969
|
/**
|
|
2978
2970
|
* TODO: [🧠] Maybe propper instance of object
|
|
2979
2971
|
* TODO: [0] Make string_serialized_json
|
|
2980
|
-
* TODO: [1] Make type for JSON Schema
|
|
2972
|
+
* TODO: [1] Make type for JSON Settings and Schema
|
|
2981
2973
|
* TODO: [🧠] What to use for validating JSONs - JSON Schema, ZoD, typescript types/interfaces,...?
|
|
2982
2974
|
* TODO: [🍓] In `JsonFormatDefinition` implement simple `isValid`
|
|
2983
2975
|
* TODO: [🍓] In `JsonFormatDefinition` implement partial `canBeValid`
|
|
@@ -3007,7 +2999,7 @@ var TextFormatDefinition = {
|
|
|
3007
2999
|
subvalueDefinitions: [
|
|
3008
3000
|
{
|
|
3009
3001
|
subvalueName: 'LINE',
|
|
3010
|
-
mapValues: function (value, mapCallback) {
|
|
3002
|
+
mapValues: function (value, settings, mapCallback) {
|
|
3011
3003
|
return __awaiter(this, void 0, void 0, function () {
|
|
3012
3004
|
var lines, mappedLines;
|
|
3013
3005
|
return __generator(this, function (_a) {
|
|
@@ -3033,6 +3025,7 @@ var TextFormatDefinition = {
|
|
|
3033
3025
|
],
|
|
3034
3026
|
};
|
|
3035
3027
|
/**
|
|
3028
|
+
* TODO: [1] Make type for XML Text and Schema
|
|
3036
3029
|
* TODO: [🧠][🤠] Here should be all words, characters, lines, paragraphs, pages aviable as subvalues
|
|
3037
3030
|
* TODO: [🍓] In `TextFormatDefinition` implement simple `isValid`
|
|
3038
3031
|
* TODO: [🍓] In `TextFormatDefinition` implement partial `canBeValid`
|
|
@@ -3049,18 +3042,21 @@ var TextFormatDefinition = {
|
|
|
3049
3042
|
var XmlFormatDefinition = {
|
|
3050
3043
|
formatName: 'XML',
|
|
3051
3044
|
mimeType: 'application/xml',
|
|
3052
|
-
isValid: function (value, schema) {
|
|
3045
|
+
isValid: function (value, settings, schema) {
|
|
3053
3046
|
TODO_USE(value /* <- TODO: Use value here */);
|
|
3047
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3054
3048
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3055
3049
|
return true;
|
|
3056
3050
|
},
|
|
3057
|
-
canBeValid: function (partialValue, schema) {
|
|
3051
|
+
canBeValid: function (partialValue, settings, schema) {
|
|
3058
3052
|
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
3053
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3059
3054
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3060
3055
|
return true;
|
|
3061
3056
|
},
|
|
3062
|
-
heal: function (value, schema) {
|
|
3057
|
+
heal: function (value, settings, schema) {
|
|
3063
3058
|
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
3059
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3064
3060
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3065
3061
|
throw new Error('Not implemented');
|
|
3066
3062
|
},
|
|
@@ -3069,7 +3065,7 @@ var XmlFormatDefinition = {
|
|
|
3069
3065
|
/**
|
|
3070
3066
|
* TODO: [🧠] Maybe propper instance of object
|
|
3071
3067
|
* TODO: [0] Make string_serialized_xml
|
|
3072
|
-
* TODO: [1] Make type for XML Schema
|
|
3068
|
+
* TODO: [1] Make type for XML Settings and Schema
|
|
3073
3069
|
* TODO: [🧠] What to use for validating XMLs - XSD,...
|
|
3074
3070
|
* TODO: [🍓] In `XmlFormatDefinition` implement simple `isValid`
|
|
3075
3071
|
* TODO: [🍓] In `XmlFormatDefinition` implement partial `canBeValid`
|
|
@@ -3527,10 +3523,10 @@ function executeAttempts(options) {
|
|
|
3527
3523
|
$scriptPipelineExecutionErrors: [],
|
|
3528
3524
|
};
|
|
3529
3525
|
_loop_1 = function (attempt) {
|
|
3530
|
-
var isJokerAttempt, jokerParameterName, _b, modelRequirements, _c, _d, _e, _f, _g,
|
|
3531
|
-
var e_1,
|
|
3532
|
-
return __generator(this, function (
|
|
3533
|
-
switch (
|
|
3526
|
+
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;
|
|
3527
|
+
var e_1, _q, e_3, _r, e_2, _s;
|
|
3528
|
+
return __generator(this, function (_t) {
|
|
3529
|
+
switch (_t.label) {
|
|
3534
3530
|
case 0:
|
|
3535
3531
|
isJokerAttempt = attempt < 0;
|
|
3536
3532
|
jokerParameterName = jokerParameterNames[jokerParameterNames.length + attempt];
|
|
@@ -3550,21 +3546,21 @@ function executeAttempts(options) {
|
|
|
3550
3546
|
$ongoingTemplateResult.$resultString = parameters[jokerParameterName];
|
|
3551
3547
|
}
|
|
3552
3548
|
}
|
|
3553
|
-
|
|
3549
|
+
_t.label = 1;
|
|
3554
3550
|
case 1:
|
|
3555
|
-
|
|
3556
|
-
if (!!isJokerAttempt) return [3 /*break*/,
|
|
3551
|
+
_t.trys.push([1, 43, 44, 45]);
|
|
3552
|
+
if (!!isJokerAttempt) return [3 /*break*/, 25];
|
|
3557
3553
|
_b = template.templateType;
|
|
3558
3554
|
switch (_b) {
|
|
3559
3555
|
case 'SIMPLE_TEMPLATE': return [3 /*break*/, 2];
|
|
3560
3556
|
case 'PROMPT_TEMPLATE': return [3 /*break*/, 3];
|
|
3561
|
-
case 'SCRIPT_TEMPLATE': return [3 /*break*/,
|
|
3562
|
-
case 'DIALOG_TEMPLATE': return [3 /*break*/,
|
|
3557
|
+
case 'SCRIPT_TEMPLATE': return [3 /*break*/, 11];
|
|
3558
|
+
case 'DIALOG_TEMPLATE': return [3 /*break*/, 22];
|
|
3563
3559
|
}
|
|
3564
|
-
return [3 /*break*/,
|
|
3560
|
+
return [3 /*break*/, 24];
|
|
3565
3561
|
case 2:
|
|
3566
3562
|
$ongoingTemplateResult.$resultString = replaceParameters(preparedContent, parameters);
|
|
3567
|
-
return [3 /*break*/,
|
|
3563
|
+
return [3 /*break*/, 25];
|
|
3568
3564
|
case 3:
|
|
3569
3565
|
modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (template.modelRequirements || {}));
|
|
3570
3566
|
$ongoingTemplateResult.$prompt = {
|
|
@@ -3589,67 +3585,57 @@ function executeAttempts(options) {
|
|
|
3589
3585
|
case 'COMPLETION': return [3 /*break*/, 6];
|
|
3590
3586
|
case 'EMBEDDING': return [3 /*break*/, 8];
|
|
3591
3587
|
}
|
|
3592
|
-
return [3 /*break*/,
|
|
3588
|
+
return [3 /*break*/, 9];
|
|
3593
3589
|
case 4:
|
|
3594
3590
|
_d = $ongoingTemplateResult;
|
|
3595
3591
|
return [4 /*yield*/, llmTools.callChatModel($deepFreeze($ongoingTemplateResult.$prompt))];
|
|
3596
3592
|
case 5:
|
|
3597
|
-
_d.$chatResult =
|
|
3593
|
+
_d.$chatResult = _t.sent();
|
|
3598
3594
|
// TODO: [🍬] Destroy chatThread
|
|
3599
3595
|
$ongoingTemplateResult.$result = $ongoingTemplateResult.$chatResult;
|
|
3600
3596
|
$ongoingTemplateResult.$resultString = $ongoingTemplateResult.$chatResult.content;
|
|
3601
|
-
return [3 /*break*/,
|
|
3597
|
+
return [3 /*break*/, 10];
|
|
3602
3598
|
case 6:
|
|
3603
3599
|
_e = $ongoingTemplateResult;
|
|
3604
3600
|
return [4 /*yield*/, llmTools.callCompletionModel($deepFreeze($ongoingTemplateResult.$prompt))];
|
|
3605
3601
|
case 7:
|
|
3606
|
-
_e.$completionResult =
|
|
3602
|
+
_e.$completionResult = _t.sent();
|
|
3607
3603
|
$ongoingTemplateResult.$result = $ongoingTemplateResult.$completionResult;
|
|
3608
3604
|
$ongoingTemplateResult.$resultString =
|
|
3609
3605
|
$ongoingTemplateResult.$completionResult.content;
|
|
3610
|
-
return [3 /*break*/,
|
|
3611
|
-
case 8:
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
case 9:
|
|
3616
|
-
// TODO: [🧠] This is weird, embedding model can not be used such a way in the pipeline
|
|
3617
|
-
_f.$embeddingResult = _u.sent();
|
|
3618
|
-
$ongoingTemplateResult.$result = $ongoingTemplateResult.$embeddingResult;
|
|
3619
|
-
$ongoingTemplateResult.$resultString =
|
|
3620
|
-
$ongoingTemplateResult.$embeddingResult.content.join(',');
|
|
3621
|
-
return [3 /*break*/, 11];
|
|
3622
|
-
case 10: throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Unknown model variant \"".concat(template.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
3623
|
-
case 11: return [3 /*break*/, 26];
|
|
3624
|
-
case 12:
|
|
3606
|
+
return [3 /*break*/, 10];
|
|
3607
|
+
case 8: throw new PipelineExecutionError(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 "); }));
|
|
3608
|
+
case 9: throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Unknown model variant \"".concat(template.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
3609
|
+
case 10: return [3 /*break*/, 25];
|
|
3610
|
+
case 11:
|
|
3625
3611
|
if (arrayableToArray(tools.script).length === 0) {
|
|
3626
3612
|
throw new PipelineExecutionError(spaceTrim(function (block) { return "\n No script execution tools are available\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
3627
3613
|
}
|
|
3628
3614
|
if (!template.contentLanguage) {
|
|
3629
3615
|
throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Script language is not defined for SCRIPT TEMPLATE \"".concat(template.name, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
3630
3616
|
}
|
|
3631
|
-
|
|
3617
|
+
_t.label = 12;
|
|
3618
|
+
case 12:
|
|
3619
|
+
_t.trys.push([12, 19, 20, 21]);
|
|
3620
|
+
_f = (e_1 = void 0, __values(arrayableToArray(tools.script))), _g = _f.next();
|
|
3621
|
+
_t.label = 13;
|
|
3632
3622
|
case 13:
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3623
|
+
if (!!_g.done) return [3 /*break*/, 18];
|
|
3624
|
+
scriptTools = _g.value;
|
|
3625
|
+
_t.label = 14;
|
|
3636
3626
|
case 14:
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
_u.label = 15;
|
|
3640
|
-
case 15:
|
|
3641
|
-
_u.trys.push([15, 17, , 18]);
|
|
3642
|
-
_j = $ongoingTemplateResult;
|
|
3627
|
+
_t.trys.push([14, 16, , 17]);
|
|
3628
|
+
_h = $ongoingTemplateResult;
|
|
3643
3629
|
return [4 /*yield*/, scriptTools.execute($deepFreeze({
|
|
3644
3630
|
scriptLanguage: template.contentLanguage,
|
|
3645
3631
|
script: preparedContent,
|
|
3646
3632
|
parameters: parameters,
|
|
3647
3633
|
}))];
|
|
3634
|
+
case 15:
|
|
3635
|
+
_h.$resultString = _t.sent();
|
|
3636
|
+
return [3 /*break*/, 18];
|
|
3648
3637
|
case 16:
|
|
3649
|
-
|
|
3650
|
-
return [3 /*break*/, 19];
|
|
3651
|
-
case 17:
|
|
3652
|
-
error_1 = _u.sent();
|
|
3638
|
+
error_1 = _t.sent();
|
|
3653
3639
|
if (!(error_1 instanceof Error)) {
|
|
3654
3640
|
throw error_1;
|
|
3655
3641
|
}
|
|
@@ -3657,24 +3643,24 @@ function executeAttempts(options) {
|
|
|
3657
3643
|
throw error_1;
|
|
3658
3644
|
}
|
|
3659
3645
|
$ongoingTemplateResult.$scriptPipelineExecutionErrors.push(error_1);
|
|
3660
|
-
return [3 /*break*/,
|
|
3661
|
-
case
|
|
3662
|
-
|
|
3663
|
-
return [3 /*break*/,
|
|
3664
|
-
case
|
|
3665
|
-
case
|
|
3666
|
-
e_1_1 =
|
|
3646
|
+
return [3 /*break*/, 17];
|
|
3647
|
+
case 17:
|
|
3648
|
+
_g = _f.next();
|
|
3649
|
+
return [3 /*break*/, 13];
|
|
3650
|
+
case 18: return [3 /*break*/, 21];
|
|
3651
|
+
case 19:
|
|
3652
|
+
e_1_1 = _t.sent();
|
|
3667
3653
|
e_1 = { error: e_1_1 };
|
|
3668
|
-
return [3 /*break*/,
|
|
3669
|
-
case
|
|
3654
|
+
return [3 /*break*/, 21];
|
|
3655
|
+
case 20:
|
|
3670
3656
|
try {
|
|
3671
|
-
if (
|
|
3657
|
+
if (_g && !_g.done && (_q = _f.return)) _q.call(_f);
|
|
3672
3658
|
}
|
|
3673
3659
|
finally { if (e_1) throw e_1.error; }
|
|
3674
3660
|
return [7 /*endfinally*/];
|
|
3675
|
-
case
|
|
3661
|
+
case 21:
|
|
3676
3662
|
if ($ongoingTemplateResult.$resultString !== null) {
|
|
3677
|
-
return [3 /*break*/,
|
|
3663
|
+
return [3 /*break*/, 25];
|
|
3678
3664
|
}
|
|
3679
3665
|
if ($ongoingTemplateResult.$scriptPipelineExecutionErrors.length === 1) {
|
|
3680
3666
|
throw $ongoingTemplateResult.$scriptPipelineExecutionErrors[0];
|
|
@@ -3684,12 +3670,12 @@ function executeAttempts(options) {
|
|
|
3684
3670
|
.map(function (error) { return '- ' + error.message; })
|
|
3685
3671
|
.join('\n\n')), "\n "); }));
|
|
3686
3672
|
}
|
|
3687
|
-
case
|
|
3673
|
+
case 22:
|
|
3688
3674
|
if (tools.userInterface === undefined) {
|
|
3689
3675
|
throw new PipelineExecutionError(spaceTrim(function (block) { return "\n User interface tools are not available\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
3690
3676
|
}
|
|
3691
3677
|
// TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
|
|
3692
|
-
|
|
3678
|
+
_j = $ongoingTemplateResult;
|
|
3693
3679
|
return [4 /*yield*/, tools.userInterface.promptDialog($deepFreeze({
|
|
3694
3680
|
promptTitle: template.title,
|
|
3695
3681
|
promptMessage: replaceParameters(template.description || '', parameters),
|
|
@@ -3698,34 +3684,34 @@ function executeAttempts(options) {
|
|
|
3698
3684
|
placeholder: undefined,
|
|
3699
3685
|
priority: priority,
|
|
3700
3686
|
}))];
|
|
3701
|
-
case
|
|
3687
|
+
case 23:
|
|
3702
3688
|
// TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
|
|
3703
|
-
|
|
3704
|
-
return [3 /*break*/,
|
|
3705
|
-
case
|
|
3689
|
+
_j.$resultString = _t.sent();
|
|
3690
|
+
return [3 /*break*/, 25];
|
|
3691
|
+
case 24: throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Unknown execution type \"".concat(template.templateType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
3692
|
+
case 25:
|
|
3693
|
+
if (!(!isJokerAttempt && template.postprocessingFunctionNames)) return [3 /*break*/, 42];
|
|
3694
|
+
_t.label = 26;
|
|
3706
3695
|
case 26:
|
|
3707
|
-
|
|
3708
|
-
|
|
3696
|
+
_t.trys.push([26, 40, 41, 42]);
|
|
3697
|
+
_k = (e_3 = void 0, __values(template.postprocessingFunctionNames)), _l = _k.next();
|
|
3698
|
+
_t.label = 27;
|
|
3709
3699
|
case 27:
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
_u.label = 28;
|
|
3713
|
-
case 28:
|
|
3714
|
-
if (!!_m.done) return [3 /*break*/, 40];
|
|
3715
|
-
functionName = _m.value;
|
|
3700
|
+
if (!!_l.done) return [3 /*break*/, 39];
|
|
3701
|
+
functionName = _l.value;
|
|
3716
3702
|
postprocessingError = null;
|
|
3717
|
-
|
|
3703
|
+
_t.label = 28;
|
|
3704
|
+
case 28:
|
|
3705
|
+
_t.trys.push([28, 35, 36, 37]);
|
|
3706
|
+
_m = (e_2 = void 0, __values(arrayableToArray(tools.script))), _o = _m.next();
|
|
3707
|
+
_t.label = 29;
|
|
3718
3708
|
case 29:
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3709
|
+
if (!!_o.done) return [3 /*break*/, 34];
|
|
3710
|
+
scriptTools = _o.value;
|
|
3711
|
+
_t.label = 30;
|
|
3722
3712
|
case 30:
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
_u.label = 31;
|
|
3726
|
-
case 31:
|
|
3727
|
-
_u.trys.push([31, 33, , 34]);
|
|
3728
|
-
_q = $ongoingTemplateResult;
|
|
3713
|
+
_t.trys.push([30, 32, , 33]);
|
|
3714
|
+
_p = $ongoingTemplateResult;
|
|
3729
3715
|
return [4 /*yield*/, scriptTools.execute({
|
|
3730
3716
|
scriptLanguage: "javascript" /* <- TODO: Try it in each languages; In future allow postprocessing with arbitrary combination of languages to combine */,
|
|
3731
3717
|
script: "".concat(functionName, "(resultString)"),
|
|
@@ -3734,12 +3720,12 @@ function executeAttempts(options) {
|
|
|
3734
3720
|
// Note: No ...parametersForTemplate, because working with result only
|
|
3735
3721
|
},
|
|
3736
3722
|
})];
|
|
3737
|
-
case
|
|
3738
|
-
|
|
3723
|
+
case 31:
|
|
3724
|
+
_p.$resultString = _t.sent();
|
|
3739
3725
|
postprocessingError = null;
|
|
3740
|
-
return [3 /*break*/,
|
|
3741
|
-
case
|
|
3742
|
-
error_2 =
|
|
3726
|
+
return [3 /*break*/, 34];
|
|
3727
|
+
case 32:
|
|
3728
|
+
error_2 = _t.sent();
|
|
3743
3729
|
if (!(error_2 instanceof Error)) {
|
|
3744
3730
|
throw error_2;
|
|
3745
3731
|
}
|
|
@@ -3748,41 +3734,41 @@ function executeAttempts(options) {
|
|
|
3748
3734
|
}
|
|
3749
3735
|
postprocessingError = error_2;
|
|
3750
3736
|
$ongoingTemplateResult.$scriptPipelineExecutionErrors.push(error_2);
|
|
3751
|
-
return [3 /*break*/,
|
|
3752
|
-
case
|
|
3753
|
-
|
|
3754
|
-
return [3 /*break*/,
|
|
3755
|
-
case
|
|
3756
|
-
case
|
|
3757
|
-
e_2_1 =
|
|
3737
|
+
return [3 /*break*/, 33];
|
|
3738
|
+
case 33:
|
|
3739
|
+
_o = _m.next();
|
|
3740
|
+
return [3 /*break*/, 29];
|
|
3741
|
+
case 34: return [3 /*break*/, 37];
|
|
3742
|
+
case 35:
|
|
3743
|
+
e_2_1 = _t.sent();
|
|
3758
3744
|
e_2 = { error: e_2_1 };
|
|
3759
|
-
return [3 /*break*/,
|
|
3760
|
-
case
|
|
3745
|
+
return [3 /*break*/, 37];
|
|
3746
|
+
case 36:
|
|
3761
3747
|
try {
|
|
3762
|
-
if (
|
|
3748
|
+
if (_o && !_o.done && (_s = _m.return)) _s.call(_m);
|
|
3763
3749
|
}
|
|
3764
3750
|
finally { if (e_2) throw e_2.error; }
|
|
3765
3751
|
return [7 /*endfinally*/];
|
|
3766
|
-
case
|
|
3752
|
+
case 37:
|
|
3767
3753
|
if (postprocessingError) {
|
|
3768
3754
|
throw postprocessingError;
|
|
3769
3755
|
}
|
|
3770
|
-
|
|
3771
|
-
case
|
|
3772
|
-
|
|
3773
|
-
return [3 /*break*/,
|
|
3774
|
-
case
|
|
3775
|
-
case
|
|
3776
|
-
e_3_1 =
|
|
3756
|
+
_t.label = 38;
|
|
3757
|
+
case 38:
|
|
3758
|
+
_l = _k.next();
|
|
3759
|
+
return [3 /*break*/, 27];
|
|
3760
|
+
case 39: return [3 /*break*/, 42];
|
|
3761
|
+
case 40:
|
|
3762
|
+
e_3_1 = _t.sent();
|
|
3777
3763
|
e_3 = { error: e_3_1 };
|
|
3778
|
-
return [3 /*break*/,
|
|
3779
|
-
case
|
|
3764
|
+
return [3 /*break*/, 42];
|
|
3765
|
+
case 41:
|
|
3780
3766
|
try {
|
|
3781
|
-
if (
|
|
3767
|
+
if (_l && !_l.done && (_r = _k.return)) _r.call(_k);
|
|
3782
3768
|
}
|
|
3783
3769
|
finally { if (e_3) throw e_3.error; }
|
|
3784
3770
|
return [7 /*endfinally*/];
|
|
3785
|
-
case
|
|
3771
|
+
case 42:
|
|
3786
3772
|
// TODO: [💝] Unite object for expecting amount and format
|
|
3787
3773
|
if (template.format) {
|
|
3788
3774
|
if (template.format === 'JSON') {
|
|
@@ -3807,14 +3793,14 @@ function executeAttempts(options) {
|
|
|
3807
3793
|
checkExpectations(template.expectations, $ongoingTemplateResult.$resultString || '');
|
|
3808
3794
|
}
|
|
3809
3795
|
return [2 /*return*/, "break-attempts"];
|
|
3810
|
-
case
|
|
3811
|
-
error_3 =
|
|
3796
|
+
case 43:
|
|
3797
|
+
error_3 = _t.sent();
|
|
3812
3798
|
if (!(error_3 instanceof ExpectError)) {
|
|
3813
3799
|
throw error_3;
|
|
3814
3800
|
}
|
|
3815
3801
|
$ongoingTemplateResult.$expectError = error_3;
|
|
3816
|
-
return [3 /*break*/,
|
|
3817
|
-
case
|
|
3802
|
+
return [3 /*break*/, 45];
|
|
3803
|
+
case 44:
|
|
3818
3804
|
if (!isJokerAttempt &&
|
|
3819
3805
|
template.templateType === 'PROMPT_TEMPLATE' &&
|
|
3820
3806
|
$ongoingTemplateResult.$prompt
|
|
@@ -3831,7 +3817,7 @@ function executeAttempts(options) {
|
|
|
3831
3817
|
});
|
|
3832
3818
|
}
|
|
3833
3819
|
return [7 /*endfinally*/];
|
|
3834
|
-
case
|
|
3820
|
+
case 45:
|
|
3835
3821
|
if ($ongoingTemplateResult.$expectError !== null && attempt === maxAttempts - 1) {
|
|
3836
3822
|
throw new PipelineExecutionError(spaceTrim(function (block) {
|
|
3837
3823
|
var _a, _b, _c;
|
|
@@ -3887,12 +3873,12 @@ function executeAttempts(options) {
|
|
|
3887
3873
|
*/
|
|
3888
3874
|
function executeFormatCells(options) {
|
|
3889
3875
|
return __awaiter(this, void 0, void 0, function () {
|
|
3890
|
-
var template, jokerParameterNames, parameters, priority, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, resultString;
|
|
3876
|
+
var template, jokerParameterNames, parameters, priority, pipelineIdentification, settings, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
|
|
3891
3877
|
var _this = this;
|
|
3892
3878
|
return __generator(this, function (_a) {
|
|
3893
3879
|
switch (_a.label) {
|
|
3894
3880
|
case 0:
|
|
3895
|
-
template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, pipelineIdentification = options.pipelineIdentification;
|
|
3881
|
+
template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, pipelineIdentification = options.pipelineIdentification, settings = options.settings;
|
|
3896
3882
|
if (template.foreach === undefined) {
|
|
3897
3883
|
return [2 /*return*/, /* not await */ executeAttempts(options)];
|
|
3898
3884
|
}
|
|
@@ -3921,11 +3907,17 @@ function executeFormatCells(options) {
|
|
|
3921
3907
|
.map(function (subvalueName) { return "- ".concat(subvalueName); })
|
|
3922
3908
|
.join('\n')), "\n\n [\u26F7] This should never happen because cell name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
3923
3909
|
}
|
|
3924
|
-
|
|
3910
|
+
if (formatDefinition.formatName === 'CSV') {
|
|
3911
|
+
formatSettings = settings.csvSettings;
|
|
3912
|
+
// <- TODO: !!!!!! More universal, make simmilar pattern for other formats for example \n vs \r\n in text
|
|
3913
|
+
}
|
|
3914
|
+
return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
3925
3915
|
var mappedParameters, allSubparameters, subresultString;
|
|
3926
3916
|
return __generator(this, function (_a) {
|
|
3927
3917
|
switch (_a.label) {
|
|
3928
3918
|
case 0:
|
|
3919
|
+
// TODO: !!!!!!! Limit to N concurrent executions
|
|
3920
|
+
// TODO: !!!!!!! Report progress
|
|
3929
3921
|
try {
|
|
3930
3922
|
mappedParameters = mapAvailableToExpectedParameters({
|
|
3931
3923
|
expectedParameters: Object.fromEntries(template.foreach.subparameterNames.map(function (subparameterName) { return [subparameterName, null]; })),
|
|
@@ -4556,7 +4548,7 @@ function executePipeline(options) {
|
|
|
4556
4548
|
function createPipelineExecutor(options) {
|
|
4557
4549
|
var _this = this;
|
|
4558
4550
|
var pipeline = options.pipeline, tools = options.tools, _a = options.settings, settings = _a === void 0 ? {} : _a;
|
|
4559
|
-
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.
|
|
4551
|
+
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;
|
|
4560
4552
|
validatePipeline(pipeline);
|
|
4561
4553
|
var pipelineIdentification = (function () {
|
|
4562
4554
|
// Note: This is a 😐 implementation of [🚞]
|
|
@@ -4591,6 +4583,7 @@ function createPipelineExecutor(options) {
|
|
|
4591
4583
|
settings: {
|
|
4592
4584
|
maxExecutionAttempts: maxExecutionAttempts,
|
|
4593
4585
|
maxParallelCount: maxParallelCount,
|
|
4586
|
+
csvSettings: csvSettings,
|
|
4594
4587
|
isVerbose: isVerbose,
|
|
4595
4588
|
isNotPreparedWarningSupressed: isNotPreparedWarningSupressed,
|
|
4596
4589
|
},
|
|
@@ -4708,8 +4701,13 @@ function prepareKnowledgeFromMarkdown(knowledgeContent /* <- TODO: [🖖] (?mayb
|
|
|
4708
4701
|
case 6: return [3 /*break*/, 8];
|
|
4709
4702
|
case 7:
|
|
4710
4703
|
error_1 = _c.sent();
|
|
4704
|
+
// Note: Here is expected error:
|
|
4705
|
+
// > PipelineExecutionError: You have not provided any `LlmExecutionTools` that support model variant "EMBEDDING
|
|
4706
|
+
if (!(error_1 instanceof PipelineExecutionError)) {
|
|
4707
|
+
throw error_1;
|
|
4708
|
+
}
|
|
4711
4709
|
// TODO: [🟥] Detect browser / node and make it colorfull
|
|
4712
|
-
console.error(error_1);
|
|
4710
|
+
console.error(error_1, "<- Note: This error is not critical to prepare the pipeline, just knowledge pieces won't have embeddings");
|
|
4713
4711
|
return [3 /*break*/, 8];
|
|
4714
4712
|
case 8: return [2 /*return*/, {
|
|
4715
4713
|
name: name,
|
|
@@ -6212,6 +6210,9 @@ var modelCommandParser = {
|
|
|
6212
6210
|
*/
|
|
6213
6211
|
parse: function (input) {
|
|
6214
6212
|
var args = input.args, normalized = input.normalized;
|
|
6213
|
+
var availableVariantsMessage = spaceTrim$1(function (block) { return "\n Available variants are:\n ".concat(block(MODEL_VARIANTS.map(function (variantName) {
|
|
6214
|
+
return "- ".concat(variantName).concat(variantName !== 'EMBEDDING' ? '' : ' (Not available in pipeline)');
|
|
6215
|
+
}).join('\n')), "\n "); });
|
|
6215
6216
|
// TODO: Make this more elegant and dynamically
|
|
6216
6217
|
if (normalized.startsWith('MODEL_VARIANT')) {
|
|
6217
6218
|
if (normalized === 'MODEL_VARIANT_CHAT') {
|
|
@@ -6227,17 +6228,13 @@ var modelCommandParser = {
|
|
|
6227
6228
|
key: 'modelVariant',
|
|
6228
6229
|
value: 'COMPLETION',
|
|
6229
6230
|
};
|
|
6231
|
+
// <- Note: [🤖]
|
|
6230
6232
|
}
|
|
6231
6233
|
else if (normalized.startsWith('MODEL_VARIANT_EMBED')) {
|
|
6232
|
-
return
|
|
6233
|
-
type: 'MODEL',
|
|
6234
|
-
key: 'modelVariant',
|
|
6235
|
-
value: 'EMBEDDING',
|
|
6236
|
-
};
|
|
6237
|
-
// <- Note: [🤖]
|
|
6234
|
+
spaceTrim$1(function (block) { return "\n Embedding model can not be used in pipeline\n\n ".concat(block(availableVariantsMessage), "\n "); });
|
|
6238
6235
|
}
|
|
6239
6236
|
else {
|
|
6240
|
-
throw new ParseError(spaceTrim$1(function (block) { return "\n Unknown model variant in command:\n\n
|
|
6237
|
+
throw new ParseError(spaceTrim$1(function (block) { return "\n Unknown model variant in command:\n\n ".concat(block(availableVariantsMessage), "\n "); }));
|
|
6241
6238
|
}
|
|
6242
6239
|
}
|
|
6243
6240
|
if (normalized.startsWith('MODEL_NAME')) {
|