@promptbook/pdf 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/pdf",
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/pdf.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
  "crypto": "1.0.1",
package/umd/index.umd.js CHANGED
@@ -25,7 +25,7 @@
25
25
  * @generated
26
26
  * @see https://github.com/webgptorg/promptbook
27
27
  */
28
- const PROMPTBOOK_ENGINE_VERSION = '0.92.0-17';
28
+ const PROMPTBOOK_ENGINE_VERSION = '0.92.0-19';
29
29
  /**
30
30
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
31
31
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2110,12 +2110,18 @@
2110
2110
  // Note: Ignoring `pipeline.preparations` @@@
2111
2111
  // Note: Ignoring `pipeline.knowledgePieces` @@@
2112
2112
  if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
2113
+ // TODO: !!! Comment this out
2114
+ console.log('Pipeline is not prepared because title is undefined or empty', pipeline);
2113
2115
  return false;
2114
2116
  }
2115
2117
  if (!pipeline.personas.every((persona) => persona.modelsRequirements !== undefined)) {
2118
+ // TODO: !!! Comment this out
2119
+ console.log('Pipeline is not prepared because personas are not prepared', pipeline.personas);
2116
2120
  return false;
2117
2121
  }
2118
2122
  if (!pipeline.knowledgeSources.every((knowledgeSource) => knowledgeSource.preparationIds !== undefined)) {
2123
+ // TODO: !!! Comment this out
2124
+ console.log('Pipeline is not prepared because knowledge sources are not prepared', pipeline.knowledgeSources);
2119
2125
  return false;
2120
2126
  }
2121
2127
  /*
@@ -5247,7 +5253,7 @@
5247
5253
  * @private internal utility of `createPipelineExecutor`
5248
5254
  */
5249
5255
  async function getKnowledgeForTask(options) {
5250
- const { tools, preparedPipeline, task } = options;
5256
+ const { tools, preparedPipeline, task, parameters } = options;
5251
5257
  const firstKnowlegePiece = preparedPipeline.knowledgePieces[0];
5252
5258
  const firstKnowlegeIndex = firstKnowlegePiece === null || firstKnowlegePiece === void 0 ? void 0 : firstKnowlegePiece.index[0];
5253
5259
  // <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
@@ -5265,9 +5271,7 @@
5265
5271
  modelName: firstKnowlegeIndex.modelName,
5266
5272
  },
5267
5273
  content: task.content,
5268
- parameters: {
5269
- /* !!!! */
5270
- },
5274
+ parameters,
5271
5275
  };
5272
5276
  const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
5273
5277
  const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
@@ -5319,9 +5323,9 @@
5319
5323
  * @private internal utility of `createPipelineExecutor`
5320
5324
  */
5321
5325
  async function getReservedParametersForTask(options) {
5322
- const { tools, preparedPipeline, task, pipelineIdentification } = options;
5326
+ const { tools, preparedPipeline, task, parameters, pipelineIdentification } = options;
5323
5327
  const context = await getContextForTask(); // <- [🏍]
5324
- const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task });
5328
+ const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task, parameters });
5325
5329
  const examples = await getExamplesForTask();
5326
5330
  const currentDate = new Date().toISOString(); // <- TODO: [🧠][💩] Better
5327
5331
  const modelName = RESERVED_PARAMETER_MISSING_VALUE;
@@ -5363,7 +5367,7 @@
5363
5367
  const usedParameterNames = extractParameterNamesFromTask(currentTask);
5364
5368
  const dependentParameterNames = new Set(currentTask.dependentParameterNames);
5365
5369
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
5366
- if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
5370
+ if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
5367
5371
  throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
5368
5372
  Dependent parameters are not consistent with used parameters:
5369
5373
 
@@ -5387,6 +5391,7 @@
5387
5391
  preparedPipeline,
5388
5392
  task: currentTask,
5389
5393
  pipelineIdentification,
5394
+ parameters: parametersToPass,
5390
5395
  })),
5391
5396
  ...parametersToPass,
5392
5397
  });