@promptbook/core 0.61.0-26 → 0.61.0-28

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 (33) hide show
  1. package/esm/index.es.js +29 -29
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +0 -1
  4. package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
  5. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +6 -6
  6. package/esm/typings/src/execution/PipelineExecutor.d.ts +1 -1
  7. package/esm/typings/src/execution/PromptResult.d.ts +15 -0
  8. package/esm/typings/src/execution/createPipelineExecutor.d.ts +3 -3
  9. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
  10. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
  11. package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +2 -2
  12. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +3 -3
  13. package/esm/typings/src/prepare/preparePipeline.d.ts +1 -1
  14. package/esm/typings/src/prepare/prepareTemplates.d.ts +1 -1
  15. package/esm/typings/src/types/ModelRequirements.d.ts +1 -1
  16. package/esm/typings/src/utils/extractParameterNames.d.ts +0 -3
  17. package/package.json +1 -1
  18. package/umd/index.umd.js +29 -29
  19. package/umd/index.umd.js.map +1 -1
  20. package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +0 -1
  21. package/umd/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
  22. package/umd/typings/src/conversion/validation/validatePipeline.d.ts +6 -6
  23. package/umd/typings/src/execution/PipelineExecutor.d.ts +1 -1
  24. package/umd/typings/src/execution/PromptResult.d.ts +15 -0
  25. package/umd/typings/src/execution/createPipelineExecutor.d.ts +3 -3
  26. package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
  27. package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
  28. package/umd/typings/src/llm-providers/remote/startRemoteServer.d.ts +2 -2
  29. package/umd/typings/src/prepare/isPipelinePrepared.d.ts +3 -3
  30. package/umd/typings/src/prepare/preparePipeline.d.ts +1 -1
  31. package/umd/typings/src/prepare/prepareTemplates.d.ts +1 -1
  32. package/umd/typings/src/types/ModelRequirements.d.ts +1 -1
  33. package/umd/typings/src/utils/extractParameterNames.d.ts +0 -3
@@ -43,6 +43,5 @@ type CreatePipelineCollectionFromDirectoryOptions = PipelineStringToJsonOptions
43
43
  export declare function createCollectionFromDirectory(path: string_folder_path, options?: CreatePipelineCollectionFromDirectoryOptions): Promise<PipelineCollection>;
44
44
  export {};
45
45
  /**
46
- * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json pipelines
47
46
  * Note: [🟢] This code should never be published outside of `@pipeline/node`
48
47
  */
@@ -7,7 +7,7 @@ import type { string_json } from '../../types/typeAliases';
7
7
  */
8
8
  export declare function stringifyPipelineJson<TType>(pipeline: TType): string_json<TType>;
9
9
  /**
10
- * TODO: !!!! Not Working propperly @see https://promptbook.studio/samples/mixed-knowledge.ptbk.md
10
+ * TODO: [🐝] Not Working propperly @see https://promptbook.studio/samples/mixed-knowledge.ptbk.md
11
11
  * TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
12
12
  * TODO: [🧠] Maybe more elegant solution than replacing via regex
13
13
  * TODO: [🍙] Make some standart order of json properties
@@ -26,11 +26,11 @@ export declare function validatePipeline(pipeline: PipelineJson): PipelineJson;
26
26
  * > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
27
27
  */
28
28
  /**
29
- * TODO: [🧠][🐣] !!!! Validate that all samples match expectations
30
- * TODO: [🧠][🐣] !!!! Validate that knowledge is valid (non-void)
31
- * TODO: [🧠][🐣] !!!! Validate that persona can be used only with CHAT variant
32
- * TODO: !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
33
- * TODO: !!!! Validate that reserved parameter is not used as joker
34
- * TODO: [🧠] !!! Validationg not only logic itself but imports around - files and websites and rerefenced pipelines exists
29
+ * TODO: [🐣] !!!! Validate that all samples match expectations
30
+ * TODO: [🐣][🐝] !!!! Validate that knowledge is valid (non-void)
31
+ * TODO: [🐣] !!!! Validate that persona can be used only with CHAT variant
32
+ * TODO: [🐣] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
33
+ * TODO: [🐣] !!!! Validate that reserved parameter is not used as joker
34
+ * TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
35
35
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
36
36
  */
@@ -48,5 +48,5 @@ export type PipelineExecutorResult = {
48
48
  };
49
49
  /**
50
50
  * TODO: [🧠] Should this file be in /execution or /types folder?
51
- * TODO: [💷] !!!! `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result
51
+ * TODO: [💷] `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result
52
52
  */
@@ -1,5 +1,6 @@
1
1
  import type { string_date_iso8601 } from '../types/typeAliases';
2
2
  import type { string_model_name } from '../types/typeAliases';
3
+ import type { string_prompt } from '../types/typeAliases';
3
4
  import type { TODO_object } from '../utils/organization/TODO_object';
4
5
  import type { EmbeddingVector } from './EmbeddingVector';
5
6
  import type { PromptResultUsage } from './PromptResultUsage';
@@ -69,8 +70,22 @@ export type CommonPromptResult = {
69
70
  * Usage of the prompt execution
70
71
  */
71
72
  readonly usage: PromptResultUsage;
73
+ /**
74
+ * Exact text of the prompt (with all replacements)
75
+ *
76
+ * Note: This contains redundant information
77
+ */
78
+ readonly rawPromptContent: string_prompt;
79
+ /**
80
+ * Raw request to the model
81
+ *
82
+ * Note: This contains redundant information
83
+ */
84
+ readonly rawRequest: TODO_object | null;
72
85
  /**
73
86
  * Raw response from the model
87
+ *
88
+ * Note: This contains redundant information
74
89
  */
75
90
  readonly rawResponse: TODO_object;
76
91
  };
@@ -47,8 +47,8 @@ interface CreatePipelineExecutorOptions {
47
47
  export declare function createPipelineExecutor(options: CreatePipelineExecutorOptions): PipelineExecutor;
48
48
  export {};
49
49
  /**
50
- * TODO: !!!! return `preparedPipeline` from execution
51
- * TODO: !!!! `isNotPreparedWarningSupressed`
50
+ * TODO: !!!!! return `preparedPipeline` from execution
51
+ * TODO: !!!!! `isNotPreparedWarningSupressed`
52
52
  * TODO: Use isVerbose here (not only pass to `preparePipeline`)
53
53
  * TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
54
54
  * TODO: [♈] Probbably move expectations from templates to parameters
@@ -57,5 +57,5 @@ export {};
57
57
  * Note: CreatePipelineExecutorOptions are just connected to PipelineExecutor so do not extract to types folder
58
58
  * TODO: [🧠][3] transparent = (report intermediate parameters) / opaque execution = (report only output parameters) progress reporting mode
59
59
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
60
- * TODO: [💷] !!!! `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result
60
+ * TODO: [🧠][💷] `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result BUT maybe NOT to preserve pure JSON object
61
61
  */
@@ -41,7 +41,7 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
41
41
  listModels(): Array<AvailableModel>;
42
42
  }
43
43
  /**
44
- * TODO: !!!! [🍆] JSON mode
44
+ * TODO: [🍆] JSON mode
45
45
  * TODO: [🧠] Maybe handle errors via transformAnthropicError (like transformAzureError)
46
46
  * TODO: Maybe Create some common util for callChatModel and callCompletionModel
47
47
  * TODO: Maybe make custom OpenaiError
@@ -50,5 +50,5 @@ export declare class RemoteLlmExecutionTools implements LlmExecutionTools {
50
50
  }
51
51
  /**
52
52
  * TODO: [🍓] Allow to list compatible models with each variant
53
- * TODO: [🤹‍♂️] RemoteLlmExecutionTools should extend Destroyable and implement IDestroyable
53
+ * TODO: [🗯] RemoteLlmExecutionTools should extend Destroyable and implement IDestroyable
54
54
  */
@@ -12,8 +12,8 @@ export declare function startRemoteServer(options: RemoteServerOptions): IDestro
12
12
  /**
13
13
  * TODO: [⚖] Expose the collection to be able to connect to same collection via createCollectionFromUrl
14
14
  * TODO: Handle progress - support streaming
15
- * TODO: [🤹‍♂️] Do not hang up immediately but wait until client closes OR timeout
16
- * TODO: [🤹‍♂️] Timeout on chat to free up resources
15
+ * TODO: [🗯] Do not hang up immediately but wait until client closes OR timeout
16
+ * TODO: [🗯] Timeout on chat to free up resources
17
17
  * TODO: [🃏] Pass here some security token to prevent malitious usage and/or DDoS
18
18
  * TODO: [0] Set unavailable models as undefined in `RemoteLlmExecutionTools` NOT throw error here
19
19
  */
@@ -8,7 +8,7 @@ export declare function isPipelinePrepared(pipeline: PipelineJson): boolean;
8
8
  * TODO: [🔼] Export via core or utils
9
9
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
10
10
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
11
- * - Is context in each template
12
- * - Are samples prepared
13
- * - Are templates prepared
11
+ * - [🏍] ? Is context in each template
12
+ * - [♨] Are samples prepared
13
+ * - [♨] Are templates prepared
14
14
  */
@@ -12,6 +12,6 @@ export declare function preparePipeline(pipeline: PipelineJson, options: Prepare
12
12
  * TODO: Write tests for `preparePipeline`
13
13
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
14
14
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
15
- * TODO: [🎐] !!!! Use here countTotalUsage
15
+ * TODO: [🎐] !!!!! Use here countTotalUsage
16
16
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
17
17
  */
@@ -21,7 +21,7 @@ export {};
21
21
  /**
22
22
  * TODO: [🧠] Add context to each template (if missing)
23
23
  * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
24
- * TODO: !!!!! Index the samples and maybe templates
24
+ * TODO: [♨] !!! Prepare index the samples and maybe templates
25
25
  * TODO: [🔼] !!! Export via `@promptbook/core`
26
26
  * TODO: Write tests for `preparePipeline`
27
27
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
@@ -91,7 +91,7 @@ export type CommonModelRequirements = {
91
91
  readonly maxTokens?: number;
92
92
  };
93
93
  /**
94
- * TODO: [🔼] !!!! Export all from `@promptbook/types`
94
+ * TODO: [🔼] !!!!! (<- To all [🔼]) Export all from `@promptbook/types`
95
95
  * TODO: [🧠][🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (simmilar that `user` identification is not here)
96
96
  * TODO: [🧠][💱] Add more model options: `stop_token`, `logit_bias`, `logprobs` (`top_logprobs`), `top_k`, `top_p`, `presence_penalty`, `frequency_penalty`, `bestOf`, `logitBias`, `logitBiasType`,...
97
97
  * [💱] Probbably keep using just `temperature` in Promptbook (not `top_k` and `top_p`)
@@ -7,6 +7,3 @@ import type { string_template } from '../types/typeAliases';
7
7
  * @returns the list of parameter names
8
8
  */
9
9
  export declare function extractParameterNames(template: string_template): Set<string_parameter_name>;
10
- /**
11
- * TODO: !!!!! Rename to extractParameterNames
12
- */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/core",
3
- "version": "0.61.0-26",
3
+ "version": "0.61.0-28",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
package/umd/index.umd.js CHANGED
@@ -582,7 +582,7 @@
582
582
  if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
583
583
  return false;
584
584
  }
585
- // <- TODO: !!!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
585
+ // <- TODO: !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
586
586
  return true;
587
587
  }
588
588
 
@@ -922,12 +922,12 @@
922
922
  * > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
923
923
  */
924
924
  /**
925
- * TODO: [🧠][🐣] !!!! Validate that all samples match expectations
926
- * TODO: [🧠][🐣] !!!! Validate that knowledge is valid (non-void)
927
- * TODO: [🧠][🐣] !!!! Validate that persona can be used only with CHAT variant
928
- * TODO: !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
929
- * TODO: !!!! Validate that reserved parameter is not used as joker
930
- * TODO: [🧠] !!! Validationg not only logic itself but imports around - files and websites and rerefenced pipelines exists
925
+ * TODO: [🐣] !!!! Validate that all samples match expectations
926
+ * TODO: [🐣][🐝] !!!! Validate that knowledge is valid (non-void)
927
+ * TODO: [🐣] !!!! Validate that persona can be used only with CHAT variant
928
+ * TODO: [🐣] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
929
+ * TODO: [🐣] !!!! Validate that reserved parameter is not used as joker
930
+ * TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
931
931
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
932
932
  */
933
933
 
@@ -985,9 +985,6 @@
985
985
  }
986
986
  return parameterNames;
987
987
  }
988
- /**
989
- * TODO: !!!!! Rename to extractParameterNames
990
- */
991
988
 
992
989
  /**
993
990
  * Unprepare just strips the preparation data of the pipeline
@@ -1527,7 +1524,7 @@
1527
1524
  });
1528
1525
  }
1529
1526
 
1530
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-25",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",dependentParameterNames:["knowledgeContent"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-25",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.61.0-25",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-25",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.61.0-25",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-25",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.61.0-25",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Option `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-25",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
1527
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-27",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",dependentParameterNames:["knowledgeContent"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-27",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.61.0-27",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-27",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.61.0-27",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-27",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.61.0-27",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Option `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-27",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
1531
1528
 
1532
1529
  var defaultDiacriticsRemovalMap = [
1533
1530
  {
@@ -2039,7 +2036,7 @@
2039
2036
  /**
2040
2037
  * Function isValidJsonString will tell you if the string is valid JSON or not
2041
2038
  */
2042
- function isValidJsonString(value /* <-[👨‍⚖️] */) {
2039
+ function isValidJsonString(value /* <- [👨‍⚖️] */) {
2043
2040
  try {
2044
2041
  JSON.parse(value);
2045
2042
  return true;
@@ -2323,9 +2320,9 @@
2323
2320
  * TODO: [🔼] Export via core or utils
2324
2321
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2325
2322
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
2326
- * - Is context in each template
2327
- * - Are samples prepared
2328
- * - Are templates prepared
2323
+ * - [🏍] ? Is context in each template
2324
+ * - [♨] Are samples prepared
2325
+ * - [♨] Are templates prepared
2329
2326
  */
2330
2327
 
2331
2328
  /**
@@ -2532,7 +2529,7 @@
2532
2529
  /**
2533
2530
  * The version of the Promptbook library
2534
2531
  */
2535
- var PROMPTBOOK_VERSION = '0.61.0-25';
2532
+ var PROMPTBOOK_VERSION = '0.61.0-27';
2536
2533
  // TODO: !!!! List here all the versions and annotate + put into script
2537
2534
 
2538
2535
  /**
@@ -2683,7 +2680,7 @@
2683
2680
  pipeline = rawPipeline;
2684
2681
  }
2685
2682
  else {
2686
- // TODO: !!!! This should be maybe warning in report
2683
+ // TODO: !!!!! This should be maybe warning in report
2687
2684
  console.warn(spaceTrim.spaceTrim("\n Pipeline ".concat(rawPipeline.pipelineUrl || rawPipeline.sourceFile || rawPipeline.title, " is not prepared\n\n ").concat(rawPipeline.sourceFile, "\n\n It will be prepared ad-hoc before the first execution\n But it is recommended to prepare the pipeline during collection preparation\n\n @see more at https://ptbk.io/prepare-pipeline\n ")));
2688
2685
  }
2689
2686
  var pipelineExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
@@ -2693,7 +2690,7 @@
2693
2690
  return __awaiter(this, void 0, void 0, function () {
2694
2691
  return __generator(this, function (_a) {
2695
2692
  TODO_USE(template);
2696
- return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: !!!! Implement */];
2693
+ return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
2697
2694
  });
2698
2695
  });
2699
2696
  }
@@ -2701,7 +2698,7 @@
2701
2698
  template) {
2702
2699
  return __awaiter(this, void 0, void 0, function () {
2703
2700
  return __generator(this, function (_a) {
2704
- // TODO: !!!! Implement Better - use real index and keyword search
2701
+ // TODO: [♨] Implement Better - use real index and keyword search
2705
2702
  TODO_USE(template);
2706
2703
  return [2 /*return*/, pipeline.knowledgePieces.map(function (_a) {
2707
2704
  var content = _a.content;
@@ -2714,9 +2711,9 @@
2714
2711
  template) {
2715
2712
  return __awaiter(this, void 0, void 0, function () {
2716
2713
  return __generator(this, function (_a) {
2717
- // TODO: !!!! Implement Better - use real index and keyword search
2714
+ // TODO: [♨] Implement Better - use real index and keyword search
2718
2715
  TODO_USE(template);
2719
- return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: !!!! Implement */];
2716
+ return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
2720
2717
  });
2721
2718
  });
2722
2719
  }
@@ -3442,8 +3439,8 @@
3442
3439
  return pipelineExecutor;
3443
3440
  }
3444
3441
  /**
3445
- * TODO: !!!! return `preparedPipeline` from execution
3446
- * TODO: !!!! `isNotPreparedWarningSupressed`
3442
+ * TODO: !!!!! return `preparedPipeline` from execution
3443
+ * TODO: !!!!! `isNotPreparedWarningSupressed`
3447
3444
  * TODO: Use isVerbose here (not only pass to `preparePipeline`)
3448
3445
  * TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
3449
3446
  * TODO: [♈] Probbably move expectations from templates to parameters
@@ -3452,7 +3449,7 @@
3452
3449
  * Note: CreatePipelineExecutorOptions are just connected to PipelineExecutor so do not extract to types folder
3453
3450
  * TODO: [🧠][3] transparent = (report intermediate parameters) / opaque execution = (report only output parameters) progress reporting mode
3454
3451
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
3455
- * TODO: [💷] !!!! `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result
3452
+ * TODO: [🧠][💷] `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result BUT maybe NOT to preserve pure JSON object
3456
3453
  */
3457
3454
 
3458
3455
  /**
@@ -3728,7 +3725,7 @@
3728
3725
  case 0:
3729
3726
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a;
3730
3727
  promptTemplates = pipeline.promptTemplates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
3731
- // TODO: !!!! Apply samples to each template (if missing and is for the template defined)
3728
+ // TODO: !!!!! Apply samples to each template (if missing and is for the template defined)
3732
3729
  TODO_USE(parameters);
3733
3730
  promptTemplatesPrepared = new Array(promptTemplates.length);
3734
3731
  return [4 /*yield*/, forEachAsync(promptTemplates, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (template, index) { return __awaiter(_this, void 0, void 0, function () {
@@ -3758,7 +3755,7 @@
3758
3755
  /**
3759
3756
  * TODO: [🧠] Add context to each template (if missing)
3760
3757
  * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
3761
- * TODO: !!!!! Index the samples and maybe templates
3758
+ * TODO: [♨] !!! Prepare index the samples and maybe templates
3762
3759
  * TODO: [🔼] !!! Export via `@promptbook/core`
3763
3760
  * TODO: Write tests for `preparePipeline`
3764
3761
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
@@ -3837,7 +3834,7 @@
3837
3834
  * TODO: Write tests for `preparePipeline`
3838
3835
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
3839
3836
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
3840
- * TODO: [🎐] !!!! Use here countTotalUsage
3837
+ * TODO: [🎐] !!!!! Use here countTotalUsage
3841
3838
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
3842
3839
  */
3843
3840
 
@@ -5977,7 +5974,7 @@
5977
5974
  return pipelineJsonStringified;
5978
5975
  }
5979
5976
  /**
5980
- * TODO: !!!! Not Working propperly @see https://promptbook.studio/samples/mixed-knowledge.ptbk.md
5977
+ * TODO: [🐝] Not Working propperly @see https://promptbook.studio/samples/mixed-knowledge.ptbk.md
5981
5978
  * TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
5982
5979
  * TODO: [🧠] Maybe more elegant solution than replacing via regex
5983
5980
  * TODO: [🍙] Make some standart order of json properties
@@ -6371,7 +6368,10 @@
6371
6368
  if (just(true)) {
6372
6369
  executionReportString +=
6373
6370
  '\n\n\n\n' +
6374
- spaceTrim.spaceTrim(function (block) { return "\n\n ### Prompt\n\n ```\n ".concat(block(escapeMarkdownBlock(promptExecution.prompt.content)), "\n ```\n\n "); });
6371
+ spaceTrim.spaceTrim(function (block) {
6372
+ var _a;
6373
+ return "\n\n ### Prompt\n\n ```\n ".concat(block(escapeMarkdownBlock(((_a = promptExecution.result) === null || _a === void 0 ? void 0 : _a.rawPromptContent) || promptExecution.prompt.content)), "\n ```\n\n ");
6374
+ });
6375
6375
  }
6376
6376
  if (promptExecution.result && promptExecution.result.content) {
6377
6377
  executionReportString += '\n\n\n\n' + '### Result' + '\n\n';