@promptbook/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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReadonlyDeep } from 'type-fest';
|
|
2
2
|
import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
|
|
3
3
|
import type { TaskJson } from '../../pipeline/PipelineJson/TaskJson';
|
|
4
|
+
import type { Parameters } from '../../types/typeAliases';
|
|
4
5
|
import type { string_markdown } from '../../types/typeAliases';
|
|
5
6
|
import type { string_parameter_value } from '../../types/typeAliases';
|
|
6
7
|
import type { ExecutionTools } from '../ExecutionTools';
|
|
@@ -22,6 +23,12 @@ type GetKnowledgeForTaskOptions = {
|
|
|
22
23
|
* @@@
|
|
23
24
|
*/
|
|
24
25
|
readonly task: ReadonlyDeep<TaskJson>;
|
|
26
|
+
/**
|
|
27
|
+
* @@@
|
|
28
|
+
*
|
|
29
|
+
* Parameters to complete the content of the task for embedding
|
|
30
|
+
*/
|
|
31
|
+
readonly parameters: Readonly<Parameters>;
|
|
25
32
|
};
|
|
26
33
|
/**
|
|
27
34
|
* @@@
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReadonlyDeep } from 'type-fest';
|
|
2
2
|
import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
|
|
3
3
|
import type { TaskJson } from '../../pipeline/PipelineJson/TaskJson';
|
|
4
|
+
import type { Parameters } from '../../types/typeAliases';
|
|
4
5
|
import type { ReservedParameters } from '../../types/typeAliases';
|
|
5
6
|
import type { ExecutionTools } from '../ExecutionTools';
|
|
6
7
|
/**
|
|
@@ -21,6 +22,12 @@ type GetReservedParametersForTaskOptions = {
|
|
|
21
22
|
* @@@
|
|
22
23
|
*/
|
|
23
24
|
readonly task: ReadonlyDeep<TaskJson>;
|
|
25
|
+
/**
|
|
26
|
+
* @@@
|
|
27
|
+
*
|
|
28
|
+
* Parameters to complete the content of the task for embedding
|
|
29
|
+
*/
|
|
30
|
+
readonly parameters: Readonly<Parameters>;
|
|
24
31
|
/**
|
|
25
32
|
* @@@
|
|
26
33
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/documents",
|
|
3
|
-
"version": "0.92.0-
|
|
3
|
+
"version": "0.92.0-19",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"module": "./esm/index.es.js",
|
|
52
52
|
"typings": "./esm/typings/src/_packages/documents.index.d.ts",
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@promptbook/core": "0.92.0-
|
|
54
|
+
"@promptbook/core": "0.92.0-19"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* @generated
|
|
27
27
|
* @see https://github.com/webgptorg/promptbook
|
|
28
28
|
*/
|
|
29
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
29
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-19';
|
|
30
30
|
/**
|
|
31
31
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
32
32
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2270,12 +2270,18 @@
|
|
|
2270
2270
|
// Note: Ignoring `pipeline.preparations` @@@
|
|
2271
2271
|
// Note: Ignoring `pipeline.knowledgePieces` @@@
|
|
2272
2272
|
if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
|
|
2273
|
+
// TODO: !!! Comment this out
|
|
2274
|
+
console.log('Pipeline is not prepared because title is undefined or empty', pipeline);
|
|
2273
2275
|
return false;
|
|
2274
2276
|
}
|
|
2275
2277
|
if (!pipeline.personas.every((persona) => persona.modelsRequirements !== undefined)) {
|
|
2278
|
+
// TODO: !!! Comment this out
|
|
2279
|
+
console.log('Pipeline is not prepared because personas are not prepared', pipeline.personas);
|
|
2276
2280
|
return false;
|
|
2277
2281
|
}
|
|
2278
2282
|
if (!pipeline.knowledgeSources.every((knowledgeSource) => knowledgeSource.preparationIds !== undefined)) {
|
|
2283
|
+
// TODO: !!! Comment this out
|
|
2284
|
+
console.log('Pipeline is not prepared because knowledge sources are not prepared', pipeline.knowledgeSources);
|
|
2279
2285
|
return false;
|
|
2280
2286
|
}
|
|
2281
2287
|
/*
|
|
@@ -5397,7 +5403,7 @@
|
|
|
5397
5403
|
* @private internal utility of `createPipelineExecutor`
|
|
5398
5404
|
*/
|
|
5399
5405
|
async function getKnowledgeForTask(options) {
|
|
5400
|
-
const { tools, preparedPipeline, task } = options;
|
|
5406
|
+
const { tools, preparedPipeline, task, parameters } = options;
|
|
5401
5407
|
const firstKnowlegePiece = preparedPipeline.knowledgePieces[0];
|
|
5402
5408
|
const firstKnowlegeIndex = firstKnowlegePiece === null || firstKnowlegePiece === void 0 ? void 0 : firstKnowlegePiece.index[0];
|
|
5403
5409
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
|
|
@@ -5415,9 +5421,7 @@
|
|
|
5415
5421
|
modelName: firstKnowlegeIndex.modelName,
|
|
5416
5422
|
},
|
|
5417
5423
|
content: task.content,
|
|
5418
|
-
parameters
|
|
5419
|
-
/* !!!! */
|
|
5420
|
-
},
|
|
5424
|
+
parameters,
|
|
5421
5425
|
};
|
|
5422
5426
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
5423
5427
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
@@ -5469,9 +5473,9 @@
|
|
|
5469
5473
|
* @private internal utility of `createPipelineExecutor`
|
|
5470
5474
|
*/
|
|
5471
5475
|
async function getReservedParametersForTask(options) {
|
|
5472
|
-
const { tools, preparedPipeline, task, pipelineIdentification } = options;
|
|
5476
|
+
const { tools, preparedPipeline, task, parameters, pipelineIdentification } = options;
|
|
5473
5477
|
const context = await getContextForTask(); // <- [🏍]
|
|
5474
|
-
const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task });
|
|
5478
|
+
const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task, parameters });
|
|
5475
5479
|
const examples = await getExamplesForTask();
|
|
5476
5480
|
const currentDate = new Date().toISOString(); // <- TODO: [🧠][💩] Better
|
|
5477
5481
|
const modelName = RESERVED_PARAMETER_MISSING_VALUE;
|
|
@@ -5513,7 +5517,7 @@
|
|
|
5513
5517
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
5514
5518
|
const dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
5515
5519
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
5516
|
-
if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
|
|
5520
|
+
if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
|
|
5517
5521
|
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
5518
5522
|
Dependent parameters are not consistent with used parameters:
|
|
5519
5523
|
|
|
@@ -5537,6 +5541,7 @@
|
|
|
5537
5541
|
preparedPipeline,
|
|
5538
5542
|
task: currentTask,
|
|
5539
5543
|
pipelineIdentification,
|
|
5544
|
+
parameters: parametersToPass,
|
|
5540
5545
|
})),
|
|
5541
5546
|
...parametersToPass,
|
|
5542
5547
|
});
|