@promptbook/markdown-utils 0.75.0-0 β 0.75.0-1
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 +49 -24
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +8 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -2
- package/esm/typings/src/config.d.ts +1 -0
- package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +6 -1
- package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +1 -1
- package/esm/typings/src/formfactors/chat/ChatFormfactorDefinition.d.ts +6 -1
- package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +4 -0
- package/esm/typings/src/formfactors/index.d.ts +26 -1
- package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/pipeline/pipeline-interface/PipelineInterface.d.ts +2 -2
- package/esm/typings/src/pipeline/pipeline-interface/constants.d.ts +9 -0
- package/esm/typings/src/utils/expectation-counters/{config.d.ts β constants.d.ts} +3 -0
- package/package.json +1 -1
- package/umd/index.umd.js +49 -24
- package/umd/index.umd.js.map +1 -1
|
@@ -59,9 +59,12 @@ import { CsvFormatDefinition } from '../formats/csv/CsvFormatDefinition';
|
|
|
59
59
|
import { CsvFormatError } from '../formats/csv/CsvFormatError';
|
|
60
60
|
import { MANDATORY_CSV_SETTINGS } from '../formats/csv/CsvSettings';
|
|
61
61
|
import { TextFormatDefinition } from '../formats/text/TextFormatDefinition';
|
|
62
|
+
import { BoilerplateFormfactorDefinition } from '../formfactors/_boilerplate/BoilerplateFormfactorDefinition';
|
|
62
63
|
import { ChatFormfactorDefinition } from '../formfactors/chat/ChatFormfactorDefinition';
|
|
63
64
|
import { GenericFormfactorDefinition } from '../formfactors/generic/GenericFormfactorDefinition';
|
|
64
65
|
import { FORMFACTOR_DEFINITIONS } from '../formfactors/index';
|
|
66
|
+
import { SheetsFormfactorDefinition } from '../formfactors/sheets/SheetsFormfactorDefinition';
|
|
67
|
+
import { TranslatorFormfactorDefinition } from '../formfactors/translator/TranslatorFormfactorDefinition';
|
|
65
68
|
import { $llmToolsMetadataRegister } from '../llm-providers/_common/register/$llmToolsMetadataRegister';
|
|
66
69
|
import { $llmToolsRegister } from '../llm-providers/_common/register/$llmToolsRegister';
|
|
67
70
|
import { createLlmToolsFromConfiguration } from '../llm-providers/_common/register/createLlmToolsFromConfiguration';
|
|
@@ -75,6 +78,7 @@ import { MultipleLlmExecutionTools } from '../llm-providers/multiple/MultipleLlm
|
|
|
75
78
|
import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
76
79
|
import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
77
80
|
import { preparePersona } from '../personas/preparePersona';
|
|
81
|
+
import { GENERIC_PIPELINE_INTERFACE } from '../pipeline/pipeline-interface/constants';
|
|
78
82
|
import { getPipelineInterface } from '../pipeline/pipeline-interface/getPipelineInterface';
|
|
79
83
|
import { isPipelineImplementingInterface } from '../pipeline/pipeline-interface/isPipelineImplementingInterface';
|
|
80
84
|
import { isPipelineInterfacesEqual } from '../pipeline/pipeline-interface/isPipelineInterfacesEqual';
|
|
@@ -160,9 +164,12 @@ export { CsvFormatDefinition };
|
|
|
160
164
|
export { CsvFormatError };
|
|
161
165
|
export { MANDATORY_CSV_SETTINGS };
|
|
162
166
|
export { TextFormatDefinition };
|
|
167
|
+
export { BoilerplateFormfactorDefinition };
|
|
163
168
|
export { ChatFormfactorDefinition };
|
|
164
169
|
export { GenericFormfactorDefinition };
|
|
165
170
|
export { FORMFACTOR_DEFINITIONS };
|
|
171
|
+
export { SheetsFormfactorDefinition };
|
|
172
|
+
export { TranslatorFormfactorDefinition };
|
|
166
173
|
export { $llmToolsMetadataRegister };
|
|
167
174
|
export { $llmToolsRegister };
|
|
168
175
|
export { createLlmToolsFromConfiguration };
|
|
@@ -176,6 +183,7 @@ export { MultipleLlmExecutionTools };
|
|
|
176
183
|
export { _OpenAiMetadataRegistration };
|
|
177
184
|
export { _OpenAiAssistantMetadataRegistration };
|
|
178
185
|
export { preparePersona };
|
|
186
|
+
export { GENERIC_PIPELINE_INTERFACE };
|
|
179
187
|
export { getPipelineInterface };
|
|
180
188
|
export { isPipelineImplementingInterface };
|
|
181
189
|
export { isPipelineInterfacesEqual };
|
|
@@ -12,8 +12,8 @@ import { $currentDate } from '../utils/$currentDate';
|
|
|
12
12
|
import { $isRunningInBrowser } from '../utils/environment/$isRunningInBrowser';
|
|
13
13
|
import { $isRunningInNode } from '../utils/environment/$isRunningInNode';
|
|
14
14
|
import { $isRunningInWebWorker } from '../utils/environment/$isRunningInWebWorker';
|
|
15
|
-
import { CHARACTERS_PER_STANDARD_LINE } from '../utils/expectation-counters/
|
|
16
|
-
import { LINES_PER_STANDARD_PAGE } from '../utils/expectation-counters/
|
|
15
|
+
import { CHARACTERS_PER_STANDARD_LINE } from '../utils/expectation-counters/constants';
|
|
16
|
+
import { LINES_PER_STANDARD_PAGE } from '../utils/expectation-counters/constants';
|
|
17
17
|
import { countCharacters } from '../utils/expectation-counters/countCharacters';
|
|
18
18
|
import { countLines } from '../utils/expectation-counters/countLines';
|
|
19
19
|
import { countPages } from '../utils/expectation-counters/countPages';
|
|
@@ -192,5 +192,6 @@ export declare const IS_PIPELINE_LOGIC_VALIDATED: boolean;
|
|
|
192
192
|
*/
|
|
193
193
|
export declare const IS_COST_PREVENTED: boolean;
|
|
194
194
|
/**
|
|
195
|
+
* TODO: Extract `constants.ts` from `config.ts`
|
|
195
196
|
* TODO: [π§ ][π§ββοΈ] Maybe join remoteUrl and path into single value
|
|
196
197
|
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boilerplate is form of app that @@@
|
|
3
|
+
*
|
|
4
|
+
* @public exported from `@promptbook/core`
|
|
5
|
+
*/
|
|
6
|
+
export declare const BoilerplateFormfactorDefinition: {
|
|
7
|
+
readonly name: "BOILERPLATE";
|
|
8
|
+
readonly description: "@@@";
|
|
9
|
+
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
10
|
+
readonly pipelineInterface: {
|
|
11
|
+
readonly inputParameterNames: readonly [];
|
|
12
|
+
readonly outputParameterNames: readonly [];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineInterface } from '../../pipeline/pipeline-interface/PipelineInterface';
|
|
2
2
|
import type { string_markdown_text } from '../../types/typeAliases';
|
|
3
3
|
import type { string_name } from '../../types/typeAliases';
|
|
4
4
|
import type { string_promptbook_documentation_url } from '../../types/typeAliases';
|
|
5
|
+
import type { string_SCREAMING_CASE } from '../../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
5
6
|
/**
|
|
6
7
|
* @@@
|
|
7
8
|
*/
|
|
@@ -26,4 +27,8 @@ export type AbstractFormfactorDefinition = {
|
|
|
26
27
|
* @@@
|
|
27
28
|
*/
|
|
28
29
|
readonly documentationUrl: string_promptbook_documentation_url;
|
|
30
|
+
/**
|
|
31
|
+
* @@@
|
|
32
|
+
*/
|
|
33
|
+
readonly pipelineInterface: PipelineInterface;
|
|
29
34
|
};
|
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
* @public exported from `@promptbook/core`
|
|
5
5
|
*/
|
|
6
6
|
export declare const ChatFormfactorDefinition: {
|
|
7
|
-
readonly name: "
|
|
7
|
+
readonly name: "CHATBOT";
|
|
8
|
+
readonly aliasNames: readonly ["CHAT"];
|
|
8
9
|
readonly description: "@@@";
|
|
9
10
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
11
|
+
readonly pipelineInterface: {
|
|
12
|
+
readonly inputParameterNames: readonly ["previousTitle", "previousConversationSummary", "userMessage"];
|
|
13
|
+
readonly outputParameterNames: readonly ["title", "conversationSummary", "chatbotResponse"];
|
|
14
|
+
};
|
|
10
15
|
};
|
|
@@ -7,4 +7,8 @@ export declare const GenericFormfactorDefinition: {
|
|
|
7
7
|
readonly name: "GENERIC";
|
|
8
8
|
readonly description: "@@@";
|
|
9
9
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
10
|
+
readonly pipelineInterface: {
|
|
11
|
+
readonly inputParameterNames: readonly [];
|
|
12
|
+
readonly outputParameterNames: readonly [];
|
|
13
|
+
};
|
|
10
14
|
};
|
|
@@ -7,8 +7,33 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
|
7
7
|
readonly name: "GENERIC";
|
|
8
8
|
readonly description: "@@@";
|
|
9
9
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
10
|
+
readonly pipelineInterface: {
|
|
11
|
+
readonly inputParameterNames: readonly [];
|
|
12
|
+
readonly outputParameterNames: readonly [];
|
|
13
|
+
};
|
|
10
14
|
}, {
|
|
11
|
-
readonly name: "
|
|
15
|
+
readonly name: "CHATBOT";
|
|
16
|
+
readonly aliasNames: readonly ["CHAT"];
|
|
12
17
|
readonly description: "@@@";
|
|
13
18
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
19
|
+
readonly pipelineInterface: {
|
|
20
|
+
readonly inputParameterNames: readonly ["previousTitle", "previousConversationSummary", "userMessage"];
|
|
21
|
+
readonly outputParameterNames: readonly ["title", "conversationSummary", "chatbotResponse"];
|
|
22
|
+
};
|
|
23
|
+
}, {
|
|
24
|
+
readonly name: "TRANSLATOR";
|
|
25
|
+
readonly description: "@@@";
|
|
26
|
+
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
27
|
+
readonly pipelineInterface: {
|
|
28
|
+
readonly inputParameterNames: readonly ["inputMessage"];
|
|
29
|
+
readonly outputParameterNames: readonly ["outputMessage"];
|
|
30
|
+
};
|
|
31
|
+
}, {
|
|
32
|
+
readonly name: "SHEETS";
|
|
33
|
+
readonly description: "@@@";
|
|
34
|
+
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
35
|
+
readonly pipelineInterface: {
|
|
36
|
+
readonly inputParameterNames: readonly ["inputSheet"];
|
|
37
|
+
readonly outputParameterNames: readonly ["outputSheet"];
|
|
38
|
+
};
|
|
14
39
|
}];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sheets is form of app that @@@
|
|
3
|
+
*
|
|
4
|
+
* @public exported from `@promptbook/core`
|
|
5
|
+
*/
|
|
6
|
+
export declare const SheetsFormfactorDefinition: {
|
|
7
|
+
readonly name: "SHEETS";
|
|
8
|
+
readonly description: "@@@";
|
|
9
|
+
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
10
|
+
readonly pipelineInterface: {
|
|
11
|
+
readonly inputParameterNames: readonly ["inputSheet"];
|
|
12
|
+
readonly outputParameterNames: readonly ["outputSheet"];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translator is form of app that @@@
|
|
3
|
+
*
|
|
4
|
+
* @public exported from `@promptbook/core`
|
|
5
|
+
*/
|
|
6
|
+
export declare const TranslatorFormfactorDefinition: {
|
|
7
|
+
readonly name: "TRANSLATOR";
|
|
8
|
+
readonly description: "@@@";
|
|
9
|
+
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
10
|
+
readonly pipelineInterface: {
|
|
11
|
+
readonly inputParameterNames: readonly ["inputMessage"];
|
|
12
|
+
readonly outputParameterNames: readonly ["outputMessage"];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -8,13 +8,13 @@ export type PipelineInterface = {
|
|
|
8
8
|
*
|
|
9
9
|
* Note: Sorted alphabetically
|
|
10
10
|
*/
|
|
11
|
-
inputParameterNames:
|
|
11
|
+
readonly inputParameterNames: ReadonlyArray<string_parameter_name>;
|
|
12
12
|
/**
|
|
13
13
|
* @@@
|
|
14
14
|
*
|
|
15
15
|
* Note: Sorted alphabetically
|
|
16
16
|
*/
|
|
17
|
-
outputParameterNames:
|
|
17
|
+
readonly outputParameterNames: ReadonlyArray<string_parameter_name>;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* TODO: !!!!!! Change inputParameterNames to inputParameters<InputParameter>
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*
|
|
23
23
|
* @see https://github.com/webgptorg/promptbook
|
|
24
24
|
*/
|
|
25
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
25
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.75.0-0';
|
|
26
26
|
/**
|
|
27
27
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
28
28
|
*/
|
|
@@ -912,6 +912,7 @@
|
|
|
912
912
|
// Note: In normal situations, we check the pipeline logic:
|
|
913
913
|
true);
|
|
914
914
|
/**
|
|
915
|
+
* TODO: Extract `constants.ts` from `config.ts`
|
|
915
916
|
* TODO: [π§ ][π§ββοΈ] Maybe join remoteUrl and path into single value
|
|
916
917
|
*/
|
|
917
918
|
|
|
@@ -1154,18 +1155,18 @@
|
|
|
1154
1155
|
}
|
|
1155
1156
|
var _loop_1 = function (parameter) {
|
|
1156
1157
|
if (parameter.isInput && parameter.isOutput) {
|
|
1157
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n\n Parameter {".concat(parameter.name, "} can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1158
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n\n Parameter `{".concat(parameter.name, "}` can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1158
1159
|
}
|
|
1159
1160
|
// Note: Testing that parameter is either intermediate or output BUT not created and unused
|
|
1160
1161
|
if (!parameter.isInput &&
|
|
1161
1162
|
!parameter.isOutput &&
|
|
1162
1163
|
!pipeline.templates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
|
|
1163
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is created but not used\n\n You can declare {").concat(parameter.name, "} as output parameter by adding in the header:\n - OUTPUT PARAMETER `{").concat(parameter.name, "}` ").concat(parameter.description || '', "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
1164
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is created but not used\n\n You can declare {").concat(parameter.name, "} as output parameter by adding in the header:\n - OUTPUT PARAMETER `{").concat(parameter.name, "}` ").concat(parameter.description || '', "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
1164
1165
|
}
|
|
1165
1166
|
// Note: Testing that parameter is either input or result of some template
|
|
1166
1167
|
if (!parameter.isInput &&
|
|
1167
1168
|
!pipeline.templates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
|
|
1168
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is declared but not defined\n\n You can do one of these:\n 1) Remove declaration of {").concat(parameter.name, "}
|
|
1169
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is declared but not defined\n\n You can do one of these:\n 1) Remove declaration of `{").concat(parameter.name, "}`\n 2) Add template that results in `-> {").concat(parameter.name, "}`\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1169
1170
|
}
|
|
1170
1171
|
};
|
|
1171
1172
|
try {
|
|
@@ -1193,7 +1194,7 @@
|
|
|
1193
1194
|
var _loop_2 = function (template) {
|
|
1194
1195
|
var e_4, _h, e_5, _j;
|
|
1195
1196
|
if (definedParameters.has(template.resultingParameterName)) {
|
|
1196
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(template.resultingParameterName, "} is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1197
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(template.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1197
1198
|
}
|
|
1198
1199
|
if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
|
|
1199
1200
|
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
@@ -1206,7 +1207,7 @@
|
|
|
1206
1207
|
}
|
|
1207
1208
|
var _loop_4 = function (joker) {
|
|
1208
1209
|
if (!template.dependentParameterNames.includes(joker)) {
|
|
1209
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(joker, "} is used for {").concat(template.resultingParameterName, "} as joker but not in `dependentParameterNames`\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1210
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(joker, "}` is used for {").concat(template.resultingParameterName, "} as joker but not in `dependentParameterNames`\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1210
1211
|
}
|
|
1211
1212
|
};
|
|
1212
1213
|
try {
|
|
@@ -1301,14 +1302,24 @@
|
|
|
1301
1302
|
if (currentlyResovedTemplates.length === 0) {
|
|
1302
1303
|
throw new PipelineLogicError(
|
|
1303
1304
|
// TODO: [π] DRY
|
|
1304
|
-
spaceTrim.spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve
|
|
1305
|
+
spaceTrim.spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTemplates
|
|
1305
1306
|
.map(function (_a) {
|
|
1306
1307
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
1307
|
-
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
1308
|
-
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
1308
|
+
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
1309
|
+
.map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
|
|
1309
1310
|
.join(' and '));
|
|
1310
1311
|
})
|
|
1311
|
-
.join('\n')), "\n\n Resolved
|
|
1312
|
+
.join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameters
|
|
1313
|
+
.filter(function (name) {
|
|
1314
|
+
return !RESERVED_PARAMETER_NAMES.includes(name);
|
|
1315
|
+
})
|
|
1316
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1317
|
+
.join('\n')), "\n\n\n **Reserved (which are available):**\n ").concat(block(resovedParameters
|
|
1318
|
+
.filter(function (name) {
|
|
1319
|
+
return RESERVED_PARAMETER_NAMES.includes(name);
|
|
1320
|
+
})
|
|
1321
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1322
|
+
.join('\n')), "\n\n\n "); }));
|
|
1312
1323
|
}
|
|
1313
1324
|
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
|
|
1314
1325
|
var resultingParameterName = _a.resultingParameterName;
|
|
@@ -1319,6 +1330,7 @@
|
|
|
1319
1330
|
while (unresovedTemplates.length > 0) {
|
|
1320
1331
|
_loop_3();
|
|
1321
1332
|
}
|
|
1333
|
+
// TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
|
|
1322
1334
|
}
|
|
1323
1335
|
/**
|
|
1324
1336
|
* TODO: !! [π§ββοΈ] Do not allow joker + foreach
|
|
@@ -2674,8 +2686,8 @@
|
|
|
2674
2686
|
else if (errors.length > 1) {
|
|
2675
2687
|
throw new PipelineExecutionError(
|
|
2676
2688
|
// TODO: Tell which execution tools failed like
|
|
2677
|
-
// 1) OpenAI throw PipelineExecutionError: Parameter {knowledge} is not defined
|
|
2678
|
-
// 2) AnthropicClaude throw PipelineExecutionError: Parameter {knowledge} is not defined
|
|
2689
|
+
// 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
2690
|
+
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
2679
2691
|
// 3) ...
|
|
2680
2692
|
spaceTrim__default["default"](function (block) { return "\n All execution tools failed:\n\n ".concat(block(errors
|
|
2681
2693
|
.map(function (error, i) { return "".concat(i + 1, ") **").concat(error.name || 'Error', ":** ").concat(error.message); })
|
|
@@ -4196,11 +4208,11 @@
|
|
|
4196
4208
|
for (var _b = __values(Object.entries(parameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
4197
4209
|
var _d = __read(_c.value, 2), parameterName = _d[0], parameterValue = _d[1];
|
|
4198
4210
|
if (parameterValue === RESERVED_PARAMETER_MISSING_VALUE) {
|
|
4199
|
-
throw new UnexpectedError("Parameter {".concat(parameterName, "} has missing value"));
|
|
4211
|
+
throw new UnexpectedError("Parameter `{".concat(parameterName, "}` has missing value"));
|
|
4200
4212
|
}
|
|
4201
4213
|
else if (parameterValue === RESERVED_PARAMETER_RESTRICTED) {
|
|
4202
4214
|
// TODO: [π΅]
|
|
4203
|
-
throw new UnexpectedError("Parameter {".concat(parameterName, "} is restricted to use"));
|
|
4215
|
+
throw new UnexpectedError("Parameter `{".concat(parameterName, "}` is restricted to use"));
|
|
4204
4216
|
}
|
|
4205
4217
|
}
|
|
4206
4218
|
}
|
|
@@ -4227,11 +4239,11 @@
|
|
|
4227
4239
|
throw new PipelineExecutionError('Parameter is already opened or not closed');
|
|
4228
4240
|
}
|
|
4229
4241
|
if (parameters[parameterName] === undefined) {
|
|
4230
|
-
throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
|
|
4242
|
+
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
4231
4243
|
}
|
|
4232
4244
|
var parameterValue = parameters[parameterName];
|
|
4233
4245
|
if (parameterValue === undefined) {
|
|
4234
|
-
throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
|
|
4246
|
+
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
4235
4247
|
}
|
|
4236
4248
|
parameterValue = parameterValue.toString();
|
|
4237
4249
|
if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
|
|
@@ -4287,6 +4299,9 @@
|
|
|
4287
4299
|
* @public exported from `@promptbook/utils`
|
|
4288
4300
|
*/
|
|
4289
4301
|
var LINES_PER_STANDARD_PAGE = 44;
|
|
4302
|
+
/**
|
|
4303
|
+
* TODO: [π§ ] Should be this `constants.ts` or `config.ts`?
|
|
4304
|
+
*/
|
|
4290
4305
|
|
|
4291
4306
|
/**
|
|
4292
4307
|
* Counts number of lines in the text
|
|
@@ -5018,7 +5033,7 @@
|
|
|
5018
5033
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
5019
5034
|
// Houston, we have a problem
|
|
5020
5035
|
// Note: Checking part is also done in `validatePipeline`, but itβs good to doublecheck
|
|
5021
|
-
throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameterName, "} is NOT defined\n BUT used in template \"").concat(currentTemplate.title || currentTemplate.name, "\"\n\n This should be catched in `validatePipeline`\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
5036
|
+
throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameterName, "}` is NOT defined\n BUT used in template \"").concat(currentTemplate.title || currentTemplate.name, "\"\n\n This should be catched in `validatePipeline`\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
5022
5037
|
}
|
|
5023
5038
|
};
|
|
5024
5039
|
try {
|
|
@@ -5097,7 +5112,7 @@
|
|
|
5097
5112
|
var _loop_1 = function (parameter) {
|
|
5098
5113
|
if (parametersToPass[parameter.name] === undefined) {
|
|
5099
5114
|
// [4]
|
|
5100
|
-
$warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} should be an output parameter, but it was not generated during pipeline execution\n\n ").concat(block(pipelineIdentification), "\n "); })));
|
|
5115
|
+
$warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` should be an output parameter, but it was not generated during pipeline execution\n\n ").concat(block(pipelineIdentification), "\n "); })));
|
|
5101
5116
|
return "continue";
|
|
5102
5117
|
}
|
|
5103
5118
|
outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
|
|
@@ -5184,7 +5199,7 @@
|
|
|
5184
5199
|
case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
|
|
5185
5200
|
isSuccessful: false,
|
|
5186
5201
|
errors: __spreadArray([
|
|
5187
|
-
new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
|
|
5202
|
+
new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
|
|
5188
5203
|
], __read(errors), false).map(serializeError),
|
|
5189
5204
|
warnings: [],
|
|
5190
5205
|
executionReport: executionReport,
|
|
@@ -5232,7 +5247,7 @@
|
|
|
5232
5247
|
case 3: return [2 /*return*/, { value: $asDeeplyFrozenSerializableJson(spaceTrim.spaceTrim(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }), {
|
|
5233
5248
|
isSuccessful: false,
|
|
5234
5249
|
errors: __spreadArray([
|
|
5235
|
-
new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
|
|
5250
|
+
new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
|
|
5236
5251
|
], __read(errors), false).map(serializeError),
|
|
5237
5252
|
warnings: warnings.map(serializeError),
|
|
5238
5253
|
executionReport: executionReport,
|
|
@@ -5306,14 +5321,24 @@
|
|
|
5306
5321
|
if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
|
|
5307
5322
|
throw new UnexpectedError(
|
|
5308
5323
|
// TODO: [π] DRY
|
|
5309
|
-
spaceTrim.spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve
|
|
5324
|
+
spaceTrim.spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTemplates_1
|
|
5310
5325
|
.map(function (_a) {
|
|
5311
5326
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
5312
|
-
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
5313
|
-
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
5327
|
+
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
5328
|
+
.map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
|
|
5314
5329
|
.join(' and '));
|
|
5315
5330
|
})
|
|
5316
|
-
.join('\n')), "\n\n Resolved
|
|
5331
|
+
.join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameterNames_1
|
|
5332
|
+
.filter(function (name) {
|
|
5333
|
+
return !RESERVED_PARAMETER_NAMES.includes(name);
|
|
5334
|
+
})
|
|
5335
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
5336
|
+
.join('\n')), "\n\n **Reserved (which are available):**\n ").concat(block(resovedParameterNames_1
|
|
5337
|
+
.filter(function (name) {
|
|
5338
|
+
return RESERVED_PARAMETER_NAMES.includes(name);
|
|
5339
|
+
})
|
|
5340
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
5341
|
+
.join('\n')), "\n\n *Note: This should be catched in `validatePipeline`*\n "); }));
|
|
5317
5342
|
case 1:
|
|
5318
5343
|
if (!!currentTemplate) return [3 /*break*/, 3];
|
|
5319
5344
|
/* [π€ΉββοΈ] */ return [4 /*yield*/, Promise.race(resolving_1)];
|