@promptbook/cli 0.59.0-34 → 0.59.0-36

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.
@@ -2,5 +2,5 @@ import type { MaterialKnowledgePieceJson } from './MaterialKnowledgePieceJson';
2
2
  export type KnowledgeJson = Array<MaterialKnowledgePieceJson>;
3
3
  /**
4
4
  * !!!! Annotate
5
- * TODO: [🦪]
5
+ * TODO: [🦪] Internal links between (Material)KnowledgePieces withing the KnowledgeJson
6
6
  */
@@ -22,7 +22,7 @@ export type MaterialKnowledgePieceJson = {
22
22
  /**
23
23
  * TODO: !!! Use or uninstall xyzt
24
24
  * !!!! Annotate
25
- * TODO: [🧠][🦪] Maybe allow internal linkes between (Material)KnowledgePieces withing the KnowledgeJson and maybe require to explicitelly reference the source of the knowledge
25
+ * TODO: [🧠][🦪] Maybe allow internal links between (Material)KnowledgePieces withing the KnowledgeJson and maybe require to explicitelly reference the source of the knowledge
26
26
  * TODO: [🧠] Make some non-material sources like external search engine or dialog to user
27
27
  * TODO: [🧠] Make some non-material (and maybe non-knowledge-like but tool-like) sources like calculator, code interpreter
28
28
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/cli",
3
- "version": "0.59.0-34",
3
+ "version": "0.59.0-36",
4
4
  "description": "Library to supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -52,7 +52,7 @@
52
52
  }
53
53
  ],
54
54
  "peerDependencies": {
55
- "@promptbook/core": "0.59.0-34"
55
+ "@promptbook/core": "0.59.0-36"
56
56
  },
57
57
  "main": "./umd/index.umd.js",
58
58
  "module": "./esm/index.es.js",
package/umd/index.umd.js CHANGED
@@ -147,7 +147,7 @@
147
147
  /**
148
148
  * The version of the Promptbook library
149
149
  */
150
- var PROMPTBOOK_VERSION = '0.59.0-33';
150
+ var PROMPTBOOK_VERSION = '0.59.0-35';
151
151
 
152
152
  /**
153
153
  * Initializes testing `hello` command for Promptbook CLI utilities
@@ -441,7 +441,7 @@
441
441
  * > ex port function validatePromptbook(promptbook: unknown): asserts promptbook is PromptbookJson {
442
442
  */
443
443
 
444
- var promptbookLibrary = [{title:"Prepare Keywords",promptbookUrl:"https://promptbook.studio/promptbook/prepare-keywords.ptbk.md",promptbookVersion:"0.59.0-33",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],executionType:"PROMPT_TEMPLATE",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}",resultingParameterName:"keywords"}],knowledge:[]},{title:"Prepare Knowledge from Markdown",promptbookUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.59.0-33",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],executionType:"PROMPT_TEMPLATE",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}",resultingParameterName:"knowledge"}],knowledge:[]}];
444
+ var promptbookLibrary = [{title:"Prepare Keywords",promptbookUrl:"https://promptbook.studio/promptbook/prepare-keywords.ptbk.md",promptbookVersion:"0.59.0-35",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],executionType:"PROMPT_TEMPLATE",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}",resultingParameterName:"keywords"}],knowledge:[]},{title:"Prepare Knowledge from Markdown",promptbookUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.59.0-35",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],executionType:"PROMPT_TEMPLATE",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}",resultingParameterName:"knowledge"}],knowledge:[]}];
445
445
 
446
446
  /**
447
447
  * This error indicates errors during the execution of the promptbook
@@ -3602,7 +3602,7 @@
3602
3602
  helloCommand.option('--no-validation', "Do not validate logic of promptbooks in library", true);
3603
3603
  helloCommand.option('--validation', "Types of validations separated by comma (options \"logic\",\"imports\")", 'logic,imports');
3604
3604
  helloCommand.option('--verbose', "Is verbose", false);
3605
- helloCommand.option('-o, --out-file', spaceTrim__default["default"]("\n Where to save the builded library\n\n Note: If you keep it \"".concat(PROMPTBOOK_MAKED_BASE_FILENAME, "\" it will be saved in the root of the promptbook directory\n If you set it to a path, it will be saved in that path\n BUT you can use only one format and set correct extension\n ")), PROMPTBOOK_MAKED_BASE_FILENAME);
3605
+ helloCommand.option('-o, --out-file <path>', spaceTrim__default["default"]("\n Where to save the builded library\n\n Note: If you keep it \"".concat(PROMPTBOOK_MAKED_BASE_FILENAME, "\" it will be saved in the root of the promptbook directory\n If you set it to a path, it will be saved in that path\n BUT you can use only one format and set correct extension\n ")), PROMPTBOOK_MAKED_BASE_FILENAME);
3606
3606
  // TODO: !!! Auto-detect AI api keys + explicit api keys as argv
3607
3607
  helloCommand.action(function (path$1, _a) {
3608
3608
  var projectName = _a.projectName, format = _a.format, validation = _a.validation, verbose = _a.verbose, outFile = _a.outFile;
@@ -3623,7 +3623,8 @@
3623
3623
  .map(function (_) { return _.trim(); })
3624
3624
  .filter(function (_) { return _ !== ''; });
3625
3625
  if (outFile !== PROMPTBOOK_MAKED_BASE_FILENAME && formats.length !== 1) {
3626
- throw new Error("You can use only one format when saving to a file");
3626
+ console.error(colors__default["default"].red("You can use only one format when saving to a file"));
3627
+ process.exit(1);
3627
3628
  }
3628
3629
  return [4 /*yield*/, createLibraryFromDirectory(path$1, {
3629
3630
  isVerbose: verbose,
@@ -3703,8 +3704,11 @@
3703
3704
  if (!outFile.endsWith(".".concat(extension))) {
3704
3705
  console.warn(colors__default["default"].yellow("Warning: Extension of output file should be \"".concat(extension, "\"")));
3705
3706
  }
3706
- return [4 /*yield*/, promises.writeFile(filePath, content, 'utf-8')];
3707
+ return [4 /*yield*/, promises.mkdir(path.dirname(filePath), { recursive: true })];
3707
3708
  case 1:
3709
+ _a.sent();
3710
+ return [4 /*yield*/, promises.writeFile(filePath, content, 'utf-8')];
3711
+ case 2:
3708
3712
  _a.sent();
3709
3713
  // Note: Log despite of verbose mode
3710
3714
  console.info(colors__default["default"].green("Maked ".concat(filePath.split('\\').join('/'))));
@@ -3883,7 +3887,7 @@
3883
3887
  case 0:
3884
3888
  isGraphAdded = options.isGraphAdded, isPrettifyed = options.isPrettifyed;
3885
3889
  if (!isGraphAdded) return [3 /*break*/, 2];
3886
- return [4 /*yield*/, promptbookStringToJson(promptbookString /* , {!!!!} */)];
3890
+ return [4 /*yield*/, promptbookStringToJson(promptbookString)];
3887
3891
  case 1:
3888
3892
  promptbookJson = _a.sent();
3889
3893
  promptbookMermaid_1 = renderPromptbookMermaid(promptbookJson, {