@promptbook/remote-server 0.92.0-32 β†’ 0.92.0-33

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 CHANGED
@@ -33,7 +33,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
33
33
  * @generated
34
34
  * @see https://github.com/webgptorg/promptbook
35
35
  */
36
- const PROMPTBOOK_ENGINE_VERSION = '0.92.0-32';
36
+ const PROMPTBOOK_ENGINE_VERSION = '0.92.0-33';
37
37
  /**
38
38
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
39
39
  * Note: [πŸ’ž] Ignore a discrepancy between file name and entity name
@@ -2004,6 +2004,7 @@ function assertsTaskSuccessful(executionResult) {
2004
2004
  */
2005
2005
  function createTask(options) {
2006
2006
  const { taskType, taskProcessCallback } = options;
2007
+ let { title } = options;
2007
2008
  // TODO: [πŸ™] DRY
2008
2009
  const taskId = `${taskType.toLowerCase().substring(0, 4)}-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */)}`;
2009
2010
  let status = 'RUNNING';
@@ -2015,6 +2016,10 @@ function createTask(options) {
2015
2016
  const partialResultSubject = new Subject();
2016
2017
  // <- Note: Not using `BehaviorSubject` because on error we can't access the last value
2017
2018
  const finalResultPromise = /* not await */ taskProcessCallback((newOngoingResult) => {
2019
+ if (newOngoingResult.title) {
2020
+ title = newOngoingResult.title;
2021
+ }
2022
+ updatedAt = new Date();
2018
2023
  Object.assign(currentValue, newOngoingResult);
2019
2024
  // <- TODO: assign deep
2020
2025
  partialResultSubject.next(newOngoingResult);
@@ -2060,17 +2065,24 @@ function createTask(options) {
2060
2065
  return {
2061
2066
  taskType,
2062
2067
  taskId,
2068
+ get promptbookVersion() {
2069
+ return PROMPTBOOK_ENGINE_VERSION;
2070
+ },
2071
+ get title() {
2072
+ return title;
2073
+ // <- Note: [1] Theese must be getters to allow changing the value in the future
2074
+ },
2063
2075
  get status() {
2064
2076
  return status;
2065
- // <- Note: [1] Theese must be getters to allow changing the value in the future
2077
+ // <- Note: [1] --||--
2066
2078
  },
2067
2079
  get createdAt() {
2068
2080
  return createdAt;
2069
- // <- Note: [1]
2081
+ // <- Note: [1] --||--
2070
2082
  },
2071
2083
  get updatedAt() {
2072
2084
  return updatedAt;
2073
- // <- Note: [1]
2085
+ // <- Note: [1] --||--
2074
2086
  },
2075
2087
  asPromise,
2076
2088
  asObservable() {
@@ -2078,15 +2090,15 @@ function createTask(options) {
2078
2090
  },
2079
2091
  get errors() {
2080
2092
  return errors;
2081
- // <- Note: [1]
2093
+ // <- Note: [1] --||--
2082
2094
  },
2083
2095
  get warnings() {
2084
2096
  return warnings;
2085
- // <- Note: [1]
2097
+ // <- Note: [1] --||--
2086
2098
  },
2087
2099
  get currentValue() {
2088
2100
  return currentValue;
2089
- // <- Note: [1]
2101
+ // <- Note: [1] --||--
2090
2102
  },
2091
2103
  };
2092
2104
  }
@@ -5706,7 +5718,7 @@ async function getKnowledgeForTask(options) {
5706
5718
  });
5707
5719
  const knowledgePiecesSorted = knowledgePiecesWithRelevance.sort((a, b) => a.relevance - b.relevance);
5708
5720
  const knowledgePiecesLimited = knowledgePiecesSorted.slice(0, 5);
5709
- console.log('!!! Embedding', {
5721
+ console.log('!!! `getKnowledgeForTask` Embedding', {
5710
5722
  task,
5711
5723
  taskEmbeddingPrompt,
5712
5724
  taskEmbeddingResult,
@@ -5742,6 +5754,7 @@ async function getKnowledgeForTask(options) {
5742
5754
  */
5743
5755
  async function getReservedParametersForTask(options) {
5744
5756
  const { tools, preparedPipeline, task, parameters, pipelineIdentification } = options;
5757
+ console.log('!!! getReservedParametersForTask', options);
5745
5758
  const context = await getContextForTask(); // <- [🏍]
5746
5759
  const knowledge = await getKnowledgeForTask({ tools, preparedPipeline, task, parameters });
5747
5760
  const examples = await getExamplesForTask();
@@ -5778,6 +5791,7 @@ async function getReservedParametersForTask(options) {
5778
5791
  */
5779
5792
  async function executeTask(options) {
5780
5793
  const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSupressed, } = options;
5794
+ console.log('!!! executeTask', options);
5781
5795
  const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
5782
5796
  // Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
5783
5797
  const usedParameterNames = extractParameterNamesFromTask(currentTask);
@@ -5801,14 +5815,15 @@ async function executeTask(options) {
5801
5815
 
5802
5816
  `));
5803
5817
  }
5818
+ const reservedParameters = await getReservedParametersForTask({
5819
+ tools,
5820
+ preparedPipeline,
5821
+ task: currentTask,
5822
+ pipelineIdentification,
5823
+ parameters: parametersToPass,
5824
+ });
5804
5825
  const definedParameters = Object.freeze({
5805
- ...(await getReservedParametersForTask({
5806
- tools,
5807
- preparedPipeline,
5808
- task: currentTask,
5809
- pipelineIdentification,
5810
- parameters: parametersToPass,
5811
- })),
5826
+ ...reservedParameters,
5812
5827
  ...parametersToPass,
5813
5828
  });
5814
5829
  const definedParameterNames = new Set(Object.keys(definedParameters));
@@ -6255,6 +6270,7 @@ function createPipelineExecutor(options) {
6255
6270
  };
6256
6271
  const pipelineExecutor = (inputParameters) => createTask({
6257
6272
  taskType: 'EXECUTION',
6273
+ title: pipeline.title,
6258
6274
  taskProcessCallback(updateOngoingResult) {
6259
6275
  return pipelineExecutorWithCallback(inputParameters, async (newOngoingResult) => {
6260
6276
  updateOngoingResult(newOngoingResult);
@@ -7935,12 +7951,13 @@ function startRemoteServer(options) {
7935
7951
  });
7936
7952
  function exportExecutionTask(executionTask, isFull) {
7937
7953
  // <- TODO: [🧠] This should be maybe method of `ExecutionTask` itself
7938
- const { taskType, taskId, status, errors, warnings, createdAt, updatedAt, currentValue } = executionTask;
7954
+ const { taskType, promptbookVersion, taskId, title, status, errors, warnings, createdAt, updatedAt, currentValue, } = executionTask;
7939
7955
  if (isFull) {
7940
7956
  return {
7941
- nonce: '✨',
7942
7957
  taskId,
7958
+ title,
7943
7959
  taskType,
7960
+ promptbookVersion,
7944
7961
  status,
7945
7962
  errors: errors.map(serializeError),
7946
7963
  warnings: warnings.map(serializeError),
@@ -7951,9 +7968,10 @@ function startRemoteServer(options) {
7951
7968
  }
7952
7969
  else {
7953
7970
  return {
7954
- nonce: '✨',
7955
7971
  taskId,
7972
+ title,
7956
7973
  taskType,
7974
+ promptbookVersion,
7957
7975
  status,
7958
7976
  createdAt,
7959
7977
  updatedAt,