@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.
@@ -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/node",
3
- "version": "0.92.0-17",
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/node.index.d.ts",
53
53
  "peerDependencies": {
54
- "@promptbook/core": "0.92.0-17"
54
+ "@promptbook/core": "0.92.0-19"
55
55
  },
56
56
  "dependencies": {
57
57
  "colors": "1.4.0",
package/umd/index.umd.js CHANGED
@@ -46,7 +46,7 @@
46
46
  * @generated
47
47
  * @see https://github.com/webgptorg/promptbook
48
48
  */
49
- const PROMPTBOOK_ENGINE_VERSION = '0.92.0-17';
49
+ const PROMPTBOOK_ENGINE_VERSION = '0.92.0-19';
50
50
  /**
51
51
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
52
52
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1678,12 +1678,18 @@
1678
1678
  // Note: Ignoring `pipeline.preparations` @@@
1679
1679
  // Note: Ignoring `pipeline.knowledgePieces` @@@
1680
1680
  if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
1681
+ // TODO: !!! Comment this out
1682
+ console.log('Pipeline is not prepared because title is undefined or empty', pipeline);
1681
1683
  return false;
1682
1684
  }
1683
1685
  if (!pipeline.personas.every((persona) => persona.modelsRequirements !== undefined)) {
1686
+ // TODO: !!! Comment this out
1687
+ console.log('Pipeline is not prepared because personas are not prepared', pipeline.personas);
1684
1688
  return false;
1685
1689
  }
1686
1690
  if (!pipeline.knowledgeSources.every((knowledgeSource) => knowledgeSource.preparationIds !== undefined)) {
1691
+ // TODO: !!! Comment this out
1692
+ console.log('Pipeline is not prepared because knowledge sources are not prepared', pipeline.knowledgeSources);
1687
1693
  return false;
1688
1694
  }
1689
1695
  /*
@@ -4187,7 +4193,7 @@
4187
4193
  * @private internal utility of `createPipelineExecutor`
4188
4194
  */
4189
4195
  async function getKnowledgeForTask(options) {
4190
- const { tools, preparedPipeline, task } = options;
4196
+ const { tools, preparedPipeline, task, parameters } = options;
4191
4197
  const firstKnowlegePiece = preparedPipeline.knowledgePieces[0];
4192
4198
  const firstKnowlegeIndex = firstKnowlegePiece === null || firstKnowlegePiece === void 0 ? void 0 : firstKnowlegePiece.index[0];
4193
4199
  // <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
@@ -4205,9 +4211,7 @@
4205
4211
  modelName: firstKnowlegeIndex.modelName,
4206
4212
  },
4207
4213
  content: task.content,
4208
- parameters: {
4209
- /* !!!! */
4210
- },
4214
+ parameters,
4211
4215
  };
4212
4216
  const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
4213
4217
  const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
@@ -4259,9 +4263,9 @@
4259
4263
  * @private internal utility of `createPipelineExecutor`
4260
4264
  */
4261
4265
  async function getReservedParametersForTask(options) {
4262
- const { tools, preparedPipeline, task, pipelineIdentification } = options;
4266
+ const { tools, preparedPipeline, task, parameters, pipelineIdentification } = options;
4263
4267
  const context = await getContextForTask(); // <- [🏍]
4264
- const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task });
4268
+ const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task, parameters });
4265
4269
  const examples = await getExamplesForTask();
4266
4270
  const currentDate = new Date().toISOString(); // <- TODO: [🧠][💩] Better
4267
4271
  const modelName = RESERVED_PARAMETER_MISSING_VALUE;
@@ -4303,7 +4307,7 @@
4303
4307
  const usedParameterNames = extractParameterNamesFromTask(currentTask);
4304
4308
  const dependentParameterNames = new Set(currentTask.dependentParameterNames);
4305
4309
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
4306
- if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
4310
+ if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
4307
4311
  throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
4308
4312
  Dependent parameters are not consistent with used parameters:
4309
4313
 
@@ -4327,6 +4331,7 @@
4327
4331
  preparedPipeline,
4328
4332
  task: currentTask,
4329
4333
  pipelineIdentification,
4334
+ parameters: parametersToPass,
4330
4335
  })),
4331
4336
  ...parametersToPass,
4332
4337
  });