@promptbook/node 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
|
@@ -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-19';
|
|
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
|
|
@@ -1662,12 +1662,18 @@ function isPipelinePrepared(pipeline) {
|
|
|
1662
1662
|
// Note: Ignoring `pipeline.preparations` @@@
|
|
1663
1663
|
// Note: Ignoring `pipeline.knowledgePieces` @@@
|
|
1664
1664
|
if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
|
|
1665
|
+
// TODO: !!! Comment this out
|
|
1666
|
+
console.log('Pipeline is not prepared because title is undefined or empty', pipeline);
|
|
1665
1667
|
return false;
|
|
1666
1668
|
}
|
|
1667
1669
|
if (!pipeline.personas.every((persona) => persona.modelsRequirements !== undefined)) {
|
|
1670
|
+
// TODO: !!! Comment this out
|
|
1671
|
+
console.log('Pipeline is not prepared because personas are not prepared', pipeline.personas);
|
|
1668
1672
|
return false;
|
|
1669
1673
|
}
|
|
1670
1674
|
if (!pipeline.knowledgeSources.every((knowledgeSource) => knowledgeSource.preparationIds !== undefined)) {
|
|
1675
|
+
// TODO: !!! Comment this out
|
|
1676
|
+
console.log('Pipeline is not prepared because knowledge sources are not prepared', pipeline.knowledgeSources);
|
|
1671
1677
|
return false;
|
|
1672
1678
|
}
|
|
1673
1679
|
/*
|
|
@@ -4171,7 +4177,7 @@ function knowledgePiecesToString(knowledgePieces) {
|
|
|
4171
4177
|
* @private internal utility of `createPipelineExecutor`
|
|
4172
4178
|
*/
|
|
4173
4179
|
async function getKnowledgeForTask(options) {
|
|
4174
|
-
const { tools, preparedPipeline, task } = options;
|
|
4180
|
+
const { tools, preparedPipeline, task, parameters } = options;
|
|
4175
4181
|
const firstKnowlegePiece = preparedPipeline.knowledgePieces[0];
|
|
4176
4182
|
const firstKnowlegeIndex = firstKnowlegePiece === null || firstKnowlegePiece === void 0 ? void 0 : firstKnowlegePiece.index[0];
|
|
4177
4183
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
|
|
@@ -4189,9 +4195,7 @@ async function getKnowledgeForTask(options) {
|
|
|
4189
4195
|
modelName: firstKnowlegeIndex.modelName,
|
|
4190
4196
|
},
|
|
4191
4197
|
content: task.content,
|
|
4192
|
-
parameters
|
|
4193
|
-
/* !!!! */
|
|
4194
|
-
},
|
|
4198
|
+
parameters,
|
|
4195
4199
|
};
|
|
4196
4200
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
4197
4201
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
@@ -4243,9 +4247,9 @@ async function getKnowledgeForTask(options) {
|
|
|
4243
4247
|
* @private internal utility of `createPipelineExecutor`
|
|
4244
4248
|
*/
|
|
4245
4249
|
async function getReservedParametersForTask(options) {
|
|
4246
|
-
const { tools, preparedPipeline, task, pipelineIdentification } = options;
|
|
4250
|
+
const { tools, preparedPipeline, task, parameters, pipelineIdentification } = options;
|
|
4247
4251
|
const context = await getContextForTask(); // <- [🏍]
|
|
4248
|
-
const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task });
|
|
4252
|
+
const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task, parameters });
|
|
4249
4253
|
const examples = await getExamplesForTask();
|
|
4250
4254
|
const currentDate = new Date().toISOString(); // <- TODO: [🧠][💩] Better
|
|
4251
4255
|
const modelName = RESERVED_PARAMETER_MISSING_VALUE;
|
|
@@ -4287,7 +4291,7 @@ async function executeTask(options) {
|
|
|
4287
4291
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
4288
4292
|
const dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
4289
4293
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
4290
|
-
if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
|
|
4294
|
+
if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
|
|
4291
4295
|
throw new UnexpectedError(spaceTrim$1((block) => `
|
|
4292
4296
|
Dependent parameters are not consistent with used parameters:
|
|
4293
4297
|
|
|
@@ -4311,6 +4315,7 @@ async function executeTask(options) {
|
|
|
4311
4315
|
preparedPipeline,
|
|
4312
4316
|
task: currentTask,
|
|
4313
4317
|
pipelineIdentification,
|
|
4318
|
+
parameters: parametersToPass,
|
|
4314
4319
|
})),
|
|
4315
4320
|
...parametersToPass,
|
|
4316
4321
|
});
|