@promptbook/core 0.92.0-29 → 0.92.0-30
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 +60 -43
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +2 -2
- package/esm/typings/src/config.d.ts +1 -1
- package/esm/typings/src/remote-server/openapi.d.ts +1 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +64 -47
- package/umd/index.umd.js.map +1 -1
|
@@ -35,7 +35,7 @@ import { DEFAULT_IS_VERBOSE } from '../config';
|
|
|
35
35
|
import { SET_IS_VERBOSE } from '../config';
|
|
36
36
|
import { DEFAULT_IS_AUTO_INSTALLED } from '../config';
|
|
37
37
|
import { DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME } from '../config';
|
|
38
|
-
import {
|
|
38
|
+
import { DEFAULT_MAX_REQUESTS_PER_MINUTE } from '../config';
|
|
39
39
|
import { MODEL_TRUST_LEVELS } from '../constants';
|
|
40
40
|
import { MODEL_ORDERS } from '../constants';
|
|
41
41
|
import { ORDER_OF_PIPELINE_JSON } from '../constants';
|
|
@@ -182,7 +182,7 @@ export { DEFAULT_IS_VERBOSE };
|
|
|
182
182
|
export { SET_IS_VERBOSE };
|
|
183
183
|
export { DEFAULT_IS_AUTO_INSTALLED };
|
|
184
184
|
export { DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME };
|
|
185
|
-
export {
|
|
185
|
+
export { DEFAULT_MAX_REQUESTS_PER_MINUTE };
|
|
186
186
|
export { MODEL_TRUST_LEVELS };
|
|
187
187
|
export { MODEL_ORDERS };
|
|
188
188
|
export { ORDER_OF_PIPELINE_JSON };
|
|
@@ -294,7 +294,7 @@ export declare const DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME = "getPipelin
|
|
|
294
294
|
*
|
|
295
295
|
* @public exported from `@promptbook/core`
|
|
296
296
|
*/
|
|
297
|
-
export declare const
|
|
297
|
+
export declare const DEFAULT_MAX_REQUESTS_PER_MINUTE = 60;
|
|
298
298
|
/**
|
|
299
299
|
* Indicates whether pipeline logic validation is enabled. When true, the pipeline logic is checked for consistency.
|
|
300
300
|
*
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.92.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.92.0-29`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* @generated
|
|
28
28
|
* @see https://github.com/webgptorg/promptbook
|
|
29
29
|
*/
|
|
30
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
30
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-30';
|
|
31
31
|
/**
|
|
32
32
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
33
33
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -493,7 +493,7 @@
|
|
|
493
493
|
*
|
|
494
494
|
* @public exported from `@promptbook/core`
|
|
495
495
|
*/
|
|
496
|
-
const
|
|
496
|
+
const DEFAULT_MAX_REQUESTS_PER_MINUTE = 60;
|
|
497
497
|
/**
|
|
498
498
|
* Indicates whether pipeline logic validation is enabled. When true, the pipeline logic is checked for consistency.
|
|
499
499
|
*
|
|
@@ -2918,13 +2918,10 @@
|
|
|
2918
2918
|
if (onProgress) {
|
|
2919
2919
|
// Note: Report the CSV with all rows mapped so far
|
|
2920
2920
|
/*
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
);
|
|
2926
|
-
|
|
2927
|
-
|
|
2921
|
+
// TODO: [🛕] Report progress with all the rows including the pending ones
|
|
2922
|
+
const progressData = mappedData.map((row, i) =>
|
|
2923
|
+
i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
|
|
2924
|
+
);
|
|
2928
2925
|
*/
|
|
2929
2926
|
await onProgress(papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
2930
2927
|
}
|
|
@@ -9777,24 +9774,25 @@
|
|
|
9777
9774
|
*/
|
|
9778
9775
|
function renderPromptbookMermaid(pipelineJson, options) {
|
|
9779
9776
|
const { linkTask = () => null } = options || {};
|
|
9780
|
-
const MERMAID_PREFIX = '
|
|
9781
|
-
const
|
|
9782
|
-
const
|
|
9777
|
+
const MERMAID_PREFIX = 'pipeline_';
|
|
9778
|
+
const MERMAID_KNOWLEDGE_NAME = MERMAID_PREFIX + 'knowledge';
|
|
9779
|
+
const MERMAID_RESERVED_NAME = MERMAID_PREFIX + 'reserved';
|
|
9780
|
+
const MERMAID_INPUT_NAME = MERMAID_PREFIX + 'input';
|
|
9781
|
+
const MERMAID_OUTPUT_NAME = MERMAID_PREFIX + 'output';
|
|
9783
9782
|
const parameterNameToTaskName = (parameterName) => {
|
|
9784
9783
|
if (parameterName === 'knowledge') {
|
|
9785
|
-
return
|
|
9786
|
-
// <- TODO: !!!! Check that this works
|
|
9784
|
+
return MERMAID_KNOWLEDGE_NAME;
|
|
9787
9785
|
}
|
|
9788
9786
|
else if (RESERVED_PARAMETER_NAMES.includes(parameterName)) {
|
|
9789
|
-
return
|
|
9787
|
+
return MERMAID_RESERVED_NAME;
|
|
9790
9788
|
}
|
|
9791
9789
|
const parameter = pipelineJson.parameters.find((parameter) => parameter.name === parameterName);
|
|
9792
9790
|
if (!parameter) {
|
|
9793
9791
|
throw new UnexpectedError(`Could not find {${parameterName}}`);
|
|
9794
|
-
// <- TODO:
|
|
9792
|
+
// <- TODO: This causes problems when {knowledge} and other reserved parameters are used
|
|
9795
9793
|
}
|
|
9796
9794
|
if (parameter.isInput) {
|
|
9797
|
-
return
|
|
9795
|
+
return MERMAID_INPUT_NAME;
|
|
9798
9796
|
}
|
|
9799
9797
|
const task = pipelineJson.tasks.find((task) => task.resultingParameterName === parameterName);
|
|
9800
9798
|
if (!task) {
|
|
@@ -9802,6 +9800,37 @@
|
|
|
9802
9800
|
}
|
|
9803
9801
|
return MERMAID_PREFIX + (task.name || normalizeTo_camelCase('task-' + titleToName(task.title)));
|
|
9804
9802
|
};
|
|
9803
|
+
const inputAndIntermediateParametersMermaid = pipelineJson.tasks
|
|
9804
|
+
.flatMap(({ title, dependentParameterNames, resultingParameterName }) => [
|
|
9805
|
+
`${parameterNameToTaskName(resultingParameterName)}("${title}")`,
|
|
9806
|
+
...dependentParameterNames.map((dependentParameterName) => `${parameterNameToTaskName(dependentParameterName)}--"{${dependentParameterName}}"-->${parameterNameToTaskName(resultingParameterName)}`),
|
|
9807
|
+
])
|
|
9808
|
+
.join('\n');
|
|
9809
|
+
const outputParametersMermaid = pipelineJson.parameters
|
|
9810
|
+
.filter(({ isOutput }) => isOutput)
|
|
9811
|
+
.map(({ name }) => `${parameterNameToTaskName(name)}--"{${name}}"-->${MERMAID_OUTPUT_NAME}`)
|
|
9812
|
+
.join('\n');
|
|
9813
|
+
const linksMermaid = pipelineJson.tasks
|
|
9814
|
+
.map((task) => {
|
|
9815
|
+
const link = linkTask(task);
|
|
9816
|
+
if (link === null) {
|
|
9817
|
+
return '';
|
|
9818
|
+
}
|
|
9819
|
+
const { href, title } = link;
|
|
9820
|
+
const taskName = parameterNameToTaskName(task.resultingParameterName);
|
|
9821
|
+
return `click ${taskName} href "${href}" "${title}";`;
|
|
9822
|
+
})
|
|
9823
|
+
.filter((line) => line !== '')
|
|
9824
|
+
.join('\n');
|
|
9825
|
+
const interactionPointsMermaid = Object.entries({
|
|
9826
|
+
[MERMAID_INPUT_NAME]: 'Input',
|
|
9827
|
+
[MERMAID_OUTPUT_NAME]: 'Output',
|
|
9828
|
+
[MERMAID_RESERVED_NAME]: 'Other',
|
|
9829
|
+
[MERMAID_KNOWLEDGE_NAME]: 'Knowledge',
|
|
9830
|
+
})
|
|
9831
|
+
.filter(([MERMAID_NAME]) => (inputAndIntermediateParametersMermaid + outputParametersMermaid).includes(MERMAID_NAME))
|
|
9832
|
+
.map(([MERMAID_NAME, title]) => `${MERMAID_NAME}((${title})):::${MERMAID_NAME}`)
|
|
9833
|
+
.join('\n');
|
|
9805
9834
|
const promptbookMermaid = spaceTrim.spaceTrim((block) => `
|
|
9806
9835
|
|
|
9807
9836
|
%% 🔮 Tip: Open this on GitHub or in the VSCode website to see the Mermaid graph visually
|
|
@@ -9809,39 +9838,27 @@
|
|
|
9809
9838
|
flowchart LR
|
|
9810
9839
|
subgraph "${pipelineJson.title}"
|
|
9811
9840
|
|
|
9841
|
+
%% Basic configuration
|
|
9812
9842
|
direction TB
|
|
9813
9843
|
|
|
9814
|
-
|
|
9815
|
-
${
|
|
9816
|
-
${KNOWLEDGE_NAME}((Knowledgebase)):::${KNOWLEDGE_NAME}
|
|
9817
|
-
${block(pipelineJson.tasks
|
|
9818
|
-
.flatMap(({ title, dependentParameterNames, resultingParameterName }) => [
|
|
9819
|
-
`${parameterNameToTaskName(resultingParameterName)}("${title}")`,
|
|
9820
|
-
...dependentParameterNames.map((dependentParameterName) => `${parameterNameToTaskName(dependentParameterName)}--"{${dependentParameterName}}"-->${parameterNameToTaskName(resultingParameterName)}`),
|
|
9821
|
-
])
|
|
9822
|
-
.join('\n'))}
|
|
9844
|
+
%% Interaction points from pipeline to outside
|
|
9845
|
+
${block(interactionPointsMermaid)}
|
|
9823
9846
|
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
.map(({ name }) => `${parameterNameToTaskName(name)}--"{${name}}"-->output`)
|
|
9827
|
-
.join('\n'))}
|
|
9828
|
-
output((Output)):::output
|
|
9847
|
+
%% Input and intermediate parameters
|
|
9848
|
+
${block(inputAndIntermediateParametersMermaid)}
|
|
9829
9849
|
|
|
9830
|
-
${block(pipelineJson.tasks
|
|
9831
|
-
.map((task) => {
|
|
9832
|
-
const link = linkTask(task);
|
|
9833
|
-
if (link === null) {
|
|
9834
|
-
return '';
|
|
9835
|
-
}
|
|
9836
|
-
const { href, title } = link;
|
|
9837
|
-
const taskName = parameterNameToTaskName(task.resultingParameterName);
|
|
9838
|
-
return `click ${taskName} href "${href}" "${title}";`;
|
|
9839
|
-
})
|
|
9840
|
-
.filter((line) => line !== '')
|
|
9841
|
-
.join('\n'))}
|
|
9842
9850
|
|
|
9843
|
-
|
|
9844
|
-
|
|
9851
|
+
%% Output parameters
|
|
9852
|
+
${block(outputParametersMermaid)}
|
|
9853
|
+
|
|
9854
|
+
%% Links
|
|
9855
|
+
${block(linksMermaid)}
|
|
9856
|
+
|
|
9857
|
+
%% Styles
|
|
9858
|
+
classDef ${MERMAID_INPUT_NAME} color: grey;
|
|
9859
|
+
classDef ${MERMAID_OUTPUT_NAME} color: grey;
|
|
9860
|
+
classDef ${MERMAID_RESERVED_NAME} color: grey;
|
|
9861
|
+
classDef ${MERMAID_KNOWLEDGE_NAME} color: grey;
|
|
9845
9862
|
|
|
9846
9863
|
end;
|
|
9847
9864
|
|
|
@@ -11088,7 +11105,7 @@
|
|
|
11088
11105
|
className: 'OpenAiExecutionTools',
|
|
11089
11106
|
options: {
|
|
11090
11107
|
apiKey: 'sk-',
|
|
11091
|
-
maxRequestsPerMinute:
|
|
11108
|
+
maxRequestsPerMinute: DEFAULT_MAX_REQUESTS_PER_MINUTE,
|
|
11092
11109
|
},
|
|
11093
11110
|
};
|
|
11094
11111
|
},
|
|
@@ -11671,10 +11688,10 @@
|
|
|
11671
11688
|
exports.DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH = DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH;
|
|
11672
11689
|
exports.DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL = DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL;
|
|
11673
11690
|
exports.DEFAULT_MAX_PARALLEL_COUNT = DEFAULT_MAX_PARALLEL_COUNT;
|
|
11691
|
+
exports.DEFAULT_MAX_REQUESTS_PER_MINUTE = DEFAULT_MAX_REQUESTS_PER_MINUTE;
|
|
11674
11692
|
exports.DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME = DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME;
|
|
11675
11693
|
exports.DEFAULT_PROMPT_TASK_TITLE = DEFAULT_PROMPT_TASK_TITLE;
|
|
11676
11694
|
exports.DEFAULT_REMOTE_SERVER_URL = DEFAULT_REMOTE_SERVER_URL;
|
|
11677
|
-
exports.DEFAULT_RPM = DEFAULT_RPM;
|
|
11678
11695
|
exports.DEFAULT_SCRAPE_CACHE_DIRNAME = DEFAULT_SCRAPE_CACHE_DIRNAME;
|
|
11679
11696
|
exports.DEFAULT_TASK_TITLE = DEFAULT_TASK_TITLE;
|
|
11680
11697
|
exports.EXPECTATION_UNITS = EXPECTATION_UNITS;
|