@promptbook/core 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 +1 -1
- package/umd/index.umd.js +13 -8
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -27,7 +27,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
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-19';
|
|
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
|
|
@@ -1852,12 +1852,18 @@ function isPipelinePrepared(pipeline) {
|
|
|
1852
1852
|
// Note: Ignoring `pipeline.preparations` @@@
|
|
1853
1853
|
// Note: Ignoring `pipeline.knowledgePieces` @@@
|
|
1854
1854
|
if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
|
|
1855
|
+
// TODO: !!! Comment this out
|
|
1856
|
+
console.log('Pipeline is not prepared because title is undefined or empty', pipeline);
|
|
1855
1857
|
return false;
|
|
1856
1858
|
}
|
|
1857
1859
|
if (!pipeline.personas.every((persona) => persona.modelsRequirements !== undefined)) {
|
|
1860
|
+
// TODO: !!! Comment this out
|
|
1861
|
+
console.log('Pipeline is not prepared because personas are not prepared', pipeline.personas);
|
|
1858
1862
|
return false;
|
|
1859
1863
|
}
|
|
1860
1864
|
if (!pipeline.knowledgeSources.every((knowledgeSource) => knowledgeSource.preparationIds !== undefined)) {
|
|
1865
|
+
// TODO: !!! Comment this out
|
|
1866
|
+
console.log('Pipeline is not prepared because knowledge sources are not prepared', pipeline.knowledgeSources);
|
|
1861
1867
|
return false;
|
|
1862
1868
|
}
|
|
1863
1869
|
/*
|
|
@@ -4422,7 +4428,7 @@ function knowledgePiecesToString(knowledgePieces) {
|
|
|
4422
4428
|
* @private internal utility of `createPipelineExecutor`
|
|
4423
4429
|
*/
|
|
4424
4430
|
async function getKnowledgeForTask(options) {
|
|
4425
|
-
const { tools, preparedPipeline, task } = options;
|
|
4431
|
+
const { tools, preparedPipeline, task, parameters } = options;
|
|
4426
4432
|
const firstKnowlegePiece = preparedPipeline.knowledgePieces[0];
|
|
4427
4433
|
const firstKnowlegeIndex = firstKnowlegePiece === null || firstKnowlegePiece === void 0 ? void 0 : firstKnowlegePiece.index[0];
|
|
4428
4434
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
|
|
@@ -4440,9 +4446,7 @@ async function getKnowledgeForTask(options) {
|
|
|
4440
4446
|
modelName: firstKnowlegeIndex.modelName,
|
|
4441
4447
|
},
|
|
4442
4448
|
content: task.content,
|
|
4443
|
-
parameters
|
|
4444
|
-
/* !!!! */
|
|
4445
|
-
},
|
|
4449
|
+
parameters,
|
|
4446
4450
|
};
|
|
4447
4451
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
4448
4452
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
@@ -4494,9 +4498,9 @@ async function getKnowledgeForTask(options) {
|
|
|
4494
4498
|
* @private internal utility of `createPipelineExecutor`
|
|
4495
4499
|
*/
|
|
4496
4500
|
async function getReservedParametersForTask(options) {
|
|
4497
|
-
const { tools, preparedPipeline, task, pipelineIdentification } = options;
|
|
4501
|
+
const { tools, preparedPipeline, task, parameters, pipelineIdentification } = options;
|
|
4498
4502
|
const context = await getContextForTask(); // <- [🏍]
|
|
4499
|
-
const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task });
|
|
4503
|
+
const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task, parameters });
|
|
4500
4504
|
const examples = await getExamplesForTask();
|
|
4501
4505
|
const currentDate = new Date().toISOString(); // <- TODO: [🧠][💩] Better
|
|
4502
4506
|
const modelName = RESERVED_PARAMETER_MISSING_VALUE;
|
|
@@ -4538,7 +4542,7 @@ async function executeTask(options) {
|
|
|
4538
4542
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
4539
4543
|
const dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
4540
4544
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
4541
|
-
if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
|
|
4545
|
+
if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
|
|
4542
4546
|
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
4543
4547
|
Dependent parameters are not consistent with used parameters:
|
|
4544
4548
|
|
|
@@ -4562,6 +4566,7 @@ async function executeTask(options) {
|
|
|
4562
4566
|
preparedPipeline,
|
|
4563
4567
|
task: currentTask,
|
|
4564
4568
|
pipelineIdentification,
|
|
4569
|
+
parameters: parametersToPass,
|
|
4565
4570
|
})),
|
|
4566
4571
|
...parametersToPass,
|
|
4567
4572
|
});
|