@promptbook/remote-server 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/remote-server",
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/remote-server.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
@@ -48,7 +48,7 @@
48
48
  * @generated
49
49
  * @see https://github.com/webgptorg/promptbook
50
50
  */
51
- const PROMPTBOOK_ENGINE_VERSION = '0.92.0-17';
51
+ const PROMPTBOOK_ENGINE_VERSION = '0.92.0-19';
52
52
  /**
53
53
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
54
54
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1800,12 +1800,18 @@
1800
1800
  // Note: Ignoring `pipeline.preparations` @@@
1801
1801
  // Note: Ignoring `pipeline.knowledgePieces` @@@
1802
1802
  if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
1803
+ // TODO: !!! Comment this out
1804
+ console.log('Pipeline is not prepared because title is undefined or empty', pipeline);
1803
1805
  return false;
1804
1806
  }
1805
1807
  if (!pipeline.personas.every((persona) => persona.modelsRequirements !== undefined)) {
1808
+ // TODO: !!! Comment this out
1809
+ console.log('Pipeline is not prepared because personas are not prepared', pipeline.personas);
1806
1810
  return false;
1807
1811
  }
1808
1812
  if (!pipeline.knowledgeSources.every((knowledgeSource) => knowledgeSource.preparationIds !== undefined)) {
1813
+ // TODO: !!! Comment this out
1814
+ console.log('Pipeline is not prepared because knowledge sources are not prepared', pipeline.knowledgeSources);
1809
1815
  return false;
1810
1816
  }
1811
1817
  /*
@@ -5598,7 +5604,7 @@
5598
5604
  * @private internal utility of `createPipelineExecutor`
5599
5605
  */
5600
5606
  async function getKnowledgeForTask(options) {
5601
- const { tools, preparedPipeline, task } = options;
5607
+ const { tools, preparedPipeline, task, parameters } = options;
5602
5608
  const firstKnowlegePiece = preparedPipeline.knowledgePieces[0];
5603
5609
  const firstKnowlegeIndex = firstKnowlegePiece === null || firstKnowlegePiece === void 0 ? void 0 : firstKnowlegePiece.index[0];
5604
5610
  // <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
@@ -5616,9 +5622,7 @@
5616
5622
  modelName: firstKnowlegeIndex.modelName,
5617
5623
  },
5618
5624
  content: task.content,
5619
- parameters: {
5620
- /* !!!! */
5621
- },
5625
+ parameters,
5622
5626
  };
5623
5627
  const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
5624
5628
  const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
@@ -5670,9 +5674,9 @@
5670
5674
  * @private internal utility of `createPipelineExecutor`
5671
5675
  */
5672
5676
  async function getReservedParametersForTask(options) {
5673
- const { tools, preparedPipeline, task, pipelineIdentification } = options;
5677
+ const { tools, preparedPipeline, task, parameters, pipelineIdentification } = options;
5674
5678
  const context = await getContextForTask(); // <- [🏍]
5675
- const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task });
5679
+ const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task, parameters });
5676
5680
  const examples = await getExamplesForTask();
5677
5681
  const currentDate = new Date().toISOString(); // <- TODO: [🧠][💩] Better
5678
5682
  const modelName = RESERVED_PARAMETER_MISSING_VALUE;
@@ -5714,7 +5718,7 @@
5714
5718
  const usedParameterNames = extractParameterNamesFromTask(currentTask);
5715
5719
  const dependentParameterNames = new Set(currentTask.dependentParameterNames);
5716
5720
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
5717
- if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
5721
+ if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
5718
5722
  throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
5719
5723
  Dependent parameters are not consistent with used parameters:
5720
5724
 
@@ -5738,6 +5742,7 @@
5738
5742
  preparedPipeline,
5739
5743
  task: currentTask,
5740
5744
  pipelineIdentification,
5745
+ parameters: parametersToPass,
5741
5746
  })),
5742
5747
  ...parametersToPass,
5743
5748
  });