@promptbook/core 0.61.0-16 → 0.61.0-18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  import { createCollectionFromDirectory } from '../collection/constructors/createCollectionFromDirectory';
2
+ import { createLlmToolsFromEnv } from '../llm-providers/_common/createLlmToolsFromEnv';
2
3
  import { PROMPTBOOK_VERSION } from '../version';
3
4
  export { PROMPTBOOK_VERSION };
4
- export { createCollectionFromDirectory };
5
+ export { createCollectionFromDirectory, createLlmToolsFromEnv };
@@ -3,36 +3,36 @@ import type { Prompt } from '../types/Prompt';
3
3
  import type { string_pipeline_url } from '../types/typeAliases';
4
4
  import type { PipelineCollection } from './PipelineCollection';
5
5
  /**
6
- * Library of promptbooks that groups together promptbooks for an application.
7
- * This implementation is a very thin wrapper around the Array / Map of promptbooks.
6
+ * Library of pipelines that groups together pipelines for an application.
7
+ * This implementation is a very thin wrapper around the Array / Map of pipelines.
8
8
  *
9
9
  * @private use `createCollectionFromJson` instead
10
- * @see https://github.com/webgptorg/promptbook#promptbook-collection
10
+ * @see https://github.com/webgptorg/pipeline#pipeline-collection
11
11
  */
12
12
  export declare class SimplePipelineCollection implements PipelineCollection {
13
13
  private collection;
14
14
  /**
15
- * Constructs a pipeline collection from promptbooks
15
+ * Constructs a pipeline collection from pipelines
16
16
  *
17
- * @param promptbooks @@@
17
+ * @param pipelines @@@
18
18
  *
19
19
  * @private Use instead `createCollectionFromJson`
20
- * Note: During the construction logic of all promptbooks are validated
20
+ * Note: During the construction logic of all pipelines are validated
21
21
  * Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
22
22
  */
23
- constructor(...promptbooks: Array<PipelineJson>);
23
+ constructor(...pipelines: Array<PipelineJson>);
24
24
  /**
25
- * Gets all promptbooks in the collection
25
+ * Gets all pipelines in the collection
26
26
  */
27
27
  listPipelines(): Array<string_pipeline_url>;
28
28
  /**
29
- * Gets promptbook by its URL
29
+ * Gets pipeline by its URL
30
30
  *
31
31
  * Note: This is not a direct fetching from the URL, but a lookup in the collection
32
32
  */
33
33
  getPipelineByUrl(url: string_pipeline_url): PipelineJson;
34
34
  /**
35
- * Checks whether given prompt was defined in any promptbook in the collection
35
+ * Checks whether given prompt was defined in any pipeline in the collection
36
36
  */
37
37
  isResponsibleForPrompt(prompt: Prompt): boolean;
38
38
  }
@@ -6,7 +6,7 @@ import type { PipelineCollection } from '../PipelineCollection';
6
6
  */
7
7
  type CreatePipelineCollectionFromDirectoryOptions = PipelineStringToJsonOptions & {
8
8
  /**
9
- * If true, the directory is searched recursively for promptbooks
9
+ * If true, the directory is searched recursively for pipelines
10
10
  *
11
11
  * @default true
12
12
  */
@@ -24,25 +24,25 @@ type CreatePipelineCollectionFromDirectoryOptions = PipelineStringToJsonOptions
24
24
  */
25
25
  isLazyLoaded?: boolean;
26
26
  /**
27
- * If true, whole collection creation crashes on error in any promptbook
28
- * If true and isLazyLoaded is true, the error is thrown on first access to the promptbook
27
+ * If true, whole collection creation crashes on error in any pipeline
28
+ * If true and isLazyLoaded is true, the error is thrown on first access to the pipeline
29
29
  *
30
30
  * @default true
31
31
  */
32
32
  isCrashedOnError?: boolean;
33
33
  };
34
34
  /**
35
- * Constructs Promptbook from given directory
35
+ * Constructs Pipeline from given directory
36
36
  *
37
37
  * Note: Works only in Node.js environment because it reads the file system
38
38
  *
39
- * @param path - path to the directory with promptbooks
39
+ * @param path - path to the directory with pipelines
40
40
  * @param options - Misc options for the collection
41
41
  * @returns PipelineCollection
42
42
  */
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 promptbooks
47
- * Note: [🟢] This code should never be published outside of `@promptbook/node`
46
+ * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json pipelines
47
+ * Note: [🟢] This code should never be published outside of `@pipeline/node`
48
48
  */
@@ -4,6 +4,7 @@ import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
4
4
  */
5
5
  export declare function isPipelinePrepared(pipeline: PipelineJson): boolean;
6
6
  /**
7
+ * TODO: [🐠] Maybe base this on `makeValidator`
7
8
  * TODO: [🔼] Export via core or utils
8
9
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
9
10
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/core",
3
- "version": "0.61.0-16",
3
+ "version": "0.61.0-18",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
package/umd/index.umd.js CHANGED
@@ -858,11 +858,11 @@
858
858
  throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n Can not resolve:\n ".concat(block(unresovedTemplates
859
859
  .map(function (_a) {
860
860
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
861
- return "- {".concat(resultingParameterName, "} depends on ").concat(dependentParameterNames
861
+ return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
862
862
  .map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
863
- .join(', '));
863
+ .join(' and '));
864
864
  })
865
- .join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameters.map(function (name) { return "- {".concat(name, "}"); }).join('\n')), "\n "); }));
865
+ .join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameters.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n "); }));
866
866
  }
867
867
  resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
868
868
  var resultingParameterName = _a.resultingParameterName;
@@ -925,79 +925,94 @@
925
925
  }(Error));
926
926
 
927
927
  /**
928
- * Library of promptbooks that groups together promptbooks for an application.
929
- * This implementation is a very thin wrapper around the Array / Map of promptbooks.
928
+ * Unprepare just strips the preparation data of the pipeline
929
+ */
930
+ function unpreparePipeline(pipeline) {
931
+ var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources;
932
+ personas = personas.map(function (persona) { return (__assign(__assign({}, persona), { modelRequirements: undefined, preparationIds: undefined })); });
933
+ knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
934
+ return __assign(__assign({}, pipeline), { knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] });
935
+ }
936
+ /**
937
+ * TODO: [🔼] !!! Export via `@promptbook/core`
938
+ * TODO: Write tests for `preparePipeline`
939
+ */
940
+
941
+ /**
942
+ * Library of pipelines that groups together pipelines for an application.
943
+ * This implementation is a very thin wrapper around the Array / Map of pipelines.
930
944
  *
931
945
  * @private use `createCollectionFromJson` instead
932
- * @see https://github.com/webgptorg/promptbook#promptbook-collection
946
+ * @see https://github.com/webgptorg/pipeline#pipeline-collection
933
947
  */
934
948
  var SimplePipelineCollection = /** @class */ (function () {
935
949
  /**
936
- * Constructs a pipeline collection from promptbooks
950
+ * Constructs a pipeline collection from pipelines
937
951
  *
938
- * @param promptbooks @@@
952
+ * @param pipelines @@@
939
953
  *
940
954
  * @private Use instead `createCollectionFromJson`
941
- * Note: During the construction logic of all promptbooks are validated
955
+ * Note: During the construction logic of all pipelines are validated
942
956
  * Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
943
957
  */
944
958
  function SimplePipelineCollection() {
945
959
  var e_1, _a;
946
- var promptbooks = [];
960
+ var pipelines = [];
947
961
  for (var _i = 0; _i < arguments.length; _i++) {
948
- promptbooks[_i] = arguments[_i];
962
+ pipelines[_i] = arguments[_i];
949
963
  }
950
964
  this.collection = new Map();
951
965
  try {
952
- for (var promptbooks_1 = __values(promptbooks), promptbooks_1_1 = promptbooks_1.next(); !promptbooks_1_1.done; promptbooks_1_1 = promptbooks_1.next()) {
953
- var promptbook = promptbooks_1_1.value;
954
- if (promptbook.pipelineUrl === undefined) {
955
- throw new ReferenceError$1(spaceTrim.spaceTrim("\n Promptbook with name \"".concat(promptbook.title, "\" does not have defined URL\n\n File:\n ").concat(promptbook.sourceFile || 'Unknown', "\n\n Note: Promptbooks without URLs are called anonymous promptbooks\n They can be used as standalone promptbooks, but they cannot be referenced by other promptbooks\n And also they cannot be used in the pipeline collection\n\n ")));
966
+ for (var pipelines_1 = __values(pipelines), pipelines_1_1 = pipelines_1.next(); !pipelines_1_1.done; pipelines_1_1 = pipelines_1.next()) {
967
+ var pipeline = pipelines_1_1.value;
968
+ if (pipeline.pipelineUrl === undefined) {
969
+ throw new ReferenceError$1(spaceTrim.spaceTrim("\n Pipeline with name \"".concat(pipeline.title, "\" does not have defined URL\n\n File:\n ").concat(pipeline.sourceFile || 'Unknown', "\n\n Note: Pipelines without URLs are called anonymous pipelines\n They can be used as standalone pipelines, but they cannot be referenced by other pipelines\n And also they cannot be used in the pipeline collection\n\n ")));
956
970
  }
957
- validatePipeline(promptbook);
971
+ validatePipeline(pipeline);
958
972
  // Note: [🦄]
959
- if (this.collection.has(promptbook.pipelineUrl) &&
960
- pipelineJsonToString(promptbook) !== pipelineJsonToString(this.collection.get(promptbook.pipelineUrl))) {
961
- var existing = this.collection.get(promptbook.pipelineUrl);
962
- throw new ReferenceError$1(spaceTrim.spaceTrim("\n Promptbook with URL \"".concat(promptbook.pipelineUrl, "\" is already in the collection\n\n Conflicting files:\n ").concat(existing.sourceFile || 'Unknown', "\n ").concat(promptbook.sourceFile || 'Unknown', "\n\n Note: Promptbooks with the same URL are not allowed\n Only exepction is when the promptbooks are identical\n\n ")));
973
+ if (this.collection.has(pipeline.pipelineUrl) &&
974
+ pipelineJsonToString(unpreparePipeline(pipeline)) !==
975
+ pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
976
+ var existing = this.collection.get(pipeline.pipelineUrl);
977
+ throw new ReferenceError$1(spaceTrim.spaceTrim("\n Pipeline with URL \"".concat(pipeline.pipelineUrl, "\" is already in the collection\n\n Conflicting files:\n ").concat(existing.sourceFile || 'Unknown', "\n ").concat(pipeline.sourceFile || 'Unknown', "\n\n Note: Pipelines with the same URL are not allowed\n Only exepction is when the pipelines are identical\n\n ")));
963
978
  }
964
- this.collection.set(promptbook.pipelineUrl, promptbook);
979
+ this.collection.set(pipeline.pipelineUrl, pipeline);
965
980
  }
966
981
  }
967
982
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
968
983
  finally {
969
984
  try {
970
- if (promptbooks_1_1 && !promptbooks_1_1.done && (_a = promptbooks_1.return)) _a.call(promptbooks_1);
985
+ if (pipelines_1_1 && !pipelines_1_1.done && (_a = pipelines_1.return)) _a.call(pipelines_1);
971
986
  }
972
987
  finally { if (e_1) throw e_1.error; }
973
988
  }
974
989
  }
975
990
  /**
976
- * Gets all promptbooks in the collection
991
+ * Gets all pipelines in the collection
977
992
  */
978
993
  SimplePipelineCollection.prototype.listPipelines = function () {
979
994
  return Array.from(this.collection.keys());
980
995
  };
981
996
  /**
982
- * Gets promptbook by its URL
997
+ * Gets pipeline by its URL
983
998
  *
984
999
  * Note: This is not a direct fetching from the URL, but a lookup in the collection
985
1000
  */
986
1001
  SimplePipelineCollection.prototype.getPipelineByUrl = function (url) {
987
1002
  var _this = this;
988
- var promptbook = this.collection.get(url);
989
- if (!promptbook) {
1003
+ var pipeline = this.collection.get(url);
1004
+ if (!pipeline) {
990
1005
  if (this.listPipelines().length === 0) {
991
- throw new NotFoundError(spaceTrim.spaceTrim("\n Promptbook with url \"".concat(url, "\" not found\n\n No promptbooks available\n ")));
1006
+ throw new NotFoundError(spaceTrim.spaceTrim("\n Pipeline with url \"".concat(url, "\" not found\n\n No pipelines available\n ")));
992
1007
  }
993
- throw new NotFoundError(spaceTrim.spaceTrim(function (block) { return "\n Promptbook with url \"".concat(url, "\" not found\n\n Available promptbooks:\n ").concat(block(_this.listPipelines()
1008
+ throw new NotFoundError(spaceTrim.spaceTrim(function (block) { return "\n Pipeline with url \"".concat(url, "\" not found\n\n Available pipelines:\n ").concat(block(_this.listPipelines()
994
1009
  .map(function (pipelineUrl) { return "- ".concat(pipelineUrl); })
995
1010
  .join('\n')), "\n\n "); }));
996
1011
  }
997
- return promptbook;
1012
+ return pipeline;
998
1013
  };
999
1014
  /**
1000
- * Checks whether given prompt was defined in any promptbook in the collection
1015
+ * Checks whether given prompt was defined in any pipeline in the collection
1001
1016
  */
1002
1017
  SimplePipelineCollection.prototype.isResponsibleForPrompt = function (prompt) {
1003
1018
  return true;
@@ -1431,7 +1446,7 @@
1431
1446
  });
1432
1447
  }
1433
1448
 
1434
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-15",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",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> {content}",dependentParameterNames:["content"],resultingParameterName:"knowledge"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-15",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-15",parameters:[{name:"content",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> {content}",dependentParameterNames:["content"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-15",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-15",parameters:[{name:"content",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> {content}",expectations:{words:{min:1,max:8}},dependentParameterNames:["content"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-15",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-15",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-15",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"}];
1449
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-17",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",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> {content}",dependentParameterNames:["content"],resultingParameterName:"knowledge"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-17",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-17",parameters:[{name:"content",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> {content}",dependentParameterNames:["content"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-17",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-17",parameters:[{name:"content",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> {content}",expectations:{words:{min:1,max:8}},dependentParameterNames:["content"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-17",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-17",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-17",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"}];
1435
1450
 
1436
1451
  var defaultDiacriticsRemovalMap = [
1437
1452
  {
@@ -2183,7 +2198,7 @@
2183
2198
  throw new PipelineExecutionError(spaceTrim__default["default"](function (block) { return "\n All execution tools failed:\n\n ".concat(block(errors.map(function (error) { return "- ".concat(error.name || 'Error', ": ").concat(error.message); }).join('\n')), "\n\n "); }));
2184
2199
  }
2185
2200
  else {
2186
- throw new PipelineExecutionError(spaceTrim__default["default"](function (block) { return "\n No execution tools available for model variant \"".concat(prompt.modelRequirements.modelVariant, "\".\n\n tl;dr\n\n You have provided no LLM Execution Tools that support model variant \"").concat(prompt.modelRequirements.modelVariant, ":\n ").concat(block(_this.llmExecutionTools
2201
+ throw new PipelineExecutionError(spaceTrim__default["default"](function (block) { return "\n You have not provided any `LlmExecutionTools` that support model variant \"".concat(prompt.modelRequirements.modelVariant, "\n\n Available `LlmExecutionTools`:\n ").concat(block(_this.llmExecutionTools
2187
2202
  .map(function (tools) { return "- ".concat(tools.title, " ").concat(tools.description || ''); })
2188
2203
  .join('\n')), "\n\n "); }));
2189
2204
  }
@@ -2262,7 +2277,7 @@
2262
2277
  llmExecutionTools[_i] = arguments[_i];
2263
2278
  }
2264
2279
  if (llmExecutionTools.length === 0) {
2265
- var warningMessage = spaceTrim__default["default"]("\n You have provided no LLM Execution Tools.\n This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.\n\n Technically, it's not an error, but it's probably not what you want because it does not make sense to use Promptbook without language models.\n ");
2280
+ var warningMessage = spaceTrim__default["default"]("\n You have not provided any `LlmExecutionTools`\n This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.\n\n Technically, it's not an error, but it's probably not what you want because it does not make sense to use Promptbook without language models.\n ");
2266
2281
  // TODO: [🟥] Detect browser / node and make it colorfull
2267
2282
  console.warn(warningMessage);
2268
2283
  /*
@@ -2296,9 +2311,11 @@
2296
2311
  // Note: Ignoring `pipeline.preparations` @@@
2297
2312
  // Note: Ignoring `pipeline.knowledgePieces` @@@
2298
2313
  if (!pipeline.personas.every(function (persona) { return persona.modelRequirements !== undefined; })) {
2314
+ console.log('!!!!', 'Not all personas have modelRequirements');
2299
2315
  return false;
2300
2316
  }
2301
2317
  if (!pipeline.knowledgeSources.every(function (knowledgeSource) { return knowledgeSource.preparationIds !== undefined; })) {
2318
+ console.log('!!!!', 'Not all knowledgeSources have preparationIds');
2302
2319
  return false;
2303
2320
  }
2304
2321
  // TODO: !!!!! Is context in each template
@@ -2307,6 +2324,7 @@
2307
2324
  return true;
2308
2325
  }
2309
2326
  /**
2327
+ * TODO: [🐠] Maybe base this on `makeValidator`
2310
2328
  * TODO: [🔼] Export via core or utils
2311
2329
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2312
2330
  */
@@ -2422,7 +2440,7 @@
2422
2440
  /**
2423
2441
  * The version of the Promptbook library
2424
2442
  */
2425
- var PROMPTBOOK_VERSION = '0.61.0-15';
2443
+ var PROMPTBOOK_VERSION = '0.61.0-17';
2426
2444
  // TODO: !!!! List here all the versions and annotate + put into script
2427
2445
 
2428
2446
  /**
@@ -5848,20 +5866,6 @@
5848
5866
  * Note: [🔵] This code should never be published outside of `@promptbook/browser`
5849
5867
  */
5850
5868
 
5851
- /**
5852
- * Unprepare just strips the preparation data of the pipeline
5853
- */
5854
- function unpreparePipeline(pipeline) {
5855
- var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources;
5856
- personas = personas.map(function (persona) { return (__assign(__assign({}, persona), { modelRequirements: undefined, preparationIds: undefined })); });
5857
- knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
5858
- return __assign(__assign({}, pipeline), { knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] });
5859
- }
5860
- /**
5861
- * TODO: [🔼] !!! Export via `@promptbook/core`
5862
- * TODO: Write tests for `preparePipeline`
5863
- */
5864
-
5865
5869
  /**
5866
5870
  * Default options for generating an execution report string
5867
5871
  */