@promptbook/node 0.84.0-10 → 0.84.0-11

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.
@@ -8,6 +8,7 @@ import { serializeError } from '../errors/utils/serializeError';
8
8
  import { forEachAsync } from '../execution/utils/forEachAsync';
9
9
  import { isValidJsonString } from '../formats/json/utils/isValidJsonString';
10
10
  import { prompt } from '../pipeline/prompt-notation';
11
+ import { promptTemplate } from '../pipeline/prompt-notation';
11
12
  import { $getCurrentDate } from '../utils/$getCurrentDate';
12
13
  import { $isRunningInBrowser } from '../utils/environment/$isRunningInBrowser';
13
14
  import { $isRunningInJest } from '../utils/environment/$isRunningInJest';
@@ -89,6 +90,7 @@ export { serializeError };
89
90
  export { forEachAsync };
90
91
  export { isValidJsonString };
91
92
  export { prompt };
93
+ export { promptTemplate };
92
94
  export { $getCurrentDate };
93
95
  export { $isRunningInBrowser };
94
96
  export { $isRunningInJest };
@@ -2,11 +2,13 @@ import type { PipelineExecutorResult } from './PipelineExecutorResult';
2
2
  /**
3
3
  * Asserts that the execution of a Promptbook is successful
4
4
  *
5
+ * Note: If there are only warnings, the execution is still successful but the warnings are logged in the console
6
+ *
5
7
  * @param executionResult - The partial result of the Promptbook execution
6
8
  * @throws {PipelineExecutionError} If the execution is not successful or if multiple errors occurred
7
9
  * @public exported from `@promptbook/core`
8
10
  */
9
- export declare function assertsExecutionSuccessful(executionResult: Pick<PipelineExecutorResult, 'isSuccessful' | 'errors'>): void;
11
+ export declare function assertsExecutionSuccessful(executionResult: Pick<PipelineExecutorResult, 'isSuccessful' | 'errors' | 'warnings'>): void;
10
12
  /**
11
13
  * TODO: [🐚] This function should be removed OR changed OR be completely rewritten
12
14
  * TODO: [🧠] Can this return type be better typed than void
@@ -2,9 +2,10 @@ import type { PipelineString } from './PipelineString';
2
2
  /**
3
3
  * Tag function for notating a pipeline with a book\`...\ notation as template literal
4
4
  *
5
- * Note: There are 2 similar functions:
5
+ * Note: There are 3 similar functions:
6
6
  * 1) `prompt` for notating single prompt exported from `@promptbook/utils`
7
- * 1) `book` for notating and validating entire books exported from `@promptbook/utils`
7
+ * 2) `promptTemplate` alias for `prompt`
8
+ * 3) `book` for notating and validating entire books exported from `@promptbook/utils`
8
9
  *
9
10
  * @param strings @@@
10
11
  * @param values @@@
@@ -2,16 +2,29 @@ import type { string_prompt } from '../types/typeAliases';
2
2
  /**
3
3
  * Tag function for notating a prompt as template literal
4
4
  *
5
- * Note: There are 2 similar functions:
5
+ * Note: There are 3 similar functions:
6
6
  * 1) `prompt` for notating single prompt exported from `@promptbook/utils`
7
- * 1) `book` for notating and validating entire books exported from `@promptbook/utils`
7
+ * 2) `promptTemplate` alias for `prompt`
8
+ * 3) `book` for notating and validating entire books exported from `@promptbook/utils`
8
9
  *
9
- * @param strings @@@
10
- * @param values @@@
11
- * @returns the pipeline string
10
+ * @param strings
11
+ * @param values
12
+ * @returns the prompt string
12
13
  * @public exported from `@promptbook/utils`
13
14
  */
14
15
  export declare function prompt(strings: TemplateStringsArray, ...values: Array<string>): string_prompt;
16
+ /**
17
+ * Tag function for notating a prompt as template literal
18
+ *
19
+ * Note: There are 3 similar functions:
20
+ * 1) `prompt` for notating single prompt exported from `@promptbook/utils`
21
+ * 2) `promptTemplate` alias for `prompt`
22
+ * 3) `book` for notating and validating entire books exported from `@promptbook/utils`
23
+ *
24
+ * @alias prompt
25
+ * @public exported from `@promptbook/utils`
26
+ */
27
+ export declare const promptTemplate: typeof prompt;
15
28
  /**
16
29
  * TODO: [🧠][🈴] Where is the best location for this file
17
30
  * Note: [💞] Ignore a discrepancy between file name and entity name
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/node",
3
- "version": "0.84.0-10",
3
+ "version": "0.84.0-11",
4
4
  "description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
5
5
  "--note-0": " <- [🐊]",
6
6
  "private": false,
@@ -54,7 +54,7 @@
54
54
  "module": "./esm/index.es.js",
55
55
  "typings": "./esm/typings/src/_packages/node.index.d.ts",
56
56
  "peerDependencies": {
57
- "@promptbook/core": "0.84.0-10"
57
+ "@promptbook/core": "0.84.0-11"
58
58
  },
59
59
  "dependencies": {
60
60
  "colors": "1.4.0",
package/umd/index.umd.js CHANGED
@@ -45,7 +45,7 @@
45
45
  * @generated
46
46
  * @see https://github.com/webgptorg/promptbook
47
47
  */
48
- var PROMPTBOOK_ENGINE_VERSION = '0.84.0-9';
48
+ var PROMPTBOOK_ENGINE_VERSION = '0.84.0-10';
49
49
  /**
50
50
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
51
51
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -335,22 +335,94 @@
335
335
  var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",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}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou 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}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",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}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou 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}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book.md`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",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}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\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- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `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### Key `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}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book.md`\n- INPUT PARAMETER `{availableModelNames}` List of available model names separated by comma (,)\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\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- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `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### Key `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}\n```\n\n`-> {modelRequirements}`\n"}],sourceFile:"./books/prepare-persona.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book.md",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book.md`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book.md"}];
336
336
 
337
337
  /**
338
- * Function isValidJsonString will tell you if the string is valid JSON or not
338
+ * Checks if value is valid email
339
339
  *
340
340
  * @public exported from `@promptbook/utils`
341
341
  */
342
- function isValidJsonString(value /* <- [👨‍⚖️] */) {
343
- try {
344
- JSON.parse(value);
342
+ function isValidEmail(email) {
343
+ if (typeof email !== 'string') {
344
+ return false;
345
+ }
346
+ if (email.split('\n').length > 1) {
347
+ return false;
348
+ }
349
+ return /^.+@.+\..+$/.test(email);
350
+ }
351
+
352
+ /**
353
+ * Tests if given string is valid URL.
354
+ *
355
+ * Note: This does not check if the file exists only if the path is valid
356
+ * @public exported from `@promptbook/utils`
357
+ */
358
+ function isValidFilePath(filename) {
359
+ if (typeof filename !== 'string') {
360
+ return false;
361
+ }
362
+ if (filename.split('\n').length > 1) {
363
+ return false;
364
+ }
365
+ if (filename.split(' ').length >
366
+ 5 /* <- TODO: [🧠][🈷] Make some better non-arbitrary way how to distinct filenames from informational texts */) {
367
+ return false;
368
+ }
369
+ var filenameSlashes = filename.split('\\').join('/');
370
+ // Absolute Unix path: /hello.txt
371
+ if (/^(\/)/i.test(filenameSlashes)) {
372
+ // console.log(filename, 'Absolute Unix path: /hello.txt');
345
373
  return true;
346
374
  }
347
- catch (error) {
348
- if (!(error instanceof Error)) {
349
- throw error;
375
+ // Absolute Windows path: /hello.txt
376
+ if (/^([A-Z]{1,2}:\/?)\//i.test(filenameSlashes)) {
377
+ // console.log(filename, 'Absolute Windows path: /hello.txt');
378
+ return true;
379
+ }
380
+ // Relative path: ./hello.txt
381
+ if (/^(\.\.?\/)+/i.test(filenameSlashes)) {
382
+ // console.log(filename, 'Relative path: ./hello.txt');
383
+ return true;
384
+ }
385
+ // Allow paths like foo/hello
386
+ if (/^[^/]+\/[^/]+/i.test(filenameSlashes)) {
387
+ // console.log(filename, 'Allow paths like foo/hello');
388
+ return true;
389
+ }
390
+ // Allow paths like hello.book
391
+ if (/^[^/]+\.[^/]+$/i.test(filenameSlashes)) {
392
+ // console.log(filename, 'Allow paths like hello.book');
393
+ return true;
394
+ }
395
+ return false;
396
+ }
397
+ /**
398
+ * TODO: [🍏] Implement for MacOs
399
+ */
400
+
401
+ /**
402
+ * Tests if given string is valid URL.
403
+ *
404
+ * Note: Dataurl are considered perfectly valid.
405
+ * Note: There are two simmilar functions:
406
+ * - `isValidUrl` which tests any URL
407
+ * - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
408
+ *
409
+ * @public exported from `@promptbook/utils`
410
+ */
411
+ function isValidUrl(url) {
412
+ if (typeof url !== 'string') {
413
+ return false;
414
+ }
415
+ try {
416
+ if (url.startsWith('blob:')) {
417
+ url = url.replace(/^blob:/, '');
350
418
  }
351
- if (error.message.includes('Unexpected token')) {
419
+ var urlObject = new URL(url /* because fail is handled */);
420
+ if (!['http:', 'https:', 'data:'].includes(urlObject.protocol)) {
352
421
  return false;
353
422
  }
423
+ return true;
424
+ }
425
+ catch (error) {
354
426
  return false;
355
427
  }
356
428
  }
@@ -374,6 +446,27 @@
374
446
  * TODO: Maybe split `ParseError` and `ApplyError`
375
447
  */
376
448
 
449
+ /**
450
+ * Function isValidJsonString will tell you if the string is valid JSON or not
451
+ *
452
+ * @public exported from `@promptbook/utils`
453
+ */
454
+ function isValidJsonString(value /* <- [👨‍⚖️] */) {
455
+ try {
456
+ JSON.parse(value);
457
+ return true;
458
+ }
459
+ catch (error) {
460
+ if (!(error instanceof Error)) {
461
+ throw error;
462
+ }
463
+ if (error.message.includes('Unexpected token')) {
464
+ return false;
465
+ }
466
+ return false;
467
+ }
468
+ }
469
+
377
470
  /**
378
471
  * Function `validatePipelineString` will validate the if the string is a valid pipeline string
379
472
  * It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
@@ -387,6 +480,15 @@
387
480
  if (isValidJsonString(pipelineString)) {
388
481
  throw new ParseError('Expected a book, but got a JSON string');
389
482
  }
483
+ else if (isValidUrl(pipelineString)) {
484
+ throw new ParseError("Expected a book, but got just the URL \"".concat(pipelineString, "\""));
485
+ }
486
+ else if (isValidFilePath(pipelineString)) {
487
+ throw new ParseError("Expected a book, but got just the file path \"".concat(pipelineString, "\""));
488
+ }
489
+ else if (isValidEmail(pipelineString)) {
490
+ throw new ParseError("Expected a book, but got just the email \"".concat(pipelineString, "\""));
491
+ }
390
492
  // <- TODO: Implement the validation + add tests when the pipeline logic considered as invalid
391
493
  return pipelineString;
392
494
  }
@@ -1080,35 +1182,6 @@
1080
1182
  return isHostnameOnPrivateNetwork(url.hostname);
1081
1183
  }
1082
1184
 
1083
- /**
1084
- * Tests if given string is valid URL.
1085
- *
1086
- * Note: Dataurl are considered perfectly valid.
1087
- * Note: There are two simmilar functions:
1088
- * - `isValidUrl` which tests any URL
1089
- * - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
1090
- *
1091
- * @public exported from `@promptbook/utils`
1092
- */
1093
- function isValidUrl(url) {
1094
- if (typeof url !== 'string') {
1095
- return false;
1096
- }
1097
- try {
1098
- if (url.startsWith('blob:')) {
1099
- url = url.replace(/^blob:/, '');
1100
- }
1101
- var urlObject = new URL(url /* because fail is handled */);
1102
- if (!['http:', 'https:', 'data:'].includes(urlObject.protocol)) {
1103
- return false;
1104
- }
1105
- return true;
1106
- }
1107
- catch (error) {
1108
- return false;
1109
- }
1110
- }
1111
-
1112
1185
  /**
1113
1186
  * Tests if given string is valid pipeline URL URL.
1114
1187
  *
@@ -1863,12 +1936,28 @@
1863
1936
  /**
1864
1937
  * Asserts that the execution of a Promptbook is successful
1865
1938
  *
1939
+ * Note: If there are only warnings, the execution is still successful but the warnings are logged in the console
1940
+ *
1866
1941
  * @param executionResult - The partial result of the Promptbook execution
1867
1942
  * @throws {PipelineExecutionError} If the execution is not successful or if multiple errors occurred
1868
1943
  * @public exported from `@promptbook/core`
1869
1944
  */
1870
1945
  function assertsExecutionSuccessful(executionResult) {
1871
- var isSuccessful = executionResult.isSuccessful, errors = executionResult.errors;
1946
+ var e_1, _a;
1947
+ var isSuccessful = executionResult.isSuccessful, errors = executionResult.errors, warnings = executionResult.warnings;
1948
+ try {
1949
+ for (var warnings_1 = __values(warnings), warnings_1_1 = warnings_1.next(); !warnings_1_1.done; warnings_1_1 = warnings_1.next()) {
1950
+ var warning = warnings_1_1.value;
1951
+ console.warn(warning.message);
1952
+ }
1953
+ }
1954
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1955
+ finally {
1956
+ try {
1957
+ if (warnings_1_1 && !warnings_1_1.done && (_a = warnings_1.return)) _a.call(warnings_1);
1958
+ }
1959
+ finally { if (e_1) throw e_1.error; }
1960
+ }
1872
1961
  if (isSuccessful === true) {
1873
1962
  return;
1874
1963
  }
@@ -5380,55 +5469,6 @@
5380
5469
  * TODO: [🖇] What about symlinks?
5381
5470
  */
5382
5471
 
5383
- /**
5384
- * Tests if given string is valid URL.
5385
- *
5386
- * Note: This does not check if the file exists only if the path is valid
5387
- * @public exported from `@promptbook/utils`
5388
- */
5389
- function isValidFilePath(filename) {
5390
- if (typeof filename !== 'string') {
5391
- return false;
5392
- }
5393
- if (filename.split('\n').length > 1) {
5394
- return false;
5395
- }
5396
- if (filename.split(' ').length >
5397
- 5 /* <- TODO: [🧠][🈷] Make some better non-arbitrary way how to distinct filenames from informational texts */) {
5398
- return false;
5399
- }
5400
- var filenameSlashes = filename.split('\\').join('/');
5401
- // Absolute Unix path: /hello.txt
5402
- if (/^(\/)/i.test(filenameSlashes)) {
5403
- // console.log(filename, 'Absolute Unix path: /hello.txt');
5404
- return true;
5405
- }
5406
- // Absolute Windows path: /hello.txt
5407
- if (/^([A-Z]{1,2}:\/?)\//i.test(filenameSlashes)) {
5408
- // console.log(filename, 'Absolute Windows path: /hello.txt');
5409
- return true;
5410
- }
5411
- // Relative path: ./hello.txt
5412
- if (/^(\.\.?\/)+/i.test(filenameSlashes)) {
5413
- // console.log(filename, 'Relative path: ./hello.txt');
5414
- return true;
5415
- }
5416
- // Allow paths like foo/hello
5417
- if (/^[^/]+\/[^/]+/i.test(filenameSlashes)) {
5418
- // console.log(filename, 'Allow paths like foo/hello');
5419
- return true;
5420
- }
5421
- // Allow paths like hello.book
5422
- if (/^[^/]+\.[^/]+$/i.test(filenameSlashes)) {
5423
- // console.log(filename, 'Allow paths like hello.book');
5424
- return true;
5425
- }
5426
- return false;
5427
- }
5428
- /**
5429
- * TODO: [🍏] Implement for MacOs
5430
- */
5431
-
5432
5472
  /**
5433
5473
  * The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
5434
5474
  *