@promptbook/website-crawler 0.74.0-11 → 0.74.0-13
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/README.md +1 -10
- package/esm/index.es.js +21 -19
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/cli/promptbookCli.d.ts +1 -1
- package/esm/typings/src/collection/collectionToJson.test.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -1
- package/esm/typings/src/commands/BOOK_VERSION/BookVersionCommand.d.ts +1 -1
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +3 -3
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +2 -2
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +2 -2
- package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
- package/esm/typings/src/conversion/validation/_importPipeline.d.ts +7 -7
- package/esm/typings/src/formats/_common/FormatDefinition.d.ts +1 -1
- package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +6 -4
- package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -1
- package/esm/typings/src/types/Prompt.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +2 -2
- package/package.json +2 -2
- package/umd/index.umd.js +21 -19
- package/umd/index.umd.js.map +1 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare function promptbookCli(): Promise<void>;
|
|
7
7
|
/**
|
|
8
|
-
* TODO: [🧠] Maybe `run` command the default, instead of `ptbk run ./foo.
|
|
8
|
+
* TODO: [🧠] Maybe `run` command the default, instead of `ptbk run ./foo.book.md` -> `ptbk ./foo.book.md`
|
|
9
9
|
* TODO: [🥠] Do not export, its just for CLI script
|
|
10
10
|
* TODO: [🕌] When more functionalities, rename
|
|
11
11
|
* Note: 11:11
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export {};
|
|
2
2
|
/**
|
|
3
|
-
* Note: [🐠] For example here URL https://example.com/pipeline.
|
|
3
|
+
* Note: [🐠] For example here URL https://example.com/pipeline.book.md is not valid
|
|
4
4
|
* because it is on private network BUT its very hard to debug because
|
|
5
5
|
* there is no error message and false return (the error) happen deep in:
|
|
6
6
|
* `isValidPipelineUrl` -> `isValidPipelineUrl` -> `isUrlOnPrivateNetwork`
|
|
@@ -5,7 +5,7 @@ import type { PipelineCollection } from '../PipelineCollection';
|
|
|
5
5
|
/**
|
|
6
6
|
* Options for `createCollectionFromDirectory` function
|
|
7
7
|
*
|
|
8
|
-
* Note: `rootDirname` is not needed because it is the folder in which `.
|
|
8
|
+
* Note: `rootDirname` is not needed because it is the folder in which `.book.md` file is located
|
|
9
9
|
* This is not same as `path` which is the first argument of `createCollectionFromDirectory` - it can be a subfolder
|
|
10
10
|
*/
|
|
11
11
|
type CreatePipelineCollectionFromDirectoryOptions = Omit<PrepareAndScrapeOptions, 'rootDirname'> & {
|
|
@@ -3,12 +3,12 @@ import type { ForeachCommand } from './ForeachCommand';
|
|
|
3
3
|
/**
|
|
4
4
|
* Parses the foreach command
|
|
5
5
|
*
|
|
6
|
-
* Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.
|
|
6
|
+
* Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.book.md` file
|
|
7
7
|
*
|
|
8
8
|
* @see `documentationUrl` for more details
|
|
9
9
|
* @private within the commands folder
|
|
10
10
|
*/
|
|
11
11
|
export declare const foreachCommandParser: PipelineTemplateCommandParser<ForeachCommand>;
|
|
12
12
|
/**
|
|
13
|
-
* TODO: [🍭] Make .
|
|
13
|
+
* TODO: [🍭] Make .book.md file with examples of the FOREACH with wrong parsing and logic
|
|
14
14
|
*/
|
|
@@ -3,7 +3,7 @@ import type { BoilerplateCommand } from './BoilerplateCommand';
|
|
|
3
3
|
/**
|
|
4
4
|
* Parses the boilerplate command
|
|
5
5
|
*
|
|
6
|
-
* Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.
|
|
6
|
+
* Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.book.md` file
|
|
7
7
|
*
|
|
8
8
|
* @see `documentationUrl` for more details
|
|
9
9
|
* @private within the commands folder
|
|
@@ -3,8 +3,8 @@ import type { PipelineString } from '../types/PipelineString';
|
|
|
3
3
|
/**
|
|
4
4
|
* Converts promptbook in JSON format to string format
|
|
5
5
|
*
|
|
6
|
-
* @param pipelineJson Promptbook in JSON format (.
|
|
7
|
-
* @returns Promptbook in string format (.
|
|
6
|
+
* @param pipelineJson Promptbook in JSON format (.book.json)
|
|
7
|
+
* @returns Promptbook in string format (.book.md)
|
|
8
8
|
* @public exported from `@promptbook/core`
|
|
9
9
|
*/
|
|
10
10
|
export declare function pipelineJsonToString(pipelineJson: PipelineJson): PipelineString;
|
|
@@ -13,5 +13,5 @@ export declare function pipelineJsonToString(pipelineJson: PipelineJson): Pipeli
|
|
|
13
13
|
* TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
|
|
14
14
|
* TODO: [🏛] Maybe make some markdown builder
|
|
15
15
|
* TODO: [🏛] Escape all
|
|
16
|
-
* TODO: [🧠] Should be in generated .
|
|
16
|
+
* TODO: [🧠] Should be in generated .book.md file GENERATOR_WARNING
|
|
17
17
|
*/
|
|
@@ -13,10 +13,10 @@ import type { PipelineString } from '../types/PipelineString';
|
|
|
13
13
|
* Note: This function does not validate logic of the pipeline only the parsing
|
|
14
14
|
* Note: This function acts as compilation process
|
|
15
15
|
*
|
|
16
|
-
* @param pipelineString {Promptbook} in string markdown format (.
|
|
16
|
+
* @param pipelineString {Promptbook} in string markdown format (.book.md)
|
|
17
17
|
* @param tools - Tools for the preparation and scraping - if not provided together with `llm`, the preparation will be skipped
|
|
18
18
|
* @param options - Options and tools for the compilation
|
|
19
|
-
* @returns {Promptbook} compiled in JSON format (.
|
|
19
|
+
* @returns {Promptbook} compiled in JSON format (.book.json)
|
|
20
20
|
* @throws {ParseError} if the promptbook string is not valid
|
|
21
21
|
* @public exported from `@promptbook/core`
|
|
22
22
|
*/
|
|
@@ -11,8 +11,8 @@ import type { PipelineString } from '../types/PipelineString';
|
|
|
11
11
|
* Note: This function does not validate logic of the pipeline only the parsing
|
|
12
12
|
* Note: This function acts as compilation process
|
|
13
13
|
*
|
|
14
|
-
* @param pipelineString {Promptbook} in string markdown format (.
|
|
15
|
-
* @returns {Promptbook} compiled in JSON format (.
|
|
14
|
+
* @param pipelineString {Promptbook} in string markdown format (.book.md)
|
|
15
|
+
* @returns {Promptbook} compiled in JSON format (.book.json)
|
|
16
16
|
* @throws {ParseError} if the promptbook string is not valid
|
|
17
17
|
* @public exported from `@promptbook/core`
|
|
18
18
|
*/
|
|
@@ -9,7 +9,7 @@ import type { string_json } from '../../types/typeAliases';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function stringifyPipelineJson<TType>(pipeline: TType): string_json<TType>;
|
|
11
11
|
/**
|
|
12
|
-
* TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.
|
|
12
|
+
* TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.book.md
|
|
13
13
|
* TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
|
|
14
14
|
* TODO: [🧠] Maybe more elegant solution than replacing via regex
|
|
15
15
|
* TODO: [🍙] Make some standard order of json properties
|
|
@@ -2,7 +2,7 @@ import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
|
|
|
2
2
|
import type { PipelineString } from '../../types/PipelineString';
|
|
3
3
|
import type { string_json } from '../../types/typeAliases';
|
|
4
4
|
/**
|
|
5
|
-
* Import the pipeline.
|
|
5
|
+
* Import the pipeline.book.md or pipeline.book.json file
|
|
6
6
|
*
|
|
7
7
|
* Note: Using here custom import to work in jest tests
|
|
8
8
|
* Note: Using sync version is 💩 in the production code, but it's ok here in tests
|
|
@@ -10,20 +10,20 @@ import type { string_json } from '../../types/typeAliases';
|
|
|
10
10
|
* @param path - The path to the file relative to examples/pipelines directory
|
|
11
11
|
* @private internal function of tests
|
|
12
12
|
*/
|
|
13
|
-
export declare function importPipelineWithoutPreparation(path: `${string}.
|
|
14
|
-
export declare function importPipelineWithoutPreparation(path: `${string}.
|
|
13
|
+
export declare function importPipelineWithoutPreparation(path: `${string}.book.md`): PipelineString;
|
|
14
|
+
export declare function importPipelineWithoutPreparation(path: `${string}.book.json`): PipelineJson;
|
|
15
15
|
/**
|
|
16
|
-
* Import the pipeline.
|
|
16
|
+
* Import the pipeline.book.json file as parsed JSON
|
|
17
17
|
*
|
|
18
18
|
* @private internal function of tests
|
|
19
19
|
*/
|
|
20
|
-
export declare function importPipelineJson(path: `${string}.
|
|
20
|
+
export declare function importPipelineJson(path: `${string}.book.json`): PipelineJson;
|
|
21
21
|
/**
|
|
22
|
-
* Import the pipeline.
|
|
22
|
+
* Import the pipeline.book.json file as string
|
|
23
23
|
*
|
|
24
24
|
* @private internal function of tests
|
|
25
25
|
*/
|
|
26
|
-
export declare function importPipelineJsonAsString(path: `${string}.
|
|
26
|
+
export declare function importPipelineJsonAsString(path: `${string}.book.json`): string_json<PipelineJson>;
|
|
27
27
|
/**
|
|
28
28
|
* Note: [⚫] Code in this file should never be published in any package
|
|
29
29
|
*/
|
|
@@ -13,7 +13,7 @@ import type { FormatSubvalueDefinition } from './FormatSubvalueDefinition';
|
|
|
13
13
|
*/
|
|
14
14
|
export type FormatDefinition<TValue extends TPartialValue, TPartialValue extends string, TSettings extends empty_object, TSchema extends empty_object> = {
|
|
15
15
|
/**
|
|
16
|
-
* The name of the format used in .
|
|
16
|
+
* The name of the format used in .book.md files
|
|
17
17
|
*
|
|
18
18
|
* @example "JSON"
|
|
19
19
|
*/
|
|
@@ -9,7 +9,7 @@ import type { empty_object } from '../../utils/organization/empty_object';
|
|
|
9
9
|
*/
|
|
10
10
|
export type FormatSubvalueDefinition<TValue extends string, TSettings extends empty_object> = {
|
|
11
11
|
/**
|
|
12
|
-
* The name of the format used in .
|
|
12
|
+
* The name of the format used in .book.md files
|
|
13
13
|
*
|
|
14
14
|
* @example "CELL"
|
|
15
15
|
*/
|
|
@@ -26,12 +26,12 @@ export type PipelineJson = {
|
|
|
26
26
|
* Note: It must be unique across all pipeline collections
|
|
27
27
|
* Note: It must use HTTPs URL
|
|
28
28
|
* Tip: You can do versioning in the URL
|
|
29
|
-
* For example: https://promptbook.studio/webgpt/write-website-content-cs.
|
|
29
|
+
* For example: https://promptbook.studio/webgpt/write-website-content-cs.book.md@1.0.0
|
|
30
30
|
* Warning: Do not hash part of the URL, hash part is used for identification of the template in the pipeline
|
|
31
31
|
*/
|
|
32
32
|
readonly pipelineUrl?: string_pipeline_url;
|
|
33
33
|
/**
|
|
34
|
-
* Internal helper for tracking the source `.
|
|
34
|
+
* Internal helper for tracking the source `.book.md` file of the pipeline
|
|
35
35
|
*/
|
|
36
36
|
readonly sourceFile?: string_filename;
|
|
37
37
|
/**
|
|
@@ -40,9 +40,11 @@ export type PipelineJson = {
|
|
|
40
40
|
*/
|
|
41
41
|
readonly title: string_markdown_text;
|
|
42
42
|
/**
|
|
43
|
-
* Version of the
|
|
43
|
+
* Version of the Book language
|
|
44
|
+
*
|
|
45
|
+
* @see https://github.com/webgptorg/book
|
|
44
46
|
*/
|
|
45
|
-
readonly
|
|
47
|
+
readonly bookVersion?: string_semantic_version;
|
|
46
48
|
/**
|
|
47
49
|
* Description of the promptbook
|
|
48
50
|
* It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
@@ -18,5 +18,5 @@ export type PreparationJson = {
|
|
|
18
18
|
/**
|
|
19
19
|
* TODO: [🍙] Make some standard order of json properties
|
|
20
20
|
* TODO: Maybe put here used `modelName`
|
|
21
|
-
* TODO: [🍥] When using `date` it changes all examples .
|
|
21
|
+
* TODO: [🍥] When using `date` it changes all examples .book.json files each time so until some more elegant solution omit the time from prepared pipeline
|
|
22
22
|
*/
|
|
@@ -95,7 +95,7 @@ export type CommonPrompt = {
|
|
|
95
95
|
/**
|
|
96
96
|
* Unique identifier of the pipeline with specific template name as hash
|
|
97
97
|
*
|
|
98
|
-
* @example https://promptbook.studio/webgpt/write-website-content-cs.
|
|
98
|
+
* @example https://promptbook.studio/webgpt/write-website-content-cs.book.md#keywords
|
|
99
99
|
*/
|
|
100
100
|
readonly pipelineUrl?: string_pipeline_url_with_hashtemplate;
|
|
101
101
|
/**
|
|
@@ -298,13 +298,13 @@ export type string_base_url = string;
|
|
|
298
298
|
/**
|
|
299
299
|
* Semantic helper
|
|
300
300
|
*
|
|
301
|
-
* For example `"https://promptbook.studio/webgpt/write-website-content-cs.
|
|
301
|
+
* For example `"https://promptbook.studio/webgpt/write-website-content-cs.book.md"`
|
|
302
302
|
*/
|
|
303
303
|
export type string_pipeline_url = string;
|
|
304
304
|
/**
|
|
305
305
|
* Semantic helper
|
|
306
306
|
*
|
|
307
|
-
* For example `"https://promptbook.studio/webgpt/write-website-content-cs.
|
|
307
|
+
* For example `"https://promptbook.studio/webgpt/write-website-content-cs.book.md#keywords"`
|
|
308
308
|
*/
|
|
309
309
|
export type string_pipeline_url_with_hashtemplate = string;
|
|
310
310
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/website-crawler",
|
|
3
|
-
"version": "0.74.0-
|
|
3
|
+
"version": "0.74.0-13",
|
|
4
4
|
"description": "Supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"module": "./esm/index.es.js",
|
|
54
54
|
"typings": "./esm/typings/src/_packages/website-crawler.index.d.ts",
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@promptbook/core": "0.74.0-
|
|
56
|
+
"@promptbook/core": "0.74.0-13"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@mozilla/readability": "0.5.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*
|
|
23
23
|
* @see https://github.com/webgptorg/promptbook
|
|
24
24
|
*/
|
|
25
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.74.0-
|
|
25
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.74.0-12';
|
|
26
26
|
/**
|
|
27
27
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
28
28
|
*/
|
|
@@ -1182,7 +1182,7 @@
|
|
|
1182
1182
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
1183
1183
|
*/
|
|
1184
1184
|
|
|
1185
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.
|
|
1185
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",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- Title should be concise and clear\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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",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}],templates:[{templateType:"PROMPT_TEMPLATE",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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.book.md"}];
|
|
1186
1186
|
|
|
1187
1187
|
/**
|
|
1188
1188
|
* Prettify the html code
|
|
@@ -1230,13 +1230,13 @@
|
|
|
1230
1230
|
/**
|
|
1231
1231
|
* Converts promptbook in JSON format to string format
|
|
1232
1232
|
*
|
|
1233
|
-
* @param pipelineJson Promptbook in JSON format (.
|
|
1234
|
-
* @returns Promptbook in string format (.
|
|
1233
|
+
* @param pipelineJson Promptbook in JSON format (.book.json)
|
|
1234
|
+
* @returns Promptbook in string format (.book.md)
|
|
1235
1235
|
* @public exported from `@promptbook/core`
|
|
1236
1236
|
*/
|
|
1237
1237
|
function pipelineJsonToString(pipelineJson) {
|
|
1238
1238
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
|
|
1239
|
-
var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl,
|
|
1239
|
+
var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, templates = pipelineJson.templates;
|
|
1240
1240
|
var pipelineString = "# ".concat(title);
|
|
1241
1241
|
if (description) {
|
|
1242
1242
|
pipelineString += '\n\n';
|
|
@@ -1246,8 +1246,10 @@
|
|
|
1246
1246
|
if (pipelineUrl) {
|
|
1247
1247
|
commands.push("PIPELINE URL ".concat(pipelineUrl));
|
|
1248
1248
|
}
|
|
1249
|
-
|
|
1250
|
-
|
|
1249
|
+
if (bookVersion !== "undefined") {
|
|
1250
|
+
commands.push("BOOK VERSION ".concat(bookVersion));
|
|
1251
|
+
}
|
|
1252
|
+
// TODO: [main] !!!!!! This increase size of the bundle and is probbably not necessary
|
|
1251
1253
|
pipelineString = prettifyMarkdown(pipelineString);
|
|
1252
1254
|
try {
|
|
1253
1255
|
for (var _g = __values(parameters.filter(function (_a) {
|
|
@@ -1427,7 +1429,7 @@
|
|
|
1427
1429
|
* TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
|
|
1428
1430
|
* TODO: [🏛] Maybe make some markdown builder
|
|
1429
1431
|
* TODO: [🏛] Escape all
|
|
1430
|
-
* TODO: [🧠] Should be in generated .
|
|
1432
|
+
* TODO: [🧠] Should be in generated .book.md file GENERATOR_WARNING
|
|
1431
1433
|
*/
|
|
1432
1434
|
|
|
1433
1435
|
/**
|
|
@@ -1574,7 +1576,7 @@
|
|
|
1574
1576
|
if (!url.startsWith('https://')) {
|
|
1575
1577
|
return false;
|
|
1576
1578
|
}
|
|
1577
|
-
if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.
|
|
1579
|
+
if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.book.md') || url.endsWith('.ptbk'))) {
|
|
1578
1580
|
return false;
|
|
1579
1581
|
}
|
|
1580
1582
|
if (url.includes('#')) {
|
|
@@ -1643,9 +1645,9 @@
|
|
|
1643
1645
|
// <- Note: [🚲]
|
|
1644
1646
|
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1645
1647
|
}
|
|
1646
|
-
if (pipeline.
|
|
1648
|
+
if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
|
|
1647
1649
|
// <- Note: [🚲]
|
|
1648
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.
|
|
1650
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.bookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1649
1651
|
}
|
|
1650
1652
|
// TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
|
|
1651
1653
|
if (!Array.isArray(pipeline.parameters)) {
|
|
@@ -2876,7 +2878,7 @@
|
|
|
2876
2878
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
2877
2879
|
_b = createPipelineExecutor;
|
|
2878
2880
|
_c = {};
|
|
2879
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.
|
|
2881
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book.md')];
|
|
2880
2882
|
case 1:
|
|
2881
2883
|
preparePersonaExecutor = _b.apply(void 0, [(_c.pipeline = _d.sent(),
|
|
2882
2884
|
_c.tools = tools,
|
|
@@ -3381,12 +3383,12 @@
|
|
|
3381
3383
|
*/
|
|
3382
3384
|
function clonePipeline(pipeline) {
|
|
3383
3385
|
// Note: Not using spread operator (...) because @@@
|
|
3384
|
-
var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title,
|
|
3386
|
+
var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, bookVersion = pipeline.bookVersion, description = pipeline.description, parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
|
|
3385
3387
|
return {
|
|
3386
3388
|
pipelineUrl: pipelineUrl,
|
|
3387
3389
|
sourceFile: sourceFile,
|
|
3388
3390
|
title: title,
|
|
3389
|
-
|
|
3391
|
+
bookVersion: bookVersion,
|
|
3390
3392
|
description: description,
|
|
3391
3393
|
parameters: parameters,
|
|
3392
3394
|
templates: templates,
|
|
@@ -4634,7 +4636,7 @@
|
|
|
4634
4636
|
promptTitle: template.title,
|
|
4635
4637
|
promptMessage: replaceParameters(template.description || '', parameters),
|
|
4636
4638
|
defaultValue: replaceParameters(preparedContent, parameters),
|
|
4637
|
-
// TODO: [🧠] !! Figure out how to define placeholder in .
|
|
4639
|
+
// TODO: [🧠] !! Figure out how to define placeholder in .book.md file
|
|
4638
4640
|
placeholder: undefined,
|
|
4639
4641
|
priority: priority,
|
|
4640
4642
|
}))];
|
|
@@ -5200,7 +5202,7 @@
|
|
|
5200
5202
|
pipelineUrl: preparedPipeline.pipelineUrl,
|
|
5201
5203
|
title: preparedPipeline.title,
|
|
5202
5204
|
promptbookUsedVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
5203
|
-
promptbookRequestedVersion: preparedPipeline.
|
|
5205
|
+
promptbookRequestedVersion: preparedPipeline.bookVersion,
|
|
5204
5206
|
description: preparedPipeline.description,
|
|
5205
5207
|
promptExecutions: [],
|
|
5206
5208
|
};
|
|
@@ -5596,7 +5598,7 @@
|
|
|
5596
5598
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
5597
5599
|
_d = createPipelineExecutor;
|
|
5598
5600
|
_g = {};
|
|
5599
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.
|
|
5601
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md')];
|
|
5600
5602
|
case 1:
|
|
5601
5603
|
prepareKnowledgeFromMarkdownExecutor = _d.apply(void 0, [(_g.pipeline = _k.sent(),
|
|
5602
5604
|
_g.tools = {
|
|
@@ -5605,7 +5607,7 @@
|
|
|
5605
5607
|
_g)]);
|
|
5606
5608
|
_e = createPipelineExecutor;
|
|
5607
5609
|
_h = {};
|
|
5608
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-title.
|
|
5610
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-title.book.md')];
|
|
5609
5611
|
case 2:
|
|
5610
5612
|
prepareTitleExecutor = _e.apply(void 0, [(_h.pipeline = _k.sent(),
|
|
5611
5613
|
_h.tools = {
|
|
@@ -5614,7 +5616,7 @@
|
|
|
5614
5616
|
_h)]);
|
|
5615
5617
|
_f = createPipelineExecutor;
|
|
5616
5618
|
_j = {};
|
|
5617
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-keywords.
|
|
5619
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md')];
|
|
5618
5620
|
case 3:
|
|
5619
5621
|
prepareKeywordsExecutor = _f.apply(void 0, [(_j.pipeline = _k.sent(),
|
|
5620
5622
|
_j.tools = {
|