@promptbook/pdf 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 +2 -2
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/pdf",
|
|
3
|
-
"version": "0.75.0-
|
|
3
|
+
"version": "0.75.0-1",
|
|
4
4
|
"description": "Supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"module": "./esm/index.es.js",
|
|
54
54
|
"typings": "./esm/typings/src/_packages/pdf.index.d.ts",
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@promptbook/core": "0.75.0-
|
|
56
|
+
"@promptbook/core": "0.75.0-1"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"crypto-js": "4.2.0",
|
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
|
*/
|
|
@@ -726,6 +726,7 @@
|
|
|
726
726
|
// Note: In normal situations, we check the pipeline logic:
|
|
727
727
|
true);
|
|
728
728
|
/**
|
|
729
|
+
* TODO: Extract `constants.ts` from `config.ts`
|
|
729
730
|
* TODO: [π§ ][π§ββοΈ] Maybe join remoteUrl and path into single value
|
|
730
731
|
*/
|
|
731
732
|
|
|
@@ -987,18 +988,18 @@
|
|
|
987
988
|
}
|
|
988
989
|
var _loop_1 = function (parameter) {
|
|
989
990
|
if (parameter.isInput && parameter.isOutput) {
|
|
990
|
-
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 "); }));
|
|
991
|
+
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 "); }));
|
|
991
992
|
}
|
|
992
993
|
// Note: Testing that parameter is either intermediate or output BUT not created and unused
|
|
993
994
|
if (!parameter.isInput &&
|
|
994
995
|
!parameter.isOutput &&
|
|
995
996
|
!pipeline.templates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
|
|
996
|
-
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 "); }));
|
|
997
|
+
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 "); }));
|
|
997
998
|
}
|
|
998
999
|
// Note: Testing that parameter is either input or result of some template
|
|
999
1000
|
if (!parameter.isInput &&
|
|
1000
1001
|
!pipeline.templates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
|
|
1001
|
-
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, "}
|
|
1002
|
+
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 "); }));
|
|
1002
1003
|
}
|
|
1003
1004
|
};
|
|
1004
1005
|
try {
|
|
@@ -1026,7 +1027,7 @@
|
|
|
1026
1027
|
var _loop_2 = function (template) {
|
|
1027
1028
|
var e_4, _h, e_5, _j;
|
|
1028
1029
|
if (definedParameters.has(template.resultingParameterName)) {
|
|
1029
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(template.resultingParameterName, "} is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1030
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(template.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1030
1031
|
}
|
|
1031
1032
|
if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
|
|
1032
1033
|
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 "); }));
|
|
@@ -1039,7 +1040,7 @@
|
|
|
1039
1040
|
}
|
|
1040
1041
|
var _loop_4 = function (joker) {
|
|
1041
1042
|
if (!template.dependentParameterNames.includes(joker)) {
|
|
1042
|
-
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 "); }));
|
|
1043
|
+
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 "); }));
|
|
1043
1044
|
}
|
|
1044
1045
|
};
|
|
1045
1046
|
try {
|
|
@@ -1134,14 +1135,24 @@
|
|
|
1134
1135
|
if (currentlyResovedTemplates.length === 0) {
|
|
1135
1136
|
throw new PipelineLogicError(
|
|
1136
1137
|
// TODO: [π] DRY
|
|
1137
|
-
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
|
|
1138
|
+
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
|
|
1138
1139
|
.map(function (_a) {
|
|
1139
1140
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
1140
|
-
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
1141
|
-
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
1141
|
+
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
1142
|
+
.map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
|
|
1142
1143
|
.join(' and '));
|
|
1143
1144
|
})
|
|
1144
|
-
.join('\n')), "\n\n Resolved
|
|
1145
|
+
.join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameters
|
|
1146
|
+
.filter(function (name) {
|
|
1147
|
+
return !RESERVED_PARAMETER_NAMES.includes(name);
|
|
1148
|
+
})
|
|
1149
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1150
|
+
.join('\n')), "\n\n\n **Reserved (which are available):**\n ").concat(block(resovedParameters
|
|
1151
|
+
.filter(function (name) {
|
|
1152
|
+
return RESERVED_PARAMETER_NAMES.includes(name);
|
|
1153
|
+
})
|
|
1154
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1155
|
+
.join('\n')), "\n\n\n "); }));
|
|
1145
1156
|
}
|
|
1146
1157
|
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
|
|
1147
1158
|
var resultingParameterName = _a.resultingParameterName;
|
|
@@ -1152,6 +1163,7 @@
|
|
|
1152
1163
|
while (unresovedTemplates.length > 0) {
|
|
1153
1164
|
_loop_3();
|
|
1154
1165
|
}
|
|
1166
|
+
// TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
|
|
1155
1167
|
}
|
|
1156
1168
|
/**
|
|
1157
1169
|
* TODO: !! [π§ββοΈ] Do not allow joker + foreach
|
|
@@ -2491,8 +2503,8 @@
|
|
|
2491
2503
|
else if (errors.length > 1) {
|
|
2492
2504
|
throw new PipelineExecutionError(
|
|
2493
2505
|
// TODO: Tell which execution tools failed like
|
|
2494
|
-
// 1) OpenAI throw PipelineExecutionError: Parameter {knowledge} is not defined
|
|
2495
|
-
// 2) AnthropicClaude throw PipelineExecutionError: Parameter {knowledge} is not defined
|
|
2506
|
+
// 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
2507
|
+
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
2496
2508
|
// 3) ...
|
|
2497
2509
|
spaceTrim__default["default"](function (block) { return "\n All execution tools failed:\n\n ".concat(block(errors
|
|
2498
2510
|
.map(function (error, i) { return "".concat(i + 1, ") **").concat(error.name || 'Error', ":** ").concat(error.message); })
|
|
@@ -4150,11 +4162,11 @@
|
|
|
4150
4162
|
for (var _b = __values(Object.entries(parameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
4151
4163
|
var _d = __read(_c.value, 2), parameterName = _d[0], parameterValue = _d[1];
|
|
4152
4164
|
if (parameterValue === RESERVED_PARAMETER_MISSING_VALUE) {
|
|
4153
|
-
throw new UnexpectedError("Parameter {".concat(parameterName, "} has missing value"));
|
|
4165
|
+
throw new UnexpectedError("Parameter `{".concat(parameterName, "}` has missing value"));
|
|
4154
4166
|
}
|
|
4155
4167
|
else if (parameterValue === RESERVED_PARAMETER_RESTRICTED) {
|
|
4156
4168
|
// TODO: [π΅]
|
|
4157
|
-
throw new UnexpectedError("Parameter {".concat(parameterName, "} is restricted to use"));
|
|
4169
|
+
throw new UnexpectedError("Parameter `{".concat(parameterName, "}` is restricted to use"));
|
|
4158
4170
|
}
|
|
4159
4171
|
}
|
|
4160
4172
|
}
|
|
@@ -4181,11 +4193,11 @@
|
|
|
4181
4193
|
throw new PipelineExecutionError('Parameter is already opened or not closed');
|
|
4182
4194
|
}
|
|
4183
4195
|
if (parameters[parameterName] === undefined) {
|
|
4184
|
-
throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
|
|
4196
|
+
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
4185
4197
|
}
|
|
4186
4198
|
var parameterValue = parameters[parameterName];
|
|
4187
4199
|
if (parameterValue === undefined) {
|
|
4188
|
-
throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
|
|
4200
|
+
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
4189
4201
|
}
|
|
4190
4202
|
parameterValue = parameterValue.toString();
|
|
4191
4203
|
if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
|
|
@@ -4241,6 +4253,9 @@
|
|
|
4241
4253
|
* @public exported from `@promptbook/utils`
|
|
4242
4254
|
*/
|
|
4243
4255
|
var LINES_PER_STANDARD_PAGE = 44;
|
|
4256
|
+
/**
|
|
4257
|
+
* TODO: [π§ ] Should be this `constants.ts` or `config.ts`?
|
|
4258
|
+
*/
|
|
4244
4259
|
|
|
4245
4260
|
/**
|
|
4246
4261
|
* Counts number of lines in the text
|
|
@@ -4972,7 +4987,7 @@
|
|
|
4972
4987
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
4973
4988
|
// Houston, we have a problem
|
|
4974
4989
|
// Note: Checking part is also done in `validatePipeline`, but itβs good to doublecheck
|
|
4975
|
-
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 "); }));
|
|
4990
|
+
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 "); }));
|
|
4976
4991
|
}
|
|
4977
4992
|
};
|
|
4978
4993
|
try {
|
|
@@ -5051,7 +5066,7 @@
|
|
|
5051
5066
|
var _loop_1 = function (parameter) {
|
|
5052
5067
|
if (parametersToPass[parameter.name] === undefined) {
|
|
5053
5068
|
// [4]
|
|
5054
|
-
$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 "); })));
|
|
5069
|
+
$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 "); })));
|
|
5055
5070
|
return "continue";
|
|
5056
5071
|
}
|
|
5057
5072
|
outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
|
|
@@ -5138,7 +5153,7 @@
|
|
|
5138
5153
|
case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
|
|
5139
5154
|
isSuccessful: false,
|
|
5140
5155
|
errors: __spreadArray([
|
|
5141
|
-
new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
|
|
5156
|
+
new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
|
|
5142
5157
|
], __read(errors), false).map(serializeError),
|
|
5143
5158
|
warnings: [],
|
|
5144
5159
|
executionReport: executionReport,
|
|
@@ -5186,7 +5201,7 @@
|
|
|
5186
5201
|
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 "); }), {
|
|
5187
5202
|
isSuccessful: false,
|
|
5188
5203
|
errors: __spreadArray([
|
|
5189
|
-
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 "); }))
|
|
5204
|
+
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 "); }))
|
|
5190
5205
|
], __read(errors), false).map(serializeError),
|
|
5191
5206
|
warnings: warnings.map(serializeError),
|
|
5192
5207
|
executionReport: executionReport,
|
|
@@ -5260,14 +5275,24 @@
|
|
|
5260
5275
|
if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
|
|
5261
5276
|
throw new UnexpectedError(
|
|
5262
5277
|
// TODO: [π] DRY
|
|
5263
|
-
spaceTrim.spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve
|
|
5278
|
+
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
|
|
5264
5279
|
.map(function (_a) {
|
|
5265
5280
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
5266
|
-
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
5267
|
-
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
5281
|
+
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
5282
|
+
.map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
|
|
5268
5283
|
.join(' and '));
|
|
5269
5284
|
})
|
|
5270
|
-
.join('\n')), "\n\n Resolved
|
|
5285
|
+
.join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameterNames_1
|
|
5286
|
+
.filter(function (name) {
|
|
5287
|
+
return !RESERVED_PARAMETER_NAMES.includes(name);
|
|
5288
|
+
})
|
|
5289
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
5290
|
+
.join('\n')), "\n\n **Reserved (which are available):**\n ").concat(block(resovedParameterNames_1
|
|
5291
|
+
.filter(function (name) {
|
|
5292
|
+
return RESERVED_PARAMETER_NAMES.includes(name);
|
|
5293
|
+
})
|
|
5294
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
5295
|
+
.join('\n')), "\n\n *Note: This should be catched in `validatePipeline`*\n "); }));
|
|
5271
5296
|
case 1:
|
|
5272
5297
|
if (!!currentTemplate) return [3 /*break*/, 3];
|
|
5273
5298
|
/* [π€ΉββοΈ] */ return [4 /*yield*/, Promise.race(resolving_1)];
|