@promptbook/core 0.65.0-4 → 0.65.0-6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/index.es.js CHANGED
@@ -14,7 +14,7 @@ import moment from 'moment';
14
14
  /**
15
15
  * The version of the Promptbook library
16
16
  */
17
- var PROMPTBOOK_VERSION = '0.65.0-3';
17
+ var PROMPTBOOK_VERSION = '0.65.0-5';
18
18
  // TODO: !!!! List here all the versions and annotate + put into script
19
19
 
20
20
  /*! *****************************************************************************
@@ -1629,7 +1629,7 @@ function forEachAsync(array, options, callbackfunction) {
1629
1629
  });
1630
1630
  }
1631
1631
 
1632
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.65.0-3",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:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.65.0-3",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:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.65.0-3",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:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.65.0-3",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:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
1632
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.65.0-5",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:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.65.0-5",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:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.65.0-5",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:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.65.0-5",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:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
1633
1633
 
1634
1634
  var defaultDiacriticsRemovalMap = [
1635
1635
  {
@@ -6520,9 +6520,10 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
6520
6520
  socket.on('connect', function () {
6521
6521
  resolve(socket);
6522
6522
  });
6523
+ // TODO: !!!! Better timeout handling
6523
6524
  setTimeout(function () {
6524
6525
  reject(new Error("Timeout while connecting to ".concat(_this.options.remoteUrl)));
6525
- }, 60000 /* <- TODO: Timeout to config */);
6526
+ }, 1000 /* <- TODO: Timeout to config */);
6526
6527
  });
6527
6528
  };
6528
6529
  /**
@@ -6602,9 +6603,10 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
6602
6603
  RemoteLlmExecutionTools.prototype.listModels = function () {
6603
6604
  return __awaiter(this, void 0, void 0, function () {
6604
6605
  return __generator(this, function (_a) {
6605
- return [2 /*return*/, [
6606
- /* !!! */
6607
- ]];
6606
+ return [2 /*return*/, (this.options.models ||
6607
+ [
6608
+ /* !!! */
6609
+ ])];
6608
6610
  });
6609
6611
  });
6610
6612
  };
@@ -6618,48 +6620,6 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
6618
6620
  * TODO: [🧠] Maybe remove `@promptbook/remote-client` and just use `@promptbook/core`
6619
6621
  */
6620
6622
 
6621
- /**
6622
- * Helper of usage compute
6623
- *
6624
- * @param content the content of prompt or response
6625
- * @returns part of PromptResultUsageCounts
6626
- *
6627
- * @private internal utility of LlmExecutionTools
6628
- */
6629
- function computeUsageCounts(content) {
6630
- return {
6631
- charactersCount: { value: countCharacters(content) },
6632
- wordsCount: { value: countWords(content) },
6633
- sentencesCount: { value: countSentences(content) },
6634
- linesCount: { value: countLines(content) },
6635
- paragraphsCount: { value: countParagraphs(content) },
6636
- pagesCount: { value: countPages(content) },
6637
- };
6638
- }
6639
-
6640
- /**
6641
- * Make UncertainNumber
6642
- *
6643
- * @param value
6644
- *
6645
- * @private utility for initializating UncertainNumber
6646
- */
6647
- function uncertainNumber(value) {
6648
- if (value === null || value === undefined || Number.isNaN(value)) {
6649
- return { value: 0, isUncertain: true };
6650
- }
6651
- return { value: value };
6652
- }
6653
-
6654
- /**
6655
- * Get current date in ISO 8601 format
6656
- *
6657
- * @private internal utility
6658
- */
6659
- function getCurrentIsoDate() {
6660
- return new Date().toISOString();
6661
- }
6662
-
6663
6623
  /**
6664
6624
  * Function computeUsage will create price per one token based on the string value found on openai page
6665
6625
  *
@@ -6743,6 +6703,48 @@ var ANTHROPIC_CLAUDE_MODELS = [
6743
6703
  * TODO: [🕚] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
6744
6704
  */
6745
6705
 
6706
+ /**
6707
+ * Helper of usage compute
6708
+ *
6709
+ * @param content the content of prompt or response
6710
+ * @returns part of PromptResultUsageCounts
6711
+ *
6712
+ * @private internal utility of LlmExecutionTools
6713
+ */
6714
+ function computeUsageCounts(content) {
6715
+ return {
6716
+ charactersCount: { value: countCharacters(content) },
6717
+ wordsCount: { value: countWords(content) },
6718
+ sentencesCount: { value: countSentences(content) },
6719
+ linesCount: { value: countLines(content) },
6720
+ paragraphsCount: { value: countParagraphs(content) },
6721
+ pagesCount: { value: countPages(content) },
6722
+ };
6723
+ }
6724
+
6725
+ /**
6726
+ * Make UncertainNumber
6727
+ *
6728
+ * @param value
6729
+ *
6730
+ * @private utility for initializating UncertainNumber
6731
+ */
6732
+ function uncertainNumber(value) {
6733
+ if (value === null || value === undefined || Number.isNaN(value)) {
6734
+ return { value: 0, isUncertain: true };
6735
+ }
6736
+ return { value: value };
6737
+ }
6738
+
6739
+ /**
6740
+ * Get current date in ISO 8601 format
6741
+ *
6742
+ * @private internal utility
6743
+ */
6744
+ function getCurrentIsoDate() {
6745
+ return new Date().toISOString();
6746
+ }
6747
+
6746
6748
  /**
6747
6749
  * Execution Tools for calling Anthropic Claude API.
6748
6750
  *
@@ -6983,7 +6985,7 @@ function createAnthropicClaudeExecutionTools(options) {
6983
6985
  className: 'AnthropicClaudeExecutionTools',
6984
6986
  options: __assign(__assign({}, options), { isProxied: false }),
6985
6987
  },
6986
- ] }));
6988
+ ], models: ANTHROPIC_CLAUDE_MODELS }));
6987
6989
  }
6988
6990
  return new AnthropicClaudeExecutionTools(options);
6989
6991
  }
@@ -7950,8 +7952,8 @@ var LLM_CONFIGURATION_BOILERPLATES = [
7950
7952
  options: {
7951
7953
  apiKey: 'sk-ant-api03-',
7952
7954
  isProxied: true,
7953
- remoteUrl: 'https://!!!!!!',
7954
- path: '/socket.io!!!!!!',
7955
+ remoteUrl: "https://api.pavolhejny.com/",
7956
+ path: '/promptbook/socket.io',
7955
7957
  },
7956
7958
  },
7957
7959
  {