@promptbook/legacy-documents 0.92.0-32 β 0.92.0-33
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 +31 -15
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/execution/ExecutionTask.d.ts +19 -1
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +4 -4
- package/esm/typings/src/storage/local-storage/getIndexedDbStorage.d.ts +2 -1
- package/esm/typings/src/storage/local-storage/utils/IndexedDbStorageOptions.d.ts +14 -0
- package/esm/typings/src/storage/local-storage/utils/makePromptbookStorageFromIndexedDb.d.ts +2 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +31 -15
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -28,7 +28,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
28
28
|
* @generated
|
|
29
29
|
* @see https://github.com/webgptorg/promptbook
|
|
30
30
|
*/
|
|
31
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
31
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-33';
|
|
32
32
|
/**
|
|
33
33
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
34
34
|
* Note: [π] Ignore a discrepancy between file name and entity name
|
|
@@ -2675,6 +2675,7 @@ function assertsTaskSuccessful(executionResult) {
|
|
|
2675
2675
|
*/
|
|
2676
2676
|
function createTask(options) {
|
|
2677
2677
|
const { taskType, taskProcessCallback } = options;
|
|
2678
|
+
let { title } = options;
|
|
2678
2679
|
// TODO: [π] DRY
|
|
2679
2680
|
const taskId = `${taskType.toLowerCase().substring(0, 4)}-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */)}`;
|
|
2680
2681
|
let status = 'RUNNING';
|
|
@@ -2686,6 +2687,10 @@ function createTask(options) {
|
|
|
2686
2687
|
const partialResultSubject = new Subject();
|
|
2687
2688
|
// <- Note: Not using `BehaviorSubject` because on error we can't access the last value
|
|
2688
2689
|
const finalResultPromise = /* not await */ taskProcessCallback((newOngoingResult) => {
|
|
2690
|
+
if (newOngoingResult.title) {
|
|
2691
|
+
title = newOngoingResult.title;
|
|
2692
|
+
}
|
|
2693
|
+
updatedAt = new Date();
|
|
2689
2694
|
Object.assign(currentValue, newOngoingResult);
|
|
2690
2695
|
// <- TODO: assign deep
|
|
2691
2696
|
partialResultSubject.next(newOngoingResult);
|
|
@@ -2731,17 +2736,24 @@ function createTask(options) {
|
|
|
2731
2736
|
return {
|
|
2732
2737
|
taskType,
|
|
2733
2738
|
taskId,
|
|
2739
|
+
get promptbookVersion() {
|
|
2740
|
+
return PROMPTBOOK_ENGINE_VERSION;
|
|
2741
|
+
},
|
|
2742
|
+
get title() {
|
|
2743
|
+
return title;
|
|
2744
|
+
// <- Note: [1] Theese must be getters to allow changing the value in the future
|
|
2745
|
+
},
|
|
2734
2746
|
get status() {
|
|
2735
2747
|
return status;
|
|
2736
|
-
// <- Note: [1]
|
|
2748
|
+
// <- Note: [1] --||--
|
|
2737
2749
|
},
|
|
2738
2750
|
get createdAt() {
|
|
2739
2751
|
return createdAt;
|
|
2740
|
-
// <- Note: [1]
|
|
2752
|
+
// <- Note: [1] --||--
|
|
2741
2753
|
},
|
|
2742
2754
|
get updatedAt() {
|
|
2743
2755
|
return updatedAt;
|
|
2744
|
-
// <- Note: [1]
|
|
2756
|
+
// <- Note: [1] --||--
|
|
2745
2757
|
},
|
|
2746
2758
|
asPromise,
|
|
2747
2759
|
asObservable() {
|
|
@@ -2749,15 +2761,15 @@ function createTask(options) {
|
|
|
2749
2761
|
},
|
|
2750
2762
|
get errors() {
|
|
2751
2763
|
return errors;
|
|
2752
|
-
// <- Note: [1]
|
|
2764
|
+
// <- Note: [1] --||--
|
|
2753
2765
|
},
|
|
2754
2766
|
get warnings() {
|
|
2755
2767
|
return warnings;
|
|
2756
|
-
// <- Note: [1]
|
|
2768
|
+
// <- Note: [1] --||--
|
|
2757
2769
|
},
|
|
2758
2770
|
get currentValue() {
|
|
2759
2771
|
return currentValue;
|
|
2760
|
-
// <- Note: [1]
|
|
2772
|
+
// <- Note: [1] --||--
|
|
2761
2773
|
},
|
|
2762
2774
|
};
|
|
2763
2775
|
}
|
|
@@ -5515,7 +5527,7 @@ async function getKnowledgeForTask(options) {
|
|
|
5515
5527
|
});
|
|
5516
5528
|
const knowledgePiecesSorted = knowledgePiecesWithRelevance.sort((a, b) => a.relevance - b.relevance);
|
|
5517
5529
|
const knowledgePiecesLimited = knowledgePiecesSorted.slice(0, 5);
|
|
5518
|
-
console.log('!!! Embedding', {
|
|
5530
|
+
console.log('!!! `getKnowledgeForTask` Embedding', {
|
|
5519
5531
|
task,
|
|
5520
5532
|
taskEmbeddingPrompt,
|
|
5521
5533
|
taskEmbeddingResult,
|
|
@@ -5551,6 +5563,7 @@ async function getKnowledgeForTask(options) {
|
|
|
5551
5563
|
*/
|
|
5552
5564
|
async function getReservedParametersForTask(options) {
|
|
5553
5565
|
const { tools, preparedPipeline, task, parameters, pipelineIdentification } = options;
|
|
5566
|
+
console.log('!!! getReservedParametersForTask', options);
|
|
5554
5567
|
const context = await getContextForTask(); // <- [π]
|
|
5555
5568
|
const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task, parameters });
|
|
5556
5569
|
const examples = await getExamplesForTask();
|
|
@@ -5587,6 +5600,7 @@ async function getReservedParametersForTask(options) {
|
|
|
5587
5600
|
*/
|
|
5588
5601
|
async function executeTask(options) {
|
|
5589
5602
|
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSupressed, } = options;
|
|
5603
|
+
console.log('!!! executeTask', options);
|
|
5590
5604
|
const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
5591
5605
|
// Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but itβs good to doublecheck
|
|
5592
5606
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
@@ -5610,14 +5624,15 @@ async function executeTask(options) {
|
|
|
5610
5624
|
|
|
5611
5625
|
`));
|
|
5612
5626
|
}
|
|
5627
|
+
const reservedParameters = await getReservedParametersForTask({
|
|
5628
|
+
tools,
|
|
5629
|
+
preparedPipeline,
|
|
5630
|
+
task: currentTask,
|
|
5631
|
+
pipelineIdentification,
|
|
5632
|
+
parameters: parametersToPass,
|
|
5633
|
+
});
|
|
5613
5634
|
const definedParameters = Object.freeze({
|
|
5614
|
-
...
|
|
5615
|
-
tools,
|
|
5616
|
-
preparedPipeline,
|
|
5617
|
-
task: currentTask,
|
|
5618
|
-
pipelineIdentification,
|
|
5619
|
-
parameters: parametersToPass,
|
|
5620
|
-
})),
|
|
5635
|
+
...reservedParameters,
|
|
5621
5636
|
...parametersToPass,
|
|
5622
5637
|
});
|
|
5623
5638
|
const definedParameterNames = new Set(Object.keys(definedParameters));
|
|
@@ -6064,6 +6079,7 @@ function createPipelineExecutor(options) {
|
|
|
6064
6079
|
};
|
|
6065
6080
|
const pipelineExecutor = (inputParameters) => createTask({
|
|
6066
6081
|
taskType: 'EXECUTION',
|
|
6082
|
+
title: pipeline.title,
|
|
6067
6083
|
taskProcessCallback(updateOngoingResult) {
|
|
6068
6084
|
return pipelineExecutorWithCallback(inputParameters, async (newOngoingResult) => {
|
|
6069
6085
|
updateOngoingResult(newOngoingResult);
|