@promptbook/node 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
|
@@ -30,7 +30,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
30
30
|
* @generated
|
|
31
31
|
* @see https://github.com/webgptorg/promptbook
|
|
32
32
|
*/
|
|
33
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
33
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-33';
|
|
34
34
|
/**
|
|
35
35
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
36
36
|
* Note: [π] Ignore a discrepancy between file name and entity name
|
|
@@ -2086,6 +2086,7 @@ function assertsTaskSuccessful(executionResult) {
|
|
|
2086
2086
|
*/
|
|
2087
2087
|
function createTask(options) {
|
|
2088
2088
|
const { taskType, taskProcessCallback } = options;
|
|
2089
|
+
let { title } = options;
|
|
2089
2090
|
// TODO: [π] DRY
|
|
2090
2091
|
const taskId = `${taskType.toLowerCase().substring(0, 4)}-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */)}`;
|
|
2091
2092
|
let status = 'RUNNING';
|
|
@@ -2097,6 +2098,10 @@ function createTask(options) {
|
|
|
2097
2098
|
const partialResultSubject = new Subject();
|
|
2098
2099
|
// <- Note: Not using `BehaviorSubject` because on error we can't access the last value
|
|
2099
2100
|
const finalResultPromise = /* not await */ taskProcessCallback((newOngoingResult) => {
|
|
2101
|
+
if (newOngoingResult.title) {
|
|
2102
|
+
title = newOngoingResult.title;
|
|
2103
|
+
}
|
|
2104
|
+
updatedAt = new Date();
|
|
2100
2105
|
Object.assign(currentValue, newOngoingResult);
|
|
2101
2106
|
// <- TODO: assign deep
|
|
2102
2107
|
partialResultSubject.next(newOngoingResult);
|
|
@@ -2142,17 +2147,24 @@ function createTask(options) {
|
|
|
2142
2147
|
return {
|
|
2143
2148
|
taskType,
|
|
2144
2149
|
taskId,
|
|
2150
|
+
get promptbookVersion() {
|
|
2151
|
+
return PROMPTBOOK_ENGINE_VERSION;
|
|
2152
|
+
},
|
|
2153
|
+
get title() {
|
|
2154
|
+
return title;
|
|
2155
|
+
// <- Note: [1] Theese must be getters to allow changing the value in the future
|
|
2156
|
+
},
|
|
2145
2157
|
get status() {
|
|
2146
2158
|
return status;
|
|
2147
|
-
// <- Note: [1]
|
|
2159
|
+
// <- Note: [1] --||--
|
|
2148
2160
|
},
|
|
2149
2161
|
get createdAt() {
|
|
2150
2162
|
return createdAt;
|
|
2151
|
-
// <- Note: [1]
|
|
2163
|
+
// <- Note: [1] --||--
|
|
2152
2164
|
},
|
|
2153
2165
|
get updatedAt() {
|
|
2154
2166
|
return updatedAt;
|
|
2155
|
-
// <- Note: [1]
|
|
2167
|
+
// <- Note: [1] --||--
|
|
2156
2168
|
},
|
|
2157
2169
|
asPromise,
|
|
2158
2170
|
asObservable() {
|
|
@@ -2160,15 +2172,15 @@ function createTask(options) {
|
|
|
2160
2172
|
},
|
|
2161
2173
|
get errors() {
|
|
2162
2174
|
return errors;
|
|
2163
|
-
// <- Note: [1]
|
|
2175
|
+
// <- Note: [1] --||--
|
|
2164
2176
|
},
|
|
2165
2177
|
get warnings() {
|
|
2166
2178
|
return warnings;
|
|
2167
|
-
// <- Note: [1]
|
|
2179
|
+
// <- Note: [1] --||--
|
|
2168
2180
|
},
|
|
2169
2181
|
get currentValue() {
|
|
2170
2182
|
return currentValue;
|
|
2171
|
-
// <- Note: [1]
|
|
2183
|
+
// <- Note: [1] --||--
|
|
2172
2184
|
},
|
|
2173
2185
|
};
|
|
2174
2186
|
}
|
|
@@ -4280,7 +4292,7 @@ async function getKnowledgeForTask(options) {
|
|
|
4280
4292
|
});
|
|
4281
4293
|
const knowledgePiecesSorted = knowledgePiecesWithRelevance.sort((a, b) => a.relevance - b.relevance);
|
|
4282
4294
|
const knowledgePiecesLimited = knowledgePiecesSorted.slice(0, 5);
|
|
4283
|
-
console.log('!!! Embedding', {
|
|
4295
|
+
console.log('!!! `getKnowledgeForTask` Embedding', {
|
|
4284
4296
|
task,
|
|
4285
4297
|
taskEmbeddingPrompt,
|
|
4286
4298
|
taskEmbeddingResult,
|
|
@@ -4316,6 +4328,7 @@ async function getKnowledgeForTask(options) {
|
|
|
4316
4328
|
*/
|
|
4317
4329
|
async function getReservedParametersForTask(options) {
|
|
4318
4330
|
const { tools, preparedPipeline, task, parameters, pipelineIdentification } = options;
|
|
4331
|
+
console.log('!!! getReservedParametersForTask', options);
|
|
4319
4332
|
const context = await getContextForTask(); // <- [π]
|
|
4320
4333
|
const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task, parameters });
|
|
4321
4334
|
const examples = await getExamplesForTask();
|
|
@@ -4352,6 +4365,7 @@ async function getReservedParametersForTask(options) {
|
|
|
4352
4365
|
*/
|
|
4353
4366
|
async function executeTask(options) {
|
|
4354
4367
|
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSupressed, } = options;
|
|
4368
|
+
console.log('!!! executeTask', options);
|
|
4355
4369
|
const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
4356
4370
|
// Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but itβs good to doublecheck
|
|
4357
4371
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
@@ -4375,14 +4389,15 @@ async function executeTask(options) {
|
|
|
4375
4389
|
|
|
4376
4390
|
`));
|
|
4377
4391
|
}
|
|
4392
|
+
const reservedParameters = await getReservedParametersForTask({
|
|
4393
|
+
tools,
|
|
4394
|
+
preparedPipeline,
|
|
4395
|
+
task: currentTask,
|
|
4396
|
+
pipelineIdentification,
|
|
4397
|
+
parameters: parametersToPass,
|
|
4398
|
+
});
|
|
4378
4399
|
const definedParameters = Object.freeze({
|
|
4379
|
-
...
|
|
4380
|
-
tools,
|
|
4381
|
-
preparedPipeline,
|
|
4382
|
-
task: currentTask,
|
|
4383
|
-
pipelineIdentification,
|
|
4384
|
-
parameters: parametersToPass,
|
|
4385
|
-
})),
|
|
4400
|
+
...reservedParameters,
|
|
4386
4401
|
...parametersToPass,
|
|
4387
4402
|
});
|
|
4388
4403
|
const definedParameterNames = new Set(Object.keys(definedParameters));
|
|
@@ -4829,6 +4844,7 @@ function createPipelineExecutor(options) {
|
|
|
4829
4844
|
};
|
|
4830
4845
|
const pipelineExecutor = (inputParameters) => createTask({
|
|
4831
4846
|
taskType: 'EXECUTION',
|
|
4847
|
+
title: pipeline.title,
|
|
4832
4848
|
taskProcessCallback(updateOngoingResult) {
|
|
4833
4849
|
return pipelineExecutorWithCallback(inputParameters, async (newOngoingResult) => {
|
|
4834
4850
|
updateOngoingResult(newOngoingResult);
|