@promptbook/legacy-documents 0.92.0-17 → 0.92.0-19
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 +13 -8
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +7 -0
- package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTask.d.ts +7 -0
- package/package.json +2 -2
- package/umd/index.umd.js +13 -8
- 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-19';
|
|
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
|
|
@@ -2272,12 +2272,18 @@ function isPipelinePrepared(pipeline) {
|
|
|
2272
2272
|
// Note: Ignoring `pipeline.preparations` @@@
|
|
2273
2273
|
// Note: Ignoring `pipeline.knowledgePieces` @@@
|
|
2274
2274
|
if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
|
|
2275
|
+
// TODO: !!! Comment this out
|
|
2276
|
+
console.log('Pipeline is not prepared because title is undefined or empty', pipeline);
|
|
2275
2277
|
return false;
|
|
2276
2278
|
}
|
|
2277
2279
|
if (!pipeline.personas.every((persona) => persona.modelsRequirements !== undefined)) {
|
|
2280
|
+
// TODO: !!! Comment this out
|
|
2281
|
+
console.log('Pipeline is not prepared because personas are not prepared', pipeline.personas);
|
|
2278
2282
|
return false;
|
|
2279
2283
|
}
|
|
2280
2284
|
if (!pipeline.knowledgeSources.every((knowledgeSource) => knowledgeSource.preparationIds !== undefined)) {
|
|
2285
|
+
// TODO: !!! Comment this out
|
|
2286
|
+
console.log('Pipeline is not prepared because knowledge sources are not prepared', pipeline.knowledgeSources);
|
|
2281
2287
|
return false;
|
|
2282
2288
|
}
|
|
2283
2289
|
/*
|
|
@@ -5399,7 +5405,7 @@ function knowledgePiecesToString(knowledgePieces) {
|
|
|
5399
5405
|
* @private internal utility of `createPipelineExecutor`
|
|
5400
5406
|
*/
|
|
5401
5407
|
async function getKnowledgeForTask(options) {
|
|
5402
|
-
const { tools, preparedPipeline, task } = options;
|
|
5408
|
+
const { tools, preparedPipeline, task, parameters } = options;
|
|
5403
5409
|
const firstKnowlegePiece = preparedPipeline.knowledgePieces[0];
|
|
5404
5410
|
const firstKnowlegeIndex = firstKnowlegePiece === null || firstKnowlegePiece === void 0 ? void 0 : firstKnowlegePiece.index[0];
|
|
5405
5411
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
|
|
@@ -5417,9 +5423,7 @@ async function getKnowledgeForTask(options) {
|
|
|
5417
5423
|
modelName: firstKnowlegeIndex.modelName,
|
|
5418
5424
|
},
|
|
5419
5425
|
content: task.content,
|
|
5420
|
-
parameters
|
|
5421
|
-
/* !!!! */
|
|
5422
|
-
},
|
|
5426
|
+
parameters,
|
|
5423
5427
|
};
|
|
5424
5428
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
5425
5429
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
@@ -5471,9 +5475,9 @@ async function getKnowledgeForTask(options) {
|
|
|
5471
5475
|
* @private internal utility of `createPipelineExecutor`
|
|
5472
5476
|
*/
|
|
5473
5477
|
async function getReservedParametersForTask(options) {
|
|
5474
|
-
const { tools, preparedPipeline, task, pipelineIdentification } = options;
|
|
5478
|
+
const { tools, preparedPipeline, task, parameters, pipelineIdentification } = options;
|
|
5475
5479
|
const context = await getContextForTask(); // <- [🏍]
|
|
5476
|
-
const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task });
|
|
5480
|
+
const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task, parameters });
|
|
5477
5481
|
const examples = await getExamplesForTask();
|
|
5478
5482
|
const currentDate = new Date().toISOString(); // <- TODO: [🧠][💩] Better
|
|
5479
5483
|
const modelName = RESERVED_PARAMETER_MISSING_VALUE;
|
|
@@ -5515,7 +5519,7 @@ async function executeTask(options) {
|
|
|
5515
5519
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
5516
5520
|
const dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
5517
5521
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
5518
|
-
if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
|
|
5522
|
+
if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
|
|
5519
5523
|
throw new UnexpectedError(spaceTrim((block) => `
|
|
5520
5524
|
Dependent parameters are not consistent with used parameters:
|
|
5521
5525
|
|
|
@@ -5539,6 +5543,7 @@ async function executeTask(options) {
|
|
|
5539
5543
|
preparedPipeline,
|
|
5540
5544
|
task: currentTask,
|
|
5541
5545
|
pipelineIdentification,
|
|
5546
|
+
parameters: parametersToPass,
|
|
5542
5547
|
})),
|
|
5543
5548
|
...parametersToPass,
|
|
5544
5549
|
});
|