@promptbook/cli 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 +46 -23
- 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 +1 -1
- package/umd/index.umd.js +46 -23
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -47,7 +47,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
47
47
|
* @generated
|
|
48
48
|
* @see https://github.com/webgptorg/promptbook
|
|
49
49
|
*/
|
|
50
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
50
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-33';
|
|
51
51
|
/**
|
|
52
52
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
53
53
|
* Note: [π] Ignore a discrepancy between file name and entity name
|
|
@@ -5174,6 +5174,7 @@ function assertsTaskSuccessful(executionResult) {
|
|
|
5174
5174
|
*/
|
|
5175
5175
|
function createTask(options) {
|
|
5176
5176
|
const { taskType, taskProcessCallback } = options;
|
|
5177
|
+
let { title } = options;
|
|
5177
5178
|
// TODO: [π] DRY
|
|
5178
5179
|
const taskId = `${taskType.toLowerCase().substring(0, 4)}-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */)}`;
|
|
5179
5180
|
let status = 'RUNNING';
|
|
@@ -5185,6 +5186,10 @@ function createTask(options) {
|
|
|
5185
5186
|
const partialResultSubject = new Subject();
|
|
5186
5187
|
// <- Note: Not using `BehaviorSubject` because on error we can't access the last value
|
|
5187
5188
|
const finalResultPromise = /* not await */ taskProcessCallback((newOngoingResult) => {
|
|
5189
|
+
if (newOngoingResult.title) {
|
|
5190
|
+
title = newOngoingResult.title;
|
|
5191
|
+
}
|
|
5192
|
+
updatedAt = new Date();
|
|
5188
5193
|
Object.assign(currentValue, newOngoingResult);
|
|
5189
5194
|
// <- TODO: assign deep
|
|
5190
5195
|
partialResultSubject.next(newOngoingResult);
|
|
@@ -5230,17 +5235,24 @@ function createTask(options) {
|
|
|
5230
5235
|
return {
|
|
5231
5236
|
taskType,
|
|
5232
5237
|
taskId,
|
|
5238
|
+
get promptbookVersion() {
|
|
5239
|
+
return PROMPTBOOK_ENGINE_VERSION;
|
|
5240
|
+
},
|
|
5241
|
+
get title() {
|
|
5242
|
+
return title;
|
|
5243
|
+
// <- Note: [1] Theese must be getters to allow changing the value in the future
|
|
5244
|
+
},
|
|
5233
5245
|
get status() {
|
|
5234
5246
|
return status;
|
|
5235
|
-
// <- Note: [1]
|
|
5247
|
+
// <- Note: [1] --||--
|
|
5236
5248
|
},
|
|
5237
5249
|
get createdAt() {
|
|
5238
5250
|
return createdAt;
|
|
5239
|
-
// <- Note: [1]
|
|
5251
|
+
// <- Note: [1] --||--
|
|
5240
5252
|
},
|
|
5241
5253
|
get updatedAt() {
|
|
5242
5254
|
return updatedAt;
|
|
5243
|
-
// <- Note: [1]
|
|
5255
|
+
// <- Note: [1] --||--
|
|
5244
5256
|
},
|
|
5245
5257
|
asPromise,
|
|
5246
5258
|
asObservable() {
|
|
@@ -5248,15 +5260,15 @@ function createTask(options) {
|
|
|
5248
5260
|
},
|
|
5249
5261
|
get errors() {
|
|
5250
5262
|
return errors;
|
|
5251
|
-
// <- Note: [1]
|
|
5263
|
+
// <- Note: [1] --||--
|
|
5252
5264
|
},
|
|
5253
5265
|
get warnings() {
|
|
5254
5266
|
return warnings;
|
|
5255
|
-
// <- Note: [1]
|
|
5267
|
+
// <- Note: [1] --||--
|
|
5256
5268
|
},
|
|
5257
5269
|
get currentValue() {
|
|
5258
5270
|
return currentValue;
|
|
5259
|
-
// <- Note: [1]
|
|
5271
|
+
// <- Note: [1] --||--
|
|
5260
5272
|
},
|
|
5261
5273
|
};
|
|
5262
5274
|
}
|
|
@@ -6789,7 +6801,7 @@ async function getKnowledgeForTask(options) {
|
|
|
6789
6801
|
});
|
|
6790
6802
|
const knowledgePiecesSorted = knowledgePiecesWithRelevance.sort((a, b) => a.relevance - b.relevance);
|
|
6791
6803
|
const knowledgePiecesLimited = knowledgePiecesSorted.slice(0, 5);
|
|
6792
|
-
console.log('!!! Embedding', {
|
|
6804
|
+
console.log('!!! `getKnowledgeForTask` Embedding', {
|
|
6793
6805
|
task,
|
|
6794
6806
|
taskEmbeddingPrompt,
|
|
6795
6807
|
taskEmbeddingResult,
|
|
@@ -6825,6 +6837,7 @@ async function getKnowledgeForTask(options) {
|
|
|
6825
6837
|
*/
|
|
6826
6838
|
async function getReservedParametersForTask(options) {
|
|
6827
6839
|
const { tools, preparedPipeline, task, parameters, pipelineIdentification } = options;
|
|
6840
|
+
console.log('!!! getReservedParametersForTask', options);
|
|
6828
6841
|
const context = await getContextForTask(); // <- [π]
|
|
6829
6842
|
const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task, parameters });
|
|
6830
6843
|
const examples = await getExamplesForTask();
|
|
@@ -6861,6 +6874,7 @@ async function getReservedParametersForTask(options) {
|
|
|
6861
6874
|
*/
|
|
6862
6875
|
async function executeTask(options) {
|
|
6863
6876
|
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSupressed, } = options;
|
|
6877
|
+
console.log('!!! executeTask', options);
|
|
6864
6878
|
const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
6865
6879
|
// Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but itβs good to doublecheck
|
|
6866
6880
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
@@ -6884,14 +6898,15 @@ async function executeTask(options) {
|
|
|
6884
6898
|
|
|
6885
6899
|
`));
|
|
6886
6900
|
}
|
|
6901
|
+
const reservedParameters = await getReservedParametersForTask({
|
|
6902
|
+
tools,
|
|
6903
|
+
preparedPipeline,
|
|
6904
|
+
task: currentTask,
|
|
6905
|
+
pipelineIdentification,
|
|
6906
|
+
parameters: parametersToPass,
|
|
6907
|
+
});
|
|
6887
6908
|
const definedParameters = Object.freeze({
|
|
6888
|
-
...
|
|
6889
|
-
tools,
|
|
6890
|
-
preparedPipeline,
|
|
6891
|
-
task: currentTask,
|
|
6892
|
-
pipelineIdentification,
|
|
6893
|
-
parameters: parametersToPass,
|
|
6894
|
-
})),
|
|
6909
|
+
...reservedParameters,
|
|
6895
6910
|
...parametersToPass,
|
|
6896
6911
|
});
|
|
6897
6912
|
const definedParameterNames = new Set(Object.keys(definedParameters));
|
|
@@ -7338,6 +7353,7 @@ function createPipelineExecutor(options) {
|
|
|
7338
7353
|
};
|
|
7339
7354
|
const pipelineExecutor = (inputParameters) => createTask({
|
|
7340
7355
|
taskType: 'EXECUTION',
|
|
7356
|
+
title: pipeline.title,
|
|
7341
7357
|
taskProcessCallback(updateOngoingResult) {
|
|
7342
7358
|
return pipelineExecutorWithCallback(inputParameters, async (newOngoingResult) => {
|
|
7343
7359
|
updateOngoingResult(newOngoingResult);
|
|
@@ -14447,12 +14463,13 @@ function startRemoteServer(options) {
|
|
|
14447
14463
|
});
|
|
14448
14464
|
function exportExecutionTask(executionTask, isFull) {
|
|
14449
14465
|
// <- TODO: [π§ ] This should be maybe method of `ExecutionTask` itself
|
|
14450
|
-
const { taskType, taskId, status, errors, warnings, createdAt, updatedAt, currentValue } = executionTask;
|
|
14466
|
+
const { taskType, promptbookVersion, taskId, title, status, errors, warnings, createdAt, updatedAt, currentValue, } = executionTask;
|
|
14451
14467
|
if (isFull) {
|
|
14452
14468
|
return {
|
|
14453
|
-
nonce: 'β¨',
|
|
14454
14469
|
taskId,
|
|
14470
|
+
title,
|
|
14455
14471
|
taskType,
|
|
14472
|
+
promptbookVersion,
|
|
14456
14473
|
status,
|
|
14457
14474
|
errors: errors.map(serializeError),
|
|
14458
14475
|
warnings: warnings.map(serializeError),
|
|
@@ -14463,9 +14480,10 @@ function startRemoteServer(options) {
|
|
|
14463
14480
|
}
|
|
14464
14481
|
else {
|
|
14465
14482
|
return {
|
|
14466
|
-
nonce: 'β¨',
|
|
14467
14483
|
taskId,
|
|
14484
|
+
title,
|
|
14468
14485
|
taskType,
|
|
14486
|
+
promptbookVersion,
|
|
14469
14487
|
status,
|
|
14470
14488
|
createdAt,
|
|
14471
14489
|
updatedAt,
|
|
@@ -14999,6 +15017,7 @@ const _AnthropicClaudeMetadataRegistration = $llmToolsMetadataRegister.register(
|
|
|
14999
15017
|
apiKey: 'sk-ant-api03-',
|
|
15000
15018
|
isProxied: true,
|
|
15001
15019
|
remoteServerUrl: DEFAULT_REMOTE_SERVER_URL,
|
|
15020
|
+
maxRequestsPerMinute: DEFAULT_MAX_REQUESTS_PER_MINUTE,
|
|
15002
15021
|
},
|
|
15003
15022
|
};
|
|
15004
15023
|
},
|
|
@@ -15506,7 +15525,7 @@ const _AzureOpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
|
15506
15525
|
title: 'Azure Open AI',
|
|
15507
15526
|
packageName: '@promptbook/azure-openai',
|
|
15508
15527
|
className: 'AzureOpenAiExecutionTools',
|
|
15509
|
-
envVariables: ['
|
|
15528
|
+
envVariables: ['AZUREOPENAI_API_KEY', 'AZUREOPENAI_RESOURCE_NAME', 'AZUREOPENAI_DEPLOYMENT_NAME'],
|
|
15510
15529
|
trustLevel: 'CLOSED_BUSINESS',
|
|
15511
15530
|
order: MODEL_ORDERS.NORMAL,
|
|
15512
15531
|
getBoilerplateConfiguration() {
|
|
@@ -15516,6 +15535,9 @@ const _AzureOpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
|
15516
15535
|
className: 'AzureOpenAiExecutionTools',
|
|
15517
15536
|
options: {
|
|
15518
15537
|
apiKey: 'sk-',
|
|
15538
|
+
resourceName: 'my-resource-name',
|
|
15539
|
+
deploymentName: 'my-deployment-name',
|
|
15540
|
+
maxRequestsPerMinute: DEFAULT_MAX_REQUESTS_PER_MINUTE,
|
|
15519
15541
|
},
|
|
15520
15542
|
};
|
|
15521
15543
|
},
|
|
@@ -15529,15 +15551,15 @@ const _AzureOpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
|
15529
15551
|
packageName: '@promptbook/azure-openai',
|
|
15530
15552
|
className: 'AzureOpenAiExecutionTools',
|
|
15531
15553
|
options: {
|
|
15554
|
+
apiKey: env.AZUREOPENAI_API_KEY,
|
|
15532
15555
|
resourceName: env.AZUREOPENAI_RESOURCE_NAME,
|
|
15533
15556
|
deploymentName: env.AZUREOPENAI_DEPLOYMENT_NAME,
|
|
15534
|
-
apiKey: env.AZUREOPENAI_API_KEY,
|
|
15535
15557
|
},
|
|
15536
15558
|
};
|
|
15537
15559
|
}
|
|
15538
|
-
else if (typeof env.
|
|
15539
|
-
typeof env.
|
|
15540
|
-
typeof env.
|
|
15560
|
+
else if (typeof env.AZUREOPENAI_API_KEY === 'string' ||
|
|
15561
|
+
typeof env.AZUREOPENAI_RESOURCE_NAME === 'string' ||
|
|
15562
|
+
typeof env.AZUREOPENAI_DEPLOYMENT_NAME === 'string') {
|
|
15541
15563
|
return null;
|
|
15542
15564
|
/*
|
|
15543
15565
|
Note: [π¨] Partial configuration is handled more gracefully elsewhere
|
|
@@ -17008,6 +17030,7 @@ const _OpenAiAssistantMetadataRegistration = $llmToolsMetadataRegister.register(
|
|
|
17008
17030
|
options: {
|
|
17009
17031
|
apiKey: 'sk-',
|
|
17010
17032
|
assistantId: 'asst_',
|
|
17033
|
+
maxRequestsPerMinute: DEFAULT_MAX_REQUESTS_PER_MINUTE,
|
|
17011
17034
|
},
|
|
17012
17035
|
};
|
|
17013
17036
|
},
|