@promptbook/core 0.68.4 → 0.68.5

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.
Files changed (24) hide show
  1. package/esm/index.es.js +28 -28
  2. package/esm/typings/src/cli/cli-commands/make.d.ts +1 -1
  3. package/esm/typings/src/collection/constructors/createCollectionFromUrl.d.ts +1 -1
  4. package/esm/typings/src/config.d.ts +2 -2
  5. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -1
  6. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +5 -5
  7. package/esm/typings/src/execution/createPipelineExecutor.d.ts +1 -1
  8. package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -1
  9. package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -1
  10. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +2 -1
  11. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  12. package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts +2 -2
  13. package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +2 -2
  14. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +2 -1
  15. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +2 -1
  16. package/esm/typings/src/llm-providers/openai/playground/playground.d.ts +1 -1
  17. package/esm/typings/src/personas/preparePersona.d.ts +1 -1
  18. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +1 -1
  19. package/esm/typings/src/prepare/prepareTemplates.d.ts +1 -1
  20. package/esm/typings/src/types/typeAliases.d.ts +1 -1
  21. package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +1 -1
  22. package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +1 -1
  23. package/package.json +1 -1
  24. package/umd/index.umd.js +28 -28
package/esm/index.es.js CHANGED
@@ -10,8 +10,8 @@ import moment from 'moment';
10
10
  /**
11
11
  * The version of the Promptbook library
12
12
  */
13
- var PROMPTBOOK_VERSION = '0.68.3';
14
- // TODO: !!!! List here all the versions and annotate + put into script
13
+ var PROMPTBOOK_VERSION = '0.68.4';
14
+ // TODO:[main] !!!! List here all the versions and annotate + put into script
15
15
 
16
16
  /*! *****************************************************************************
17
17
  Copyright (c) Microsoft Corporation.
@@ -223,7 +223,7 @@ function pipelineJsonToString(pipelineJson) {
223
223
  commands.push("PIPELINE URL ".concat(pipelineUrl));
224
224
  }
225
225
  commands.push("PROMPTBOOK VERSION ".concat(promptbookVersion));
226
- // TODO: !!! This increase size of the bundle and is probbably not necessary
226
+ // TODO:[main] !!! This increase size of the bundle and is probbably not necessary
227
227
  pipelineString = prettifyMarkdown(pipelineString);
228
228
  try {
229
229
  for (var _g = __values(parameters.filter(function (_a) {
@@ -371,12 +371,12 @@ function pipelineJsonToString(pipelineJson) {
371
371
  pipelineString += '```' + contentLanguage;
372
372
  pipelineString += '\n';
373
373
  pipelineString += spaceTrim(content);
374
- // <- TODO: !!! Escape
374
+ // <- TODO:[main] !!! Escape
375
375
  // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
376
376
  pipelineString += '\n';
377
377
  pipelineString += '```';
378
378
  pipelineString += '\n\n';
379
- pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: !!! If the parameter here has description, add it and use templateParameterJsonToString
379
+ pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO:[main] !!! If the parameter here has description, add it and use templateParameterJsonToString
380
380
  }
381
381
  }
382
382
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
@@ -596,7 +596,7 @@ function checkSerializableAsJson(name, value) {
596
596
  }
597
597
  /**
598
598
  * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
599
- * TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
599
+ * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
600
600
  * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
601
601
  */
602
602
 
@@ -667,14 +667,14 @@ var MAX_EXECUTION_ATTEMPTS = 3;
667
667
  var MAX_FILENAME_LENGTH = 30;
668
668
  /**
669
669
  * @@@
670
- * TODO: [🐝] !!! Use
670
+ * TODO: [🐝][main] !!! Use
671
671
  *
672
672
  * @public exported from `@promptbook/core`
673
673
  */
674
674
  var MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH = 3;
675
675
  /**
676
676
  * @@@
677
- * TODO: [🐝] !!! Use
677
+ * TODO: [🐝][main] !!! Use
678
678
  *
679
679
  * @public exported from `@promptbook/core`
680
680
  */
@@ -829,7 +829,7 @@ function isValidPromptbookVersion(version) {
829
829
  if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
830
830
  return false;
831
831
  }
832
- // <- TODO: !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
832
+ // <- TODO:[main] !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
833
833
  return true;
834
834
  }
835
835
 
@@ -1173,11 +1173,11 @@ function validatePipeline(pipeline) {
1173
1173
  * > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
1174
1174
  */
1175
1175
  /**
1176
- * TODO: [🐣] !!!! Validate that all samples match expectations
1177
- * TODO: [🐣][🐝] !!!! Validate that knowledge is valid (non-void)
1178
- * TODO: [🐣] !!!! Validate that persona can be used only with CHAT variant
1179
- * TODO: [🐣] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
1180
- * TODO: [🐣] !!!! Validate that reserved parameter is not used as joker
1176
+ * TODO: [🐣][main] !!!! Validate that all samples match expectations
1177
+ * TODO: [🐣][🐝][main] !!!! Validate that knowledge is valid (non-void)
1178
+ * TODO: [🐣][main] !!!! Validate that persona can be used only with CHAT variant
1179
+ * TODO: [🐣][main] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
1180
+ * TODO: [🐣][main] !!!! Validate that reserved parameter is not used as joker
1181
1181
  * TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
1182
1182
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
1183
1183
  */
@@ -1491,7 +1491,7 @@ function createCollectionFromUrl(url, options) {
1491
1491
  });
1492
1492
  }
1493
1493
  /**
1494
- * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
1494
+ * TODO:[main] !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
1495
1495
  */
1496
1496
 
1497
1497
  /**
@@ -2896,7 +2896,7 @@ function isPipelinePrepared(pipeline) {
2896
2896
  return true;
2897
2897
  }
2898
2898
  /**
2899
- * TODO: [🔃] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
2899
+ * TODO: [🔃][main] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
2900
2900
  * TODO: [🐠] Maybe base this on `makeValidator`
2901
2901
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2902
2902
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
@@ -3297,7 +3297,7 @@ function createPipelineExecutor(options) {
3297
3297
  console.warn(spaceTrim$1(function (block) { return "\n Pipeline is not prepared\n\n ".concat(block(pipelineIdentification), "\n\n It will be prepared ad-hoc before the first execution and **returned as `preparedPipeline` in `PipelineExecutorResult`**\n But it is recommended to prepare the pipeline during collection preparation\n\n @see more at https://ptbk.io/prepare-pipeline\n "); }));
3298
3298
  }
3299
3299
  var pipelineExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
3300
- // TODO: !!! Extract to separate functions and files - ALL FUNCTIONS BELOW
3300
+ // TODO:[main] !!! Extract to separate functions and files - ALL FUNCTIONS BELOW
3301
3301
  function getContextForTemplate(template) {
3302
3302
  return __awaiter(this, void 0, void 0, function () {
3303
3303
  return __generator(this, function (_a) {
@@ -4116,7 +4116,7 @@ function createPipelineExecutor(options) {
4116
4116
  return pipelineExecutor;
4117
4117
  }
4118
4118
  /**
4119
- * TODO: !!! Identify not only pipeline BUT exact template ${block(pipelineIdentification)}
4119
+ * TODO:[main] !!! Identify not only pipeline BUT exact template ${block(pipelineIdentification)}
4120
4120
  * TODO: Use isVerbose here (not only pass to `preparePipeline`)
4121
4121
  * TODO: [🧠][🌳] Use here `countTotalUsage` and put preparation and prepared pipiline to report
4122
4122
  * TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
@@ -4179,7 +4179,7 @@ function prepareKnowledgeFromMarkdown(knowledgeContent /* <- TODO: [🖖] (?mayb
4179
4179
  outputParameters = result.outputParameters;
4180
4180
  knowledgePiecesRaw = outputParameters.knowledgePieces;
4181
4181
  knowledgeTextPieces = (knowledgePiecesRaw || '').split('\n---\n');
4182
- // <- TODO: !!!!! Smarter split and filter out empty pieces
4182
+ // <- TODO:[main] !!!!! Smarter split and filter out empty pieces
4183
4183
  if (isVerbose) {
4184
4184
  console.info('knowledgeTextPieces:', knowledgeTextPieces);
4185
4185
  }
@@ -4259,7 +4259,7 @@ function prepareKnowledgeFromMarkdown(knowledgeContent /* <- TODO: [🖖] (?mayb
4259
4259
  });
4260
4260
  }
4261
4261
  /**
4262
- * TODO: [🐝][🔼] !!! Export via `@promptbook/markdown`
4262
+ * TODO: [🐝][🔼][main] !!! Export via `@promptbook/markdown`
4263
4263
  * TODO: [🪂] Do it in parallel 11:11
4264
4264
  * Note: No need to aggregate usage here, it is done by intercepting the llmTools
4265
4265
  */
@@ -4283,7 +4283,7 @@ function prepareKnowledgePieces(knowledgeSources, options) {
4283
4283
  var partialPieces, pieces;
4284
4284
  return __generator(this, function (_a) {
4285
4285
  switch (_a.label) {
4286
- case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.sourceContent, // <- TODO: [🐝] !!! Unhardcode markdown, detect which type it is - BE AWARE of big package size
4286
+ case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.sourceContent, // <- TODO: [🐝][main] !!! Unhardcode markdown, detect which type it is - BE AWARE of big package size
4287
4287
  options)];
4288
4288
  case 1:
4289
4289
  partialPieces = _a.sent();
@@ -4475,7 +4475,7 @@ function preparePersona(personaDescription, options) {
4475
4475
  });
4476
4476
  }
4477
4477
  /**
4478
- * TODO: [🔃] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
4478
+ * TODO: [🔃][main] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
4479
4479
  * TODO: [🏢] !! Check validity of `modelName` in pipeline
4480
4480
  * TODO: [🏢] !! Check validity of `systemMessage` in pipeline
4481
4481
  * TODO: [🏢] !! Check validity of `temperature` in pipeline
@@ -4524,7 +4524,7 @@ function prepareTemplates(pipeline, options) {
4524
4524
  case 0:
4525
4525
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a;
4526
4526
  templates = pipeline.templates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
4527
- // TODO: !!!!! Apply samples to each template (if missing and is for the template defined)
4527
+ // TODO:[main] !!!!! Apply samples to each template (if missing and is for the template defined)
4528
4528
  TODO_USE(parameters);
4529
4529
  templatesPrepared = new Array(
4530
4530
  // <- TODO: [🧱] Implement in a functional (not new Class) way
@@ -4556,7 +4556,7 @@ function prepareTemplates(pipeline, options) {
4556
4556
  /**
4557
4557
  * TODO: [🧠] Add context to each template (if missing)
4558
4558
  * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
4559
- * TODO: [♨] !!! Prepare index the samples and maybe templates
4559
+ * TODO: [♨][main] !!! Prepare index the samples and maybe templates
4560
4560
  * TODO: Write tests for `preparePipeline`
4561
4561
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
4562
4562
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
@@ -4728,7 +4728,7 @@ var knowledgeCommandParser = {
4728
4728
  if (sourceContent === '') {
4729
4729
  throw new ParseError("Source is not defined");
4730
4730
  }
4731
- // TODO: !!!! Following checks should be applied every link in the `sourceContent`
4731
+ // TODO:[main] !!!! Following checks should be applied every link in the `sourceContent`
4732
4732
  if (sourceContent.startsWith('http://')) {
4733
4733
  throw new ParseError("Source is not secure");
4734
4734
  }
@@ -4913,7 +4913,7 @@ var templateCommandParser = {
4913
4913
  if (command.templateType === 'KNOWLEDGE') {
4914
4914
  knowledgeCommandParser.$applyToPipelineJson({
4915
4915
  type: 'KNOWLEDGE',
4916
- sourceContent: $templateJson.content, // <- TODO: [🐝] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
4916
+ sourceContent: $templateJson.content, // <- TODO: [🐝][main] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
4917
4917
  }, $pipelineJson);
4918
4918
  $templateJson.isTemplate = false;
4919
4919
  return;
@@ -7136,7 +7136,7 @@ function pipelineStringToJsonSync(pipelineString) {
7136
7136
  return $asDeeplyFrozenSerializableJson('pipelineJson', $pipelineJson);
7137
7137
  }
7138
7138
  /**
7139
- * TODO: !!!! Warn if used only sync version
7139
+ * TODO:[main] !!!! Warn if used only sync version
7140
7140
  * TODO: [🚞] Report here line/column of error
7141
7141
  * TODO: Use spaceTrim more effectively
7142
7142
  * TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
@@ -7411,7 +7411,7 @@ function isSerializableAsJson(value) {
7411
7411
  }
7412
7412
  }
7413
7413
  /**
7414
- * TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
7414
+ * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
7415
7415
  * TODO: [🧠][💺] Can be done this on type-level?
7416
7416
  */
7417
7417
 
@@ -6,7 +6,7 @@ import type { Command as Program } from 'commander';
6
6
  */
7
7
  export declare function initializeMakeCommand(program: Program): void;
8
8
  /**
9
- * TODO: [🥃] !!! Allow `ptbk make` without configuring any llm tools
9
+ * TODO: [🥃][main] !!! Allow `ptbk make` without configuring any llm tools
10
10
  * TODO: Maybe remove this command - "about" command should be enough?
11
11
  * TODO: [0] DRY Javascript and typescript - Maybe make ONLY typescript and for javascript just remove types
12
12
  * Note: [🟡] This code should never be published outside of `@promptbook/cli`
@@ -25,5 +25,5 @@ type CreatePipelineCollectionFromUrlyOptions = {
25
25
  export declare function createCollectionFromUrl(url: string_url | URL, options: CreatePipelineCollectionFromUrlyOptions): Promise<PipelineCollection>;
26
26
  export {};
27
27
  /**
28
- * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
28
+ * TODO:[main] !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
29
29
  */
@@ -68,14 +68,14 @@ export declare const MAX_EXECUTION_ATTEMPTS = 3;
68
68
  export declare const MAX_FILENAME_LENGTH = 30;
69
69
  /**
70
70
  * @@@
71
- * TODO: [🐝] !!! Use
71
+ * TODO: [🐝][main] !!! Use
72
72
  *
73
73
  * @public exported from `@promptbook/core`
74
74
  */
75
75
  export declare const MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH = 3;
76
76
  /**
77
77
  * @@@
78
- * TODO: [🐝] !!! Use
78
+ * TODO: [🐝][main] !!! Use
79
79
  *
80
80
  * @public exported from `@promptbook/core`
81
81
  */
@@ -18,7 +18,7 @@ import type { PipelineString } from '../types/PipelineString';
18
18
  */
19
19
  export declare function pipelineStringToJsonSync(pipelineString: PipelineString): PipelineJson;
20
20
  /**
21
- * TODO: !!!! Warn if used only sync version
21
+ * TODO:[main] !!!! Warn if used only sync version
22
22
  * TODO: [🚞] Report here line/column of error
23
23
  * TODO: Use spaceTrim more effectively
24
24
  * TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
@@ -27,11 +27,11 @@ export declare function validatePipeline(pipeline: PipelineJson): PipelineJson;
27
27
  * > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
28
28
  */
29
29
  /**
30
- * TODO: [🐣] !!!! Validate that all samples match expectations
31
- * TODO: [🐣][🐝] !!!! Validate that knowledge is valid (non-void)
32
- * TODO: [🐣] !!!! Validate that persona can be used only with CHAT variant
33
- * TODO: [🐣] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
34
- * TODO: [🐣] !!!! Validate that reserved parameter is not used as joker
30
+ * TODO: [🐣][main] !!!! Validate that all samples match expectations
31
+ * TODO: [🐣][🐝][main] !!!! Validate that knowledge is valid (non-void)
32
+ * TODO: [🐣][main] !!!! Validate that persona can be used only with CHAT variant
33
+ * TODO: [🐣][main] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
34
+ * TODO: [🐣][main] !!!! Validate that reserved parameter is not used as joker
35
35
  * TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
36
36
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
37
37
  */
@@ -58,7 +58,7 @@ interface CreatePipelineExecutorOptions {
58
58
  export declare function createPipelineExecutor(options: CreatePipelineExecutorOptions): PipelineExecutor;
59
59
  export {};
60
60
  /**
61
- * TODO: !!! Identify not only pipeline BUT exact template ${block(pipelineIdentification)}
61
+ * TODO:[main] !!! Identify not only pipeline BUT exact template ${block(pipelineIdentification)}
62
62
  * TODO: Use isVerbose here (not only pass to `preparePipeline`)
63
63
  * TODO: [🧠][🌳] Use here `countTotalUsage` and put preparation and prepared pipiline to report
64
64
  * TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
@@ -8,7 +8,7 @@ import type { string_markdown } from '../../../types/typeAliases';
8
8
  */
9
9
  export declare function prepareKnowledgeFromMarkdown(knowledgeContent: string_markdown, options: PrepareOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>>>;
10
10
  /**
11
- * TODO: [🐝][🔼] !!! Export via `@promptbook/markdown`
11
+ * TODO: [🐝][🔼][main] !!! Export via `@promptbook/markdown`
12
12
  * TODO: [🪂] Do it in parallel 11:11
13
13
  * Note: No need to aggregate usage here, it is done by intercepting the llmTools
14
14
  */
@@ -8,7 +8,7 @@ import type { string_base64 } from '../../../types/typeAliases';
8
8
  */
9
9
  export declare function prepareKnowledgeFromPdf(content: string_base64, options: PrepareOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>>>;
10
10
  /**
11
- * TODO: [🐝][🔼] !!! Export via `@promptbook/pdf`
11
+ * TODO: [🐝][🔼][main] !!! Export via `@promptbook/pdf`
12
12
  * TODO: [🧺] In future, content can be alse File or Blob BUT for now for wider compatibility its only base64
13
13
  * @see https://stackoverflow.com/questions/14653349/node-js-cant-create-blobs
14
14
  * TODO: [🪂] Do it in parallel
@@ -1,3 +1,4 @@
1
+ import Anthropic from '@anthropic-ai/sdk';
1
2
  import type { AvailableModel } from '../../execution/AvailableModel';
2
3
  import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
3
4
  import type { ChatPromptResult } from '../../execution/PromptResult';
@@ -26,7 +27,7 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
26
27
  constructor(options?: AnthropicClaudeExecutionToolsDirectOptions);
27
28
  get title(): string_title & string_markdown_text;
28
29
  get description(): string_markdown;
29
- private getClient;
30
+ getClient(): Promise<Anthropic>;
30
31
  /**
31
32
  * Check the `options` passed to `constructor`
32
33
  */
@@ -16,7 +16,7 @@ export declare const ANTHROPIC_CLAUDE_MODELS: Array<AvailableModel & {
16
16
  }>;
17
17
  /**
18
18
  * Note: [🤖] Add models of new variant
19
- * TODO: [🧠] !!! Add embedding models OR Anthropic has only chat+completion models?
19
+ * TODO: [🧠][main] !!! Add embedding models OR Anthropic has only chat+completion models?
20
20
  * TODO: [🧠] Some mechanism to propagate unsureness
21
21
  * TODO: [🧠][👮‍♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
22
22
  * TODO: [🎰] Some mechanism to auto-update available models
@@ -11,8 +11,8 @@ export declare const createAnthropicClaudeExecutionTools: ((options: AnthropicCl
11
11
  className: string;
12
12
  };
13
13
  /**
14
- * TODO: [🧠] !!!! Make anonymous this with all LLM providers
15
- * TODO: [🧠][🧱] !!!! Maybe change all `new AnthropicClaudeExecutionTools` -> `createAnthropicClaudeExecutionTools` in manual
14
+ * TODO: [🧠][main] !!!! Make anonymous this with all LLM providers
15
+ * TODO: [🧠][🧱][main] !!!! Maybe change all `new AnthropicClaudeExecutionTools` -> `createAnthropicClaudeExecutionTools` in manual
16
16
  * TODO: [🧠] Maybe auto-detect usage in browser and determine default value of `isProxied`
17
17
  * TODO: [🦺] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
18
18
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ts-node
2
2
  export {};
3
3
  /**
4
- * TODO: !!! Playground with WebGPT / Promptbook.studio anonymous server
5
- * TODO: !!! Test here that `systemMessage`, `temperature` and `seed` are working correctly
4
+ * TODO:[main] !!! Playground with WebGPT / Promptbook.studio anonymous server
5
+ * TODO:[main] !!! Test here that `systemMessage`, `temperature` and `seed` are working correctly
6
6
  */
@@ -1,3 +1,4 @@
1
+ import { OpenAIClient } from '@azure/openai';
1
2
  import type { AvailableModel } from '../../execution/AvailableModel';
2
3
  import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
3
4
  import type { ChatPromptResult } from '../../execution/PromptResult';
@@ -26,7 +27,7 @@ export declare class AzureOpenAiExecutionTools implements LlmExecutionTools {
26
27
  constructor(options: AzureOpenAiExecutionToolsOptions);
27
28
  get title(): string_title & string_markdown_text;
28
29
  get description(): string_markdown;
29
- private getClient;
30
+ getClient(): Promise<OpenAIClient>;
30
31
  /**
31
32
  * Check the `options` passed to `constructor`
32
33
  */
@@ -1,3 +1,4 @@
1
+ import OpenAI from 'openai';
1
2
  import type { AvailableModel } from '../../execution/AvailableModel';
2
3
  import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
3
4
  import type { ChatPromptResult } from '../../execution/PromptResult';
@@ -27,7 +28,7 @@ export declare class OpenAiExecutionTools implements LlmExecutionTools {
27
28
  constructor(options?: OpenAiExecutionToolsOptions);
28
29
  get title(): string_title & string_markdown_text;
29
30
  get description(): string_markdown;
30
- private getClient;
31
+ getClient(): Promise<OpenAI>;
31
32
  /**
32
33
  * Check the `options` passed to `constructor`
33
34
  */
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ts-node
2
2
  export {};
3
3
  /**
4
- * TODO: !!! Test here that `systemMessage`, `temperature` and `seed` are working correctly
4
+ * TODO:[main] !!! Test here that `systemMessage`, `temperature` and `seed` are working correctly
5
5
  */
@@ -9,7 +9,7 @@ import type { string_persona_description } from '../types/typeAliases';
9
9
  */
10
10
  export declare function preparePersona(personaDescription: string_persona_description, options: PrepareOptions): Promise<PersonaPreparedJson['modelRequirements']>;
11
11
  /**
12
- * TODO: [🔃] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
12
+ * TODO: [🔃][main] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
13
13
  * TODO: [🏢] !! Check validity of `modelName` in pipeline
14
14
  * TODO: [🏢] !! Check validity of `systemMessage` in pipeline
15
15
  * TODO: [🏢] !! Check validity of `temperature` in pipeline
@@ -6,7 +6,7 @@ import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
6
6
  */
7
7
  export declare function isPipelinePrepared(pipeline: PipelineJson): boolean;
8
8
  /**
9
- * TODO: [🔃] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
9
+ * TODO: [🔃][main] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
10
10
  * TODO: [🐠] Maybe base this on `makeValidator`
11
11
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
12
12
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
@@ -23,7 +23,7 @@ export {};
23
23
  /**
24
24
  * TODO: [🧠] Add context to each template (if missing)
25
25
  * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
26
- * TODO: [♨] !!! Prepare index the samples and maybe templates
26
+ * TODO: [♨][main] !!! Prepare index the samples and maybe templates
27
27
  * TODO: Write tests for `preparePipeline`
28
28
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
29
29
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
@@ -592,7 +592,7 @@ export type number_megabytes = number_positive;
592
592
  export type number_gigabytes = number_positive;
593
593
  export type number_terabytes = number_positive;
594
594
  /**.
595
- * TODO: !!! Change "For example" to @example
595
+ * TODO:[main] !!! Change "For example" to @example
596
596
  * TODO: !! Change to branded types
597
597
  * TODO: Delete type aliases that are not exported or used internally
598
598
  */
@@ -22,6 +22,6 @@ import type { string_name } from '../../types/typeAliases';
22
22
  export declare function checkSerializableAsJson(name: string_name, value: unknown): void;
23
23
  /**
24
24
  * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
25
- * TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
25
+ * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
26
26
  * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
27
27
  */
@@ -19,6 +19,6 @@
19
19
  */
20
20
  export declare function isSerializableAsJson(value: unknown): boolean;
21
21
  /**
22
- * TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
22
+ * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
23
23
  * TODO: [🧠][💺] Can be done this on type-level?
24
24
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/core",
3
- "version": "0.68.4",
3
+ "version": "0.68.5",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
package/umd/index.umd.js CHANGED
@@ -16,8 +16,8 @@
16
16
  /**
17
17
  * The version of the Promptbook library
18
18
  */
19
- var PROMPTBOOK_VERSION = '0.68.3';
20
- // TODO: !!!! List here all the versions and annotate + put into script
19
+ var PROMPTBOOK_VERSION = '0.68.4';
20
+ // TODO:[main] !!!! List here all the versions and annotate + put into script
21
21
 
22
22
  /*! *****************************************************************************
23
23
  Copyright (c) Microsoft Corporation.
@@ -229,7 +229,7 @@
229
229
  commands.push("PIPELINE URL ".concat(pipelineUrl));
230
230
  }
231
231
  commands.push("PROMPTBOOK VERSION ".concat(promptbookVersion));
232
- // TODO: !!! This increase size of the bundle and is probbably not necessary
232
+ // TODO:[main] !!! This increase size of the bundle and is probbably not necessary
233
233
  pipelineString = prettifyMarkdown(pipelineString);
234
234
  try {
235
235
  for (var _g = __values(parameters.filter(function (_a) {
@@ -377,12 +377,12 @@
377
377
  pipelineString += '```' + contentLanguage;
378
378
  pipelineString += '\n';
379
379
  pipelineString += spaceTrim__default["default"](content);
380
- // <- TODO: !!! Escape
380
+ // <- TODO:[main] !!! Escape
381
381
  // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
382
382
  pipelineString += '\n';
383
383
  pipelineString += '```';
384
384
  pipelineString += '\n\n';
385
- pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: !!! If the parameter here has description, add it and use templateParameterJsonToString
385
+ pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO:[main] !!! If the parameter here has description, add it and use templateParameterJsonToString
386
386
  }
387
387
  }
388
388
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
@@ -602,7 +602,7 @@
602
602
  }
603
603
  /**
604
604
  * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
605
- * TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
605
+ * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
606
606
  * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
607
607
  */
608
608
 
@@ -673,14 +673,14 @@
673
673
  var MAX_FILENAME_LENGTH = 30;
674
674
  /**
675
675
  * @@@
676
- * TODO: [🐝] !!! Use
676
+ * TODO: [🐝][main] !!! Use
677
677
  *
678
678
  * @public exported from `@promptbook/core`
679
679
  */
680
680
  var MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH = 3;
681
681
  /**
682
682
  * @@@
683
- * TODO: [🐝] !!! Use
683
+ * TODO: [🐝][main] !!! Use
684
684
  *
685
685
  * @public exported from `@promptbook/core`
686
686
  */
@@ -835,7 +835,7 @@
835
835
  if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
836
836
  return false;
837
837
  }
838
- // <- TODO: !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
838
+ // <- TODO:[main] !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
839
839
  return true;
840
840
  }
841
841
 
@@ -1179,11 +1179,11 @@
1179
1179
  * > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
1180
1180
  */
1181
1181
  /**
1182
- * TODO: [🐣] !!!! Validate that all samples match expectations
1183
- * TODO: [🐣][🐝] !!!! Validate that knowledge is valid (non-void)
1184
- * TODO: [🐣] !!!! Validate that persona can be used only with CHAT variant
1185
- * TODO: [🐣] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
1186
- * TODO: [🐣] !!!! Validate that reserved parameter is not used as joker
1182
+ * TODO: [🐣][main] !!!! Validate that all samples match expectations
1183
+ * TODO: [🐣][🐝][main] !!!! Validate that knowledge is valid (non-void)
1184
+ * TODO: [🐣][main] !!!! Validate that persona can be used only with CHAT variant
1185
+ * TODO: [🐣][main] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
1186
+ * TODO: [🐣][main] !!!! Validate that reserved parameter is not used as joker
1187
1187
  * TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
1188
1188
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
1189
1189
  */
@@ -1497,7 +1497,7 @@
1497
1497
  });
1498
1498
  }
1499
1499
  /**
1500
- * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
1500
+ * TODO:[main] !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
1501
1501
  */
1502
1502
 
1503
1503
  /**
@@ -2902,7 +2902,7 @@
2902
2902
  return true;
2903
2903
  }
2904
2904
  /**
2905
- * TODO: [🔃] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
2905
+ * TODO: [🔃][main] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
2906
2906
  * TODO: [🐠] Maybe base this on `makeValidator`
2907
2907
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2908
2908
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
@@ -3303,7 +3303,7 @@
3303
3303
  console.warn(spaceTrim.spaceTrim(function (block) { return "\n Pipeline is not prepared\n\n ".concat(block(pipelineIdentification), "\n\n It will be prepared ad-hoc before the first execution and **returned as `preparedPipeline` in `PipelineExecutorResult`**\n But it is recommended to prepare the pipeline during collection preparation\n\n @see more at https://ptbk.io/prepare-pipeline\n "); }));
3304
3304
  }
3305
3305
  var pipelineExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
3306
- // TODO: !!! Extract to separate functions and files - ALL FUNCTIONS BELOW
3306
+ // TODO:[main] !!! Extract to separate functions and files - ALL FUNCTIONS BELOW
3307
3307
  function getContextForTemplate(template) {
3308
3308
  return __awaiter(this, void 0, void 0, function () {
3309
3309
  return __generator(this, function (_a) {
@@ -4122,7 +4122,7 @@
4122
4122
  return pipelineExecutor;
4123
4123
  }
4124
4124
  /**
4125
- * TODO: !!! Identify not only pipeline BUT exact template ${block(pipelineIdentification)}
4125
+ * TODO:[main] !!! Identify not only pipeline BUT exact template ${block(pipelineIdentification)}
4126
4126
  * TODO: Use isVerbose here (not only pass to `preparePipeline`)
4127
4127
  * TODO: [🧠][🌳] Use here `countTotalUsage` and put preparation and prepared pipiline to report
4128
4128
  * TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
@@ -4185,7 +4185,7 @@
4185
4185
  outputParameters = result.outputParameters;
4186
4186
  knowledgePiecesRaw = outputParameters.knowledgePieces;
4187
4187
  knowledgeTextPieces = (knowledgePiecesRaw || '').split('\n---\n');
4188
- // <- TODO: !!!!! Smarter split and filter out empty pieces
4188
+ // <- TODO:[main] !!!!! Smarter split and filter out empty pieces
4189
4189
  if (isVerbose) {
4190
4190
  console.info('knowledgeTextPieces:', knowledgeTextPieces);
4191
4191
  }
@@ -4265,7 +4265,7 @@
4265
4265
  });
4266
4266
  }
4267
4267
  /**
4268
- * TODO: [🐝][🔼] !!! Export via `@promptbook/markdown`
4268
+ * TODO: [🐝][🔼][main] !!! Export via `@promptbook/markdown`
4269
4269
  * TODO: [🪂] Do it in parallel 11:11
4270
4270
  * Note: No need to aggregate usage here, it is done by intercepting the llmTools
4271
4271
  */
@@ -4289,7 +4289,7 @@
4289
4289
  var partialPieces, pieces;
4290
4290
  return __generator(this, function (_a) {
4291
4291
  switch (_a.label) {
4292
- case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.sourceContent, // <- TODO: [🐝] !!! Unhardcode markdown, detect which type it is - BE AWARE of big package size
4292
+ case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.sourceContent, // <- TODO: [🐝][main] !!! Unhardcode markdown, detect which type it is - BE AWARE of big package size
4293
4293
  options)];
4294
4294
  case 1:
4295
4295
  partialPieces = _a.sent();
@@ -4481,7 +4481,7 @@
4481
4481
  });
4482
4482
  }
4483
4483
  /**
4484
- * TODO: [🔃] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
4484
+ * TODO: [🔃][main] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
4485
4485
  * TODO: [🏢] !! Check validity of `modelName` in pipeline
4486
4486
  * TODO: [🏢] !! Check validity of `systemMessage` in pipeline
4487
4487
  * TODO: [🏢] !! Check validity of `temperature` in pipeline
@@ -4530,7 +4530,7 @@
4530
4530
  case 0:
4531
4531
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a;
4532
4532
  templates = pipeline.templates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
4533
- // TODO: !!!!! Apply samples to each template (if missing and is for the template defined)
4533
+ // TODO:[main] !!!!! Apply samples to each template (if missing and is for the template defined)
4534
4534
  TODO_USE(parameters);
4535
4535
  templatesPrepared = new Array(
4536
4536
  // <- TODO: [🧱] Implement in a functional (not new Class) way
@@ -4562,7 +4562,7 @@
4562
4562
  /**
4563
4563
  * TODO: [🧠] Add context to each template (if missing)
4564
4564
  * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
4565
- * TODO: [♨] !!! Prepare index the samples and maybe templates
4565
+ * TODO: [♨][main] !!! Prepare index the samples and maybe templates
4566
4566
  * TODO: Write tests for `preparePipeline`
4567
4567
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
4568
4568
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
@@ -4734,7 +4734,7 @@
4734
4734
  if (sourceContent === '') {
4735
4735
  throw new ParseError("Source is not defined");
4736
4736
  }
4737
- // TODO: !!!! Following checks should be applied every link in the `sourceContent`
4737
+ // TODO:[main] !!!! Following checks should be applied every link in the `sourceContent`
4738
4738
  if (sourceContent.startsWith('http://')) {
4739
4739
  throw new ParseError("Source is not secure");
4740
4740
  }
@@ -4919,7 +4919,7 @@
4919
4919
  if (command.templateType === 'KNOWLEDGE') {
4920
4920
  knowledgeCommandParser.$applyToPipelineJson({
4921
4921
  type: 'KNOWLEDGE',
4922
- sourceContent: $templateJson.content, // <- TODO: [🐝] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
4922
+ sourceContent: $templateJson.content, // <- TODO: [🐝][main] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
4923
4923
  }, $pipelineJson);
4924
4924
  $templateJson.isTemplate = false;
4925
4925
  return;
@@ -7142,7 +7142,7 @@
7142
7142
  return $asDeeplyFrozenSerializableJson('pipelineJson', $pipelineJson);
7143
7143
  }
7144
7144
  /**
7145
- * TODO: !!!! Warn if used only sync version
7145
+ * TODO:[main] !!!! Warn if used only sync version
7146
7146
  * TODO: [🚞] Report here line/column of error
7147
7147
  * TODO: Use spaceTrim more effectively
7148
7148
  * TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
@@ -7417,7 +7417,7 @@
7417
7417
  }
7418
7418
  }
7419
7419
  /**
7420
- * TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
7420
+ * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
7421
7421
  * TODO: [🧠][💺] Can be done this on type-level?
7422
7422
  */
7423
7423