@promptbook/node 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 +25 -25
  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 +2 -2
  24. package/umd/index.umd.js +25 -25
package/esm/index.es.js CHANGED
@@ -14,8 +14,8 @@ import * as dotenv from 'dotenv';
14
14
  /**
15
15
  * The version of the Promptbook library
16
16
  */
17
- var PROMPTBOOK_VERSION = '0.68.3';
18
- // TODO: !!!! List here all the versions and annotate + put into script
17
+ var PROMPTBOOK_VERSION = '0.68.4';
18
+ // TODO:[main] !!!! List here all the versions and annotate + put into script
19
19
 
20
20
  /*! *****************************************************************************
21
21
  Copyright (c) Microsoft Corporation.
@@ -325,7 +325,7 @@ function checkSerializableAsJson(name, value) {
325
325
  }
326
326
  /**
327
327
  * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
328
- * TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
328
+ * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
329
329
  * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
330
330
  */
331
331
 
@@ -494,7 +494,7 @@ function pipelineJsonToString(pipelineJson) {
494
494
  commands.push("PIPELINE URL ".concat(pipelineUrl));
495
495
  }
496
496
  commands.push("PROMPTBOOK VERSION ".concat(promptbookVersion));
497
- // TODO: !!! This increase size of the bundle and is probbably not necessary
497
+ // TODO:[main] !!! This increase size of the bundle and is probbably not necessary
498
498
  pipelineString = prettifyMarkdown(pipelineString);
499
499
  try {
500
500
  for (var _g = __values(parameters.filter(function (_a) {
@@ -642,12 +642,12 @@ function pipelineJsonToString(pipelineJson) {
642
642
  pipelineString += '```' + contentLanguage;
643
643
  pipelineString += '\n';
644
644
  pipelineString += spaceTrim$1(content);
645
- // <- TODO: !!! Escape
645
+ // <- TODO:[main] !!! Escape
646
646
  // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
647
647
  pipelineString += '\n';
648
648
  pipelineString += '```';
649
649
  pipelineString += '\n\n';
650
- pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: !!! If the parameter here has description, add it and use templateParameterJsonToString
650
+ pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO:[main] !!! If the parameter here has description, add it and use templateParameterJsonToString
651
651
  }
652
652
  }
653
653
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
@@ -949,7 +949,7 @@ function isValidPromptbookVersion(version) {
949
949
  if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
950
950
  return false;
951
951
  }
952
- // <- TODO: !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
952
+ // <- TODO:[main] !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
953
953
  return true;
954
954
  }
955
955
 
@@ -1293,11 +1293,11 @@ function validatePipeline(pipeline) {
1293
1293
  * > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
1294
1294
  */
1295
1295
  /**
1296
- * TODO: [🐣] !!!! Validate that all samples match expectations
1297
- * TODO: [🐣][🐝] !!!! Validate that knowledge is valid (non-void)
1298
- * TODO: [🐣] !!!! Validate that persona can be used only with CHAT variant
1299
- * TODO: [🐣] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
1300
- * TODO: [🐣] !!!! Validate that reserved parameter is not used as joker
1296
+ * TODO: [🐣][main] !!!! Validate that all samples match expectations
1297
+ * TODO: [🐣][🐝][main] !!!! Validate that knowledge is valid (non-void)
1298
+ * TODO: [🐣][main] !!!! Validate that persona can be used only with CHAT variant
1299
+ * TODO: [🐣][main] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
1300
+ * TODO: [🐣][main] !!!! Validate that reserved parameter is not used as joker
1301
1301
  * TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
1302
1302
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
1303
1303
  */
@@ -2598,7 +2598,7 @@ function isPipelinePrepared(pipeline) {
2598
2598
  return true;
2599
2599
  }
2600
2600
  /**
2601
- * TODO: [🔃] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
2601
+ * TODO: [🔃][main] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
2602
2602
  * TODO: [🐠] Maybe base this on `makeValidator`
2603
2603
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2604
2604
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
@@ -2977,7 +2977,7 @@ function createPipelineExecutor(options) {
2977
2977
  console.warn(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 "); }));
2978
2978
  }
2979
2979
  var pipelineExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
2980
- // TODO: !!! Extract to separate functions and files - ALL FUNCTIONS BELOW
2980
+ // TODO:[main] !!! Extract to separate functions and files - ALL FUNCTIONS BELOW
2981
2981
  function getContextForTemplate(template) {
2982
2982
  return __awaiter(this, void 0, void 0, function () {
2983
2983
  return __generator(this, function (_a) {
@@ -3796,7 +3796,7 @@ function createPipelineExecutor(options) {
3796
3796
  return pipelineExecutor;
3797
3797
  }
3798
3798
  /**
3799
- * TODO: !!! Identify not only pipeline BUT exact template ${block(pipelineIdentification)}
3799
+ * TODO:[main] !!! Identify not only pipeline BUT exact template ${block(pipelineIdentification)}
3800
3800
  * TODO: Use isVerbose here (not only pass to `preparePipeline`)
3801
3801
  * TODO: [🧠][🌳] Use here `countTotalUsage` and put preparation and prepared pipiline to report
3802
3802
  * TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
@@ -3859,7 +3859,7 @@ function prepareKnowledgeFromMarkdown(knowledgeContent /* <- TODO: [🖖] (?mayb
3859
3859
  outputParameters = result.outputParameters;
3860
3860
  knowledgePiecesRaw = outputParameters.knowledgePieces;
3861
3861
  knowledgeTextPieces = (knowledgePiecesRaw || '').split('\n---\n');
3862
- // <- TODO: !!!!! Smarter split and filter out empty pieces
3862
+ // <- TODO:[main] !!!!! Smarter split and filter out empty pieces
3863
3863
  if (isVerbose) {
3864
3864
  console.info('knowledgeTextPieces:', knowledgeTextPieces);
3865
3865
  }
@@ -3939,7 +3939,7 @@ function prepareKnowledgeFromMarkdown(knowledgeContent /* <- TODO: [🖖] (?mayb
3939
3939
  });
3940
3940
  }
3941
3941
  /**
3942
- * TODO: [🐝][🔼] !!! Export via `@promptbook/markdown`
3942
+ * TODO: [🐝][🔼][main] !!! Export via `@promptbook/markdown`
3943
3943
  * TODO: [🪂] Do it in parallel 11:11
3944
3944
  * Note: No need to aggregate usage here, it is done by intercepting the llmTools
3945
3945
  */
@@ -3963,7 +3963,7 @@ function prepareKnowledgePieces(knowledgeSources, options) {
3963
3963
  var partialPieces, pieces;
3964
3964
  return __generator(this, function (_a) {
3965
3965
  switch (_a.label) {
3966
- case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.sourceContent, // <- TODO: [🐝] !!! Unhardcode markdown, detect which type it is - BE AWARE of big package size
3966
+ case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.sourceContent, // <- TODO: [🐝][main] !!! Unhardcode markdown, detect which type it is - BE AWARE of big package size
3967
3967
  options)];
3968
3968
  case 1:
3969
3969
  partialPieces = _a.sent();
@@ -4155,7 +4155,7 @@ function preparePersona(personaDescription, options) {
4155
4155
  });
4156
4156
  }
4157
4157
  /**
4158
- * TODO: [🔃] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
4158
+ * TODO: [🔃][main] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
4159
4159
  * TODO: [🏢] !! Check validity of `modelName` in pipeline
4160
4160
  * TODO: [🏢] !! Check validity of `systemMessage` in pipeline
4161
4161
  * TODO: [🏢] !! Check validity of `temperature` in pipeline
@@ -4204,7 +4204,7 @@ function prepareTemplates(pipeline, options) {
4204
4204
  case 0:
4205
4205
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a;
4206
4206
  templates = pipeline.templates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
4207
- // TODO: !!!!! Apply samples to each template (if missing and is for the template defined)
4207
+ // TODO:[main] !!!!! Apply samples to each template (if missing and is for the template defined)
4208
4208
  TODO_USE(parameters);
4209
4209
  templatesPrepared = new Array(
4210
4210
  // <- TODO: [🧱] Implement in a functional (not new Class) way
@@ -4236,7 +4236,7 @@ function prepareTemplates(pipeline, options) {
4236
4236
  /**
4237
4237
  * TODO: [🧠] Add context to each template (if missing)
4238
4238
  * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
4239
- * TODO: [♨] !!! Prepare index the samples and maybe templates
4239
+ * TODO: [♨][main] !!! Prepare index the samples and maybe templates
4240
4240
  * TODO: Write tests for `preparePipeline`
4241
4241
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
4242
4242
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
@@ -4408,7 +4408,7 @@ var knowledgeCommandParser = {
4408
4408
  if (sourceContent === '') {
4409
4409
  throw new ParseError("Source is not defined");
4410
4410
  }
4411
- // TODO: !!!! Following checks should be applied every link in the `sourceContent`
4411
+ // TODO:[main] !!!! Following checks should be applied every link in the `sourceContent`
4412
4412
  if (sourceContent.startsWith('http://')) {
4413
4413
  throw new ParseError("Source is not secure");
4414
4414
  }
@@ -4611,7 +4611,7 @@ var templateCommandParser = {
4611
4611
  if (command.templateType === 'KNOWLEDGE') {
4612
4612
  knowledgeCommandParser.$applyToPipelineJson({
4613
4613
  type: 'KNOWLEDGE',
4614
- sourceContent: $templateJson.content, // <- TODO: [🐝] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
4614
+ sourceContent: $templateJson.content, // <- TODO: [🐝][main] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
4615
4615
  }, $pipelineJson);
4616
4616
  $templateJson.isTemplate = false;
4617
4617
  return;
@@ -6834,7 +6834,7 @@ function pipelineStringToJsonSync(pipelineString) {
6834
6834
  return $asDeeplyFrozenSerializableJson('pipelineJson', $pipelineJson);
6835
6835
  }
6836
6836
  /**
6837
- * TODO: !!!! Warn if used only sync version
6837
+ * TODO:[main] !!!! Warn if used only sync version
6838
6838
  * TODO: [🚞] Report here line/column of error
6839
6839
  * TODO: Use spaceTrim more effectively
6840
6840
  * TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
@@ -7617,7 +7617,7 @@ function isSerializableAsJson(value) {
7617
7617
  }
7618
7618
  }
7619
7619
  /**
7620
- * TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
7620
+ * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
7621
7621
  * TODO: [🧠][💺] Can be done this on type-level?
7622
7622
  */
7623
7623
 
@@ -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/node",
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,
@@ -47,7 +47,7 @@
47
47
  "module": "./esm/index.es.js",
48
48
  "typings": "./esm/typings/src/_packages/node.index.d.ts",
49
49
  "peerDependencies": {
50
- "@promptbook/core": "0.68.4"
50
+ "@promptbook/core": "0.68.5"
51
51
  },
52
52
  "dependencies": {
53
53
  "colors": "1.4.0",
package/umd/index.umd.js CHANGED
@@ -35,8 +35,8 @@
35
35
  /**
36
36
  * The version of the Promptbook library
37
37
  */
38
- var PROMPTBOOK_VERSION = '0.68.3';
39
- // TODO: !!!! List here all the versions and annotate + put into script
38
+ var PROMPTBOOK_VERSION = '0.68.4';
39
+ // TODO:[main] !!!! List here all the versions and annotate + put into script
40
40
 
41
41
  /*! *****************************************************************************
42
42
  Copyright (c) Microsoft Corporation.
@@ -346,7 +346,7 @@
346
346
  }
347
347
  /**
348
348
  * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
349
- * TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
349
+ * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
350
350
  * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
351
351
  */
352
352
 
@@ -515,7 +515,7 @@
515
515
  commands.push("PIPELINE URL ".concat(pipelineUrl));
516
516
  }
517
517
  commands.push("PROMPTBOOK VERSION ".concat(promptbookVersion));
518
- // TODO: !!! This increase size of the bundle and is probbably not necessary
518
+ // TODO:[main] !!! This increase size of the bundle and is probbably not necessary
519
519
  pipelineString = prettifyMarkdown(pipelineString);
520
520
  try {
521
521
  for (var _g = __values(parameters.filter(function (_a) {
@@ -663,12 +663,12 @@
663
663
  pipelineString += '```' + contentLanguage;
664
664
  pipelineString += '\n';
665
665
  pipelineString += spaceTrim__default["default"](content);
666
- // <- TODO: !!! Escape
666
+ // <- TODO:[main] !!! Escape
667
667
  // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
668
668
  pipelineString += '\n';
669
669
  pipelineString += '```';
670
670
  pipelineString += '\n\n';
671
- pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: !!! If the parameter here has description, add it and use templateParameterJsonToString
671
+ pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO:[main] !!! If the parameter here has description, add it and use templateParameterJsonToString
672
672
  }
673
673
  }
674
674
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
@@ -970,7 +970,7 @@
970
970
  if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
971
971
  return false;
972
972
  }
973
- // <- TODO: !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
973
+ // <- TODO:[main] !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
974
974
  return true;
975
975
  }
976
976
 
@@ -1314,11 +1314,11 @@
1314
1314
  * > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
1315
1315
  */
1316
1316
  /**
1317
- * TODO: [🐣] !!!! Validate that all samples match expectations
1318
- * TODO: [🐣][🐝] !!!! Validate that knowledge is valid (non-void)
1319
- * TODO: [🐣] !!!! Validate that persona can be used only with CHAT variant
1320
- * TODO: [🐣] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
1321
- * TODO: [🐣] !!!! Validate that reserved parameter is not used as joker
1317
+ * TODO: [🐣][main] !!!! Validate that all samples match expectations
1318
+ * TODO: [🐣][🐝][main] !!!! Validate that knowledge is valid (non-void)
1319
+ * TODO: [🐣][main] !!!! Validate that persona can be used only with CHAT variant
1320
+ * TODO: [🐣][main] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
1321
+ * TODO: [🐣][main] !!!! Validate that reserved parameter is not used as joker
1322
1322
  * TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
1323
1323
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
1324
1324
  */
@@ -2619,7 +2619,7 @@
2619
2619
  return true;
2620
2620
  }
2621
2621
  /**
2622
- * TODO: [🔃] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
2622
+ * TODO: [🔃][main] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
2623
2623
  * TODO: [🐠] Maybe base this on `makeValidator`
2624
2624
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2625
2625
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
@@ -2998,7 +2998,7 @@
2998
2998
  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 "); }));
2999
2999
  }
3000
3000
  var pipelineExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
3001
- // TODO: !!! Extract to separate functions and files - ALL FUNCTIONS BELOW
3001
+ // TODO:[main] !!! Extract to separate functions and files - ALL FUNCTIONS BELOW
3002
3002
  function getContextForTemplate(template) {
3003
3003
  return __awaiter(this, void 0, void 0, function () {
3004
3004
  return __generator(this, function (_a) {
@@ -3817,7 +3817,7 @@
3817
3817
  return pipelineExecutor;
3818
3818
  }
3819
3819
  /**
3820
- * TODO: !!! Identify not only pipeline BUT exact template ${block(pipelineIdentification)}
3820
+ * TODO:[main] !!! Identify not only pipeline BUT exact template ${block(pipelineIdentification)}
3821
3821
  * TODO: Use isVerbose here (not only pass to `preparePipeline`)
3822
3822
  * TODO: [🧠][🌳] Use here `countTotalUsage` and put preparation and prepared pipiline to report
3823
3823
  * TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
@@ -3880,7 +3880,7 @@
3880
3880
  outputParameters = result.outputParameters;
3881
3881
  knowledgePiecesRaw = outputParameters.knowledgePieces;
3882
3882
  knowledgeTextPieces = (knowledgePiecesRaw || '').split('\n---\n');
3883
- // <- TODO: !!!!! Smarter split and filter out empty pieces
3883
+ // <- TODO:[main] !!!!! Smarter split and filter out empty pieces
3884
3884
  if (isVerbose) {
3885
3885
  console.info('knowledgeTextPieces:', knowledgeTextPieces);
3886
3886
  }
@@ -3960,7 +3960,7 @@
3960
3960
  });
3961
3961
  }
3962
3962
  /**
3963
- * TODO: [🐝][🔼] !!! Export via `@promptbook/markdown`
3963
+ * TODO: [🐝][🔼][main] !!! Export via `@promptbook/markdown`
3964
3964
  * TODO: [🪂] Do it in parallel 11:11
3965
3965
  * Note: No need to aggregate usage here, it is done by intercepting the llmTools
3966
3966
  */
@@ -3984,7 +3984,7 @@
3984
3984
  var partialPieces, pieces;
3985
3985
  return __generator(this, function (_a) {
3986
3986
  switch (_a.label) {
3987
- case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.sourceContent, // <- TODO: [🐝] !!! Unhardcode markdown, detect which type it is - BE AWARE of big package size
3987
+ case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.sourceContent, // <- TODO: [🐝][main] !!! Unhardcode markdown, detect which type it is - BE AWARE of big package size
3988
3988
  options)];
3989
3989
  case 1:
3990
3990
  partialPieces = _a.sent();
@@ -4176,7 +4176,7 @@
4176
4176
  });
4177
4177
  }
4178
4178
  /**
4179
- * TODO: [🔃] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
4179
+ * TODO: [🔃][main] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
4180
4180
  * TODO: [🏢] !! Check validity of `modelName` in pipeline
4181
4181
  * TODO: [🏢] !! Check validity of `systemMessage` in pipeline
4182
4182
  * TODO: [🏢] !! Check validity of `temperature` in pipeline
@@ -4225,7 +4225,7 @@
4225
4225
  case 0:
4226
4226
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a;
4227
4227
  templates = pipeline.templates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
4228
- // TODO: !!!!! Apply samples to each template (if missing and is for the template defined)
4228
+ // TODO:[main] !!!!! Apply samples to each template (if missing and is for the template defined)
4229
4229
  TODO_USE(parameters);
4230
4230
  templatesPrepared = new Array(
4231
4231
  // <- TODO: [🧱] Implement in a functional (not new Class) way
@@ -4257,7 +4257,7 @@
4257
4257
  /**
4258
4258
  * TODO: [🧠] Add context to each template (if missing)
4259
4259
  * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
4260
- * TODO: [♨] !!! Prepare index the samples and maybe templates
4260
+ * TODO: [♨][main] !!! Prepare index the samples and maybe templates
4261
4261
  * TODO: Write tests for `preparePipeline`
4262
4262
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
4263
4263
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
@@ -4429,7 +4429,7 @@
4429
4429
  if (sourceContent === '') {
4430
4430
  throw new ParseError("Source is not defined");
4431
4431
  }
4432
- // TODO: !!!! Following checks should be applied every link in the `sourceContent`
4432
+ // TODO:[main] !!!! Following checks should be applied every link in the `sourceContent`
4433
4433
  if (sourceContent.startsWith('http://')) {
4434
4434
  throw new ParseError("Source is not secure");
4435
4435
  }
@@ -4632,7 +4632,7 @@
4632
4632
  if (command.templateType === 'KNOWLEDGE') {
4633
4633
  knowledgeCommandParser.$applyToPipelineJson({
4634
4634
  type: 'KNOWLEDGE',
4635
- sourceContent: $templateJson.content, // <- TODO: [🐝] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
4635
+ sourceContent: $templateJson.content, // <- TODO: [🐝][main] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
4636
4636
  }, $pipelineJson);
4637
4637
  $templateJson.isTemplate = false;
4638
4638
  return;
@@ -6855,7 +6855,7 @@
6855
6855
  return $asDeeplyFrozenSerializableJson('pipelineJson', $pipelineJson);
6856
6856
  }
6857
6857
  /**
6858
- * TODO: !!!! Warn if used only sync version
6858
+ * TODO:[main] !!!! Warn if used only sync version
6859
6859
  * TODO: [🚞] Report here line/column of error
6860
6860
  * TODO: Use spaceTrim more effectively
6861
6861
  * TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
@@ -7638,7 +7638,7 @@
7638
7638
  }
7639
7639
  }
7640
7640
  /**
7641
- * TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
7641
+ * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
7642
7642
  * TODO: [🧠][💺] Can be done this on type-level?
7643
7643
  */
7644
7644