@promptbook/markdown-utils 0.94.0 → 0.98.0-2
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 +6 -2
- package/esm/index.es.js +41 -41
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +2 -2
- package/esm/typings/src/_packages/{wizzard.index.d.ts → wizard.index.d.ts} +2 -2
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/test-command.d.ts +1 -1
- package/esm/typings/src/conversion/archive/loadArchive.d.ts +1 -1
- package/esm/typings/src/conversion/archive/saveArchive.d.ts +2 -2
- package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +1 -1
- package/esm/typings/src/dialogs/callback/CallbackInterfaceTools.d.ts +1 -1
- package/esm/typings/src/execution/AbstractTaskResult.d.ts +2 -2
- package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +1 -1
- package/esm/typings/src/execution/execution-report/ExecutionPromptReportJson.d.ts +2 -2
- package/esm/typings/src/execution/translation/automatic-translate/translateMessages.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/{$provideLlmToolsForWizzardOrCli.d.ts → $provideLlmToolsForWizardOrCli.d.ts} +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +1 -1
- package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +1 -1
- package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -1
- package/esm/typings/src/llm-providers/deepseek/register-configuration.d.ts +1 -1
- package/esm/typings/src/llm-providers/deepseek/register-constructor.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/register-configuration.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/register-constructor.d.ts +1 -1
- package/esm/typings/src/llm-providers/ollama/register-configuration.d.ts +1 -1
- package/esm/typings/src/llm-providers/ollama/register-constructor.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +2 -2
- package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +1 -1
- package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/_boilerplate/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +1 -1
- package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/document/register-metadata.d.ts +2 -2
- package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +2 -2
- package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -4
- package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +2 -2
- package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/markitdown/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +2 -2
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +2 -2
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/website/register-metadata.d.ts +2 -2
- package/esm/typings/src/types/typeAliases.d.ts +1 -1
- package/esm/typings/src/utils/files/listAllFiles.d.ts +1 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/esm/typings/src/{wizzard → wizard}/$getCompiledBook.d.ts +2 -2
- package/esm/typings/src/{wizzard/wizzard.d.ts → wizard/wizard.d.ts} +6 -6
- package/package.json +1 -13
- package/umd/index.umd.js +41 -41
- package/umd/index.umd.js.map +1 -1
|
@@ -10,7 +10,7 @@ export declare const websiteScraperMetadata: import("type-fest/source/readonly-d
|
|
|
10
10
|
className: string;
|
|
11
11
|
mimeTypes: string[];
|
|
12
12
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
13
|
-
|
|
13
|
+
isAvailableInBrowser: false;
|
|
14
14
|
requiredExecutables: never[];
|
|
15
15
|
}>;
|
|
16
16
|
/**
|
|
@@ -19,7 +19,7 @@ export declare const websiteScraperMetadata: import("type-fest/source/readonly-d
|
|
|
19
19
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
20
20
|
*
|
|
21
21
|
* @public exported from `@promptbook/core`
|
|
22
|
-
* @public exported from `@promptbook/
|
|
22
|
+
* @public exported from `@promptbook/wizard`
|
|
23
23
|
* @public exported from `@promptbook/cli`
|
|
24
24
|
*/
|
|
25
25
|
export declare const _WebsiteScraperMetadataRegistration: Registration;
|
|
@@ -658,7 +658,7 @@ export type number_seed = number_percent;
|
|
|
658
658
|
* - ❤ is equivalent to more than 1
|
|
659
659
|
*/
|
|
660
660
|
export type number_likeness = number;
|
|
661
|
-
export type
|
|
661
|
+
export type number_milliseconds = number_integer;
|
|
662
662
|
export type number_seconds = number;
|
|
663
663
|
export type number_minutes = number;
|
|
664
664
|
export type number_hours = number;
|
|
@@ -11,7 +11,7 @@ import type { string_filename } from '../../types/typeAliases';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function listAllFiles(path: string_dirname, isRecursive: boolean, fs: FilesystemTools): Promise<Array<string_filename>>;
|
|
13
13
|
/**
|
|
14
|
-
* TODO: [😶] Unite
|
|
14
|
+
* TODO: [😶] Unite folder listing
|
|
15
15
|
* Note: Not [~🟢~] because it is not directly dependent on `fs
|
|
16
16
|
* TODO: [🖇] What about symlinks?
|
|
17
17
|
*/
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.
|
|
18
|
+
* It follows semantic versioning (e.g., `0.98.0-1`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
|
@@ -5,9 +5,9 @@ import type { PrepareAndScrapeOptions } from '../prepare/PrepareAndScrapeOptions
|
|
|
5
5
|
import type { string_filename } from '../types/typeAliases';
|
|
6
6
|
import type { string_pipeline_url } from '../types/typeAliases';
|
|
7
7
|
/**
|
|
8
|
-
* @see ./
|
|
8
|
+
* @see ./wizard.ts `getPipeline` method
|
|
9
9
|
*
|
|
10
|
-
* @private usable through `ptbk run` and `@
|
|
10
|
+
* @private usable through `ptbk run` and `@promptbook/wizard`
|
|
11
11
|
*/
|
|
12
12
|
export declare function $getCompiledBook(tools: Required<Pick<ExecutionTools, 'fs' | 'fetch'>>, pipelineSource: string_filename | string_pipeline_url | PipelineString, options?: PrepareAndScrapeOptions): Promise<PipelineJson>;
|
|
13
13
|
/**
|
|
@@ -7,14 +7,14 @@ import type { string_filename } from '../types/typeAliases';
|
|
|
7
7
|
import type { string_parameter_value } from '../types/typeAliases';
|
|
8
8
|
import type { string_pipeline_url } from '../types/typeAliases';
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
* Look at `
|
|
10
|
+
* Wizard for simple usage of the Promptbook
|
|
11
|
+
* Look at `wizard` for more details
|
|
12
12
|
*
|
|
13
13
|
* Note: This works only in Node.js environment and looks for the configuration, environment, tools and cache in the Node.js environment
|
|
14
14
|
*
|
|
15
15
|
* @private just for single instance
|
|
16
16
|
*/
|
|
17
|
-
declare class
|
|
17
|
+
declare class Wizard {
|
|
18
18
|
/**
|
|
19
19
|
* Run the book
|
|
20
20
|
*
|
|
@@ -53,14 +53,14 @@ declare class Wizzard {
|
|
|
53
53
|
getCompiledBook(pipelineSource: string_filename | string_pipeline_url | PipelineString): Promise<PipelineJson>;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
56
|
+
* Wizard for simple usage of the Promptbook
|
|
57
57
|
*
|
|
58
58
|
* Note: This works only in Node.js environment and looks for the configuration, environment, tools and cache in the Node.js environment
|
|
59
59
|
*
|
|
60
60
|
* @singleton
|
|
61
|
-
* @public exported from `@promptbook/
|
|
61
|
+
* @public exported from `@promptbook/wizard`
|
|
62
62
|
*/
|
|
63
|
-
export declare const
|
|
63
|
+
export declare const wizard: Wizard;
|
|
64
64
|
export {};
|
|
65
65
|
/**
|
|
66
66
|
* TODO: [🧠] Maybe some way how to handle the progress and streaming?
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/markdown-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.98.0-2",
|
|
4
4
|
"description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -70,18 +70,6 @@
|
|
|
70
70
|
"node": ">=16.0.0",
|
|
71
71
|
"npm": ">=8.0.0"
|
|
72
72
|
},
|
|
73
|
-
"cspell": {
|
|
74
|
-
"version": "0.2",
|
|
75
|
-
"language": "en",
|
|
76
|
-
"ignorePaths": [
|
|
77
|
-
"node_modules",
|
|
78
|
-
".next",
|
|
79
|
-
"coverage",
|
|
80
|
-
"dist",
|
|
81
|
-
".git"
|
|
82
|
-
],
|
|
83
|
-
"words": []
|
|
84
|
-
},
|
|
85
73
|
"main": "./umd/index.umd.js",
|
|
86
74
|
"module": "./esm/index.es.js",
|
|
87
75
|
"typings": "./esm/typings/src/_packages/markdown-utils.index.d.ts",
|
package/umd/index.umd.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* @generated
|
|
26
26
|
* @see https://github.com/webgptorg/promptbook
|
|
27
27
|
*/
|
|
28
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
28
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.98.0-2';
|
|
29
29
|
/**
|
|
30
30
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
31
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -552,7 +552,7 @@
|
|
|
552
552
|
function keepUnused(...valuesToKeep) {
|
|
553
553
|
}
|
|
554
554
|
|
|
555
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",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`\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"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",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`\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"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",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`\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"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with 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\nHere are the available models:\n\n```json\n{availableModels}\n```\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:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with 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\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\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`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",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`\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"}];
|
|
555
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",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`\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"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",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`\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"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",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`\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"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with 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\nHere are the available models:\n\n```json\n{availableModels}\n```\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:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with 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\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\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`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",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`\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"}];
|
|
556
556
|
|
|
557
557
|
/**
|
|
558
558
|
* Checks if value is valid email
|
|
@@ -701,7 +701,7 @@
|
|
|
701
701
|
});
|
|
702
702
|
}
|
|
703
703
|
catch (error) {
|
|
704
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
704
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
705
705
|
console.error('There was an error with prettifying the markdown, using the original as the fallback', {
|
|
706
706
|
error,
|
|
707
707
|
html: content,
|
|
@@ -974,7 +974,7 @@
|
|
|
974
974
|
else {
|
|
975
975
|
for (const [subName, subValue] of Object.entries(value)) {
|
|
976
976
|
if (subValue === undefined) {
|
|
977
|
-
// Note: undefined in object is serializable - it is just
|
|
977
|
+
// Note: undefined in object is serializable - it is just omitted
|
|
978
978
|
continue;
|
|
979
979
|
}
|
|
980
980
|
checkSerializableAsJson({ name: `${name}.${subName}`, value: subValue, message });
|
|
@@ -1664,7 +1664,7 @@
|
|
|
1664
1664
|
|
|
1665
1665
|
Note: You have probably forgotten to run "ptbk make" to update the collection
|
|
1666
1666
|
Note: Pipelines with the same URL are not allowed
|
|
1667
|
-
Only
|
|
1667
|
+
Only exception is when the pipelines are identical
|
|
1668
1668
|
|
|
1669
1669
|
`));
|
|
1670
1670
|
}
|
|
@@ -2458,12 +2458,12 @@
|
|
|
2458
2458
|
get title() {
|
|
2459
2459
|
return `${llmTools.title} (+usage)`;
|
|
2460
2460
|
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2461
|
-
// <- TODO: [🧈][🧠] Does it make
|
|
2461
|
+
// <- TODO: [🧈][🧠] Does it make sense to suffix "(+usage)"?
|
|
2462
2462
|
},
|
|
2463
2463
|
get description() {
|
|
2464
2464
|
return `${llmTools.description} (+usage)`;
|
|
2465
2465
|
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2466
|
-
// <- TODO: [🧈][🧠] Does it make
|
|
2466
|
+
// <- TODO: [🧈][🧠] Does it make sense to suffix "(+usage)"?
|
|
2467
2467
|
},
|
|
2468
2468
|
checkConfiguration() {
|
|
2469
2469
|
return /* not await */ llmTools.checkConfiguration();
|
|
@@ -2690,13 +2690,13 @@
|
|
|
2690
2690
|
|
|
2691
2691
|
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.
|
|
2692
2692
|
`);
|
|
2693
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
2693
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
2694
2694
|
console.warn(warningMessage);
|
|
2695
2695
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
2696
2696
|
/*
|
|
2697
2697
|
return {
|
|
2698
2698
|
async listModels() {
|
|
2699
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
2699
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
2700
2700
|
console.warn(
|
|
2701
2701
|
spaceTrim(
|
|
2702
2702
|
(block) => `
|
|
@@ -2972,17 +2972,17 @@
|
|
|
2972
2972
|
* Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
|
|
2973
2973
|
*/
|
|
2974
2974
|
const all = [];
|
|
2975
|
-
for (const { packageName, className, mimeTypes, documentationUrl,
|
|
2975
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersMetadataRegister.list()) {
|
|
2976
2976
|
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
2977
2977
|
continue;
|
|
2978
2978
|
}
|
|
2979
|
-
all.push({ packageName, className, mimeTypes, documentationUrl,
|
|
2979
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
2980
2980
|
}
|
|
2981
|
-
for (const { packageName, className, mimeTypes, documentationUrl,
|
|
2981
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersRegister.list()) {
|
|
2982
2982
|
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
2983
2983
|
continue;
|
|
2984
2984
|
}
|
|
2985
|
-
all.push({ packageName, className, mimeTypes, documentationUrl,
|
|
2985
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
2986
2986
|
}
|
|
2987
2987
|
for (const { metadata } of availableScrapers) {
|
|
2988
2988
|
all.push(metadata);
|
|
@@ -2994,8 +2994,8 @@
|
|
|
2994
2994
|
const isInstalled = $scrapersRegister
|
|
2995
2995
|
.list()
|
|
2996
2996
|
.find(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
|
|
2997
|
-
const
|
|
2998
|
-
return { ...metadata, isMetadataAviailable, isInstalled,
|
|
2997
|
+
const isAvailableInTools = availableScrapers.some(({ metadata: { packageName, className } }) => metadata.packageName === packageName && metadata.className === className);
|
|
2998
|
+
return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
|
|
2999
2999
|
});
|
|
3000
3000
|
if (metadata.length === 0) {
|
|
3001
3001
|
return spaceTrim__default["default"](`
|
|
@@ -3008,7 +3008,7 @@
|
|
|
3008
3008
|
return spaceTrim__default["default"]((block) => `
|
|
3009
3009
|
Available scrapers are:
|
|
3010
3010
|
${block(metadata
|
|
3011
|
-
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes,
|
|
3011
|
+
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
|
|
3012
3012
|
const more = [];
|
|
3013
3013
|
// TODO: [🧠] Maybe use `documentationUrl`
|
|
3014
3014
|
if (isMetadataAviailable) {
|
|
@@ -3017,16 +3017,16 @@
|
|
|
3017
3017
|
if (isInstalled) {
|
|
3018
3018
|
more.push(`🟩 Installed`);
|
|
3019
3019
|
} // not else
|
|
3020
|
-
if (
|
|
3020
|
+
if (isAvailableInTools) {
|
|
3021
3021
|
more.push(`🟦 Available in tools`);
|
|
3022
3022
|
} // not else
|
|
3023
3023
|
if (!isMetadataAviailable && isInstalled) {
|
|
3024
3024
|
more.push(`When no metadata registered but scraper is installed, it is an unexpected behavior`);
|
|
3025
3025
|
} // not else
|
|
3026
|
-
if (!isInstalled &&
|
|
3026
|
+
if (!isInstalled && isAvailableInTools) {
|
|
3027
3027
|
more.push(`When the scraper is not installed but available in tools, it is an unexpected compatibility behavior`);
|
|
3028
3028
|
} // not else
|
|
3029
|
-
if (!
|
|
3029
|
+
if (!isAvailableInBrowser) {
|
|
3030
3030
|
more.push(`Not usable in browser`);
|
|
3031
3031
|
}
|
|
3032
3032
|
const moreText = more.length === 0 ? '' : ` *(${more.join('; ')})*`;
|
|
@@ -3753,7 +3753,7 @@
|
|
|
3753
3753
|
/**
|
|
3754
3754
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
3755
3755
|
* Put `knowledgePieces` into `PrepareKnowledgeOptions`
|
|
3756
|
-
* TODO: [🪂] More than max things can run in parallel by
|
|
3756
|
+
* TODO: [🪂] More than max things can run in parallel by accident [1,[2a,2b,_],[3a,3b,_]]
|
|
3757
3757
|
* TODO: [🧠][❎] Do here proper M:N mapping
|
|
3758
3758
|
* [x] One source can make multiple pieces
|
|
3759
3759
|
* [ ] One piece can have multiple sources
|
|
@@ -5323,10 +5323,10 @@
|
|
|
5323
5323
|
*/
|
|
5324
5324
|
async function getKnowledgeForTask(options) {
|
|
5325
5325
|
const { tools, preparedPipeline, task, parameters } = options;
|
|
5326
|
-
const
|
|
5327
|
-
const
|
|
5326
|
+
const firstKnowledgePiece = preparedPipeline.knowledgePieces[0];
|
|
5327
|
+
const firstKnowledgeIndex = firstKnowledgePiece === null || firstKnowledgePiece === void 0 ? void 0 : firstKnowledgePiece.index[0];
|
|
5328
5328
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
|
|
5329
|
-
if (
|
|
5329
|
+
if (firstKnowledgePiece === undefined || firstKnowledgeIndex === undefined) {
|
|
5330
5330
|
return ''; // <- Note: Np knowledge present, return empty string
|
|
5331
5331
|
}
|
|
5332
5332
|
try {
|
|
@@ -5337,7 +5337,7 @@
|
|
|
5337
5337
|
title: 'Knowledge Search',
|
|
5338
5338
|
modelRequirements: {
|
|
5339
5339
|
modelVariant: 'EMBEDDING',
|
|
5340
|
-
modelName:
|
|
5340
|
+
modelName: firstKnowledgeIndex.modelName,
|
|
5341
5341
|
},
|
|
5342
5342
|
content: task.content,
|
|
5343
5343
|
parameters,
|
|
@@ -5345,7 +5345,7 @@
|
|
|
5345
5345
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
5346
5346
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
5347
5347
|
const { index } = knowledgePiece;
|
|
5348
|
-
const knowledgePieceIndex = index.find((i) => i.modelName ===
|
|
5348
|
+
const knowledgePieceIndex = index.find((i) => i.modelName === firstKnowledgeIndex.modelName);
|
|
5349
5349
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model
|
|
5350
5350
|
if (knowledgePieceIndex === undefined) {
|
|
5351
5351
|
return {
|
|
@@ -5366,8 +5366,8 @@
|
|
|
5366
5366
|
task,
|
|
5367
5367
|
taskEmbeddingPrompt,
|
|
5368
5368
|
taskEmbeddingResult,
|
|
5369
|
-
|
|
5370
|
-
|
|
5369
|
+
firstKnowledgePiece,
|
|
5370
|
+
firstKnowledgeIndex,
|
|
5371
5371
|
knowledgePiecesWithRelevance,
|
|
5372
5372
|
knowledgePiecesSorted,
|
|
5373
5373
|
knowledgePiecesLimited,
|
|
@@ -5436,7 +5436,7 @@
|
|
|
5436
5436
|
* @private internal utility of `createPipelineExecutor`
|
|
5437
5437
|
*/
|
|
5438
5438
|
async function executeTask(options) {
|
|
5439
|
-
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled,
|
|
5439
|
+
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
|
|
5440
5440
|
const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
5441
5441
|
// Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
|
|
5442
5442
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
@@ -5524,7 +5524,7 @@
|
|
|
5524
5524
|
cacheDirname,
|
|
5525
5525
|
intermediateFilesStrategy,
|
|
5526
5526
|
isAutoInstalled,
|
|
5527
|
-
|
|
5527
|
+
isNotPreparedWarningSuppressed,
|
|
5528
5528
|
});
|
|
5529
5529
|
await onProgress({
|
|
5530
5530
|
outputParameters: {
|
|
@@ -5619,7 +5619,7 @@
|
|
|
5619
5619
|
}
|
|
5620
5620
|
return exportJson({
|
|
5621
5621
|
name: `executionReport`,
|
|
5622
|
-
message: `
|
|
5622
|
+
message: `Unsuccessful PipelineExecutorResult (with missing parameter {${parameter.name}}) PipelineExecutorResult`,
|
|
5623
5623
|
order: [],
|
|
5624
5624
|
value: {
|
|
5625
5625
|
isSuccessful: false,
|
|
@@ -5656,7 +5656,7 @@
|
|
|
5656
5656
|
return exportJson({
|
|
5657
5657
|
name: 'pipelineExecutorResult',
|
|
5658
5658
|
message: spaceTrim.spaceTrim((block) => `
|
|
5659
|
-
|
|
5659
|
+
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
5660
5660
|
|
|
5661
5661
|
${block(pipelineIdentification)}
|
|
5662
5662
|
`),
|
|
@@ -5797,7 +5797,7 @@
|
|
|
5797
5797
|
}
|
|
5798
5798
|
return exportJson({
|
|
5799
5799
|
name: 'pipelineExecutorResult',
|
|
5800
|
-
message: `
|
|
5800
|
+
message: `Unsuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult`,
|
|
5801
5801
|
order: [],
|
|
5802
5802
|
value: {
|
|
5803
5803
|
isSuccessful: false,
|
|
@@ -5848,7 +5848,7 @@
|
|
|
5848
5848
|
* @public exported from `@promptbook/core`
|
|
5849
5849
|
*/
|
|
5850
5850
|
function createPipelineExecutor(options) {
|
|
5851
|
-
const { pipeline, tools, maxExecutionAttempts = DEFAULT_MAX_EXECUTION_ATTEMPTS, maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT, csvSettings = DEFAULT_CSV_SETTINGS, isVerbose = DEFAULT_IS_VERBOSE,
|
|
5851
|
+
const { pipeline, tools, maxExecutionAttempts = DEFAULT_MAX_EXECUTION_ATTEMPTS, maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT, csvSettings = DEFAULT_CSV_SETTINGS, isVerbose = DEFAULT_IS_VERBOSE, isNotPreparedWarningSuppressed = false, cacheDirname = DEFAULT_SCRAPE_CACHE_DIRNAME, intermediateFilesStrategy = DEFAULT_INTERMEDIATE_FILES_STRATEGY, isAutoInstalled = DEFAULT_IS_AUTO_INSTALLED, rootDirname = null, } = options;
|
|
5852
5852
|
validatePipeline(pipeline);
|
|
5853
5853
|
const pipelineIdentification = (() => {
|
|
5854
5854
|
// Note: This is a 😐 implementation of [🚞]
|
|
@@ -5865,7 +5865,7 @@
|
|
|
5865
5865
|
if (isPipelinePrepared(pipeline)) {
|
|
5866
5866
|
preparedPipeline = pipeline;
|
|
5867
5867
|
}
|
|
5868
|
-
else if (
|
|
5868
|
+
else if (isNotPreparedWarningSuppressed !== true) {
|
|
5869
5869
|
console.warn(spaceTrim.spaceTrim((block) => `
|
|
5870
5870
|
Pipeline is not prepared
|
|
5871
5871
|
|
|
@@ -5898,7 +5898,7 @@
|
|
|
5898
5898
|
maxParallelCount,
|
|
5899
5899
|
csvSettings,
|
|
5900
5900
|
isVerbose,
|
|
5901
|
-
|
|
5901
|
+
isNotPreparedWarningSuppressed,
|
|
5902
5902
|
rootDirname,
|
|
5903
5903
|
cacheDirname,
|
|
5904
5904
|
intermediateFilesStrategy,
|
|
@@ -5907,7 +5907,7 @@
|
|
|
5907
5907
|
assertsError(error);
|
|
5908
5908
|
return exportJson({
|
|
5909
5909
|
name: 'pipelineExecutorResult',
|
|
5910
|
-
message: `
|
|
5910
|
+
message: `Unsuccessful PipelineExecutorResult, last catch`,
|
|
5911
5911
|
order: [],
|
|
5912
5912
|
value: {
|
|
5913
5913
|
isSuccessful: false,
|
|
@@ -5945,7 +5945,7 @@
|
|
|
5945
5945
|
className: 'MarkdownScraper',
|
|
5946
5946
|
mimeTypes: ['text/markdown', 'text/plain'],
|
|
5947
5947
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
5948
|
-
|
|
5948
|
+
isAvailableInBrowser: true,
|
|
5949
5949
|
// <- Note: [🌏] This is the only scraper which makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
5950
5950
|
requiredExecutables: [],
|
|
5951
5951
|
}); /* <- Note: [🤛] */
|
|
@@ -5955,7 +5955,7 @@
|
|
|
5955
5955
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
5956
5956
|
*
|
|
5957
5957
|
* @public exported from `@promptbook/core`
|
|
5958
|
-
* @public exported from `@promptbook/
|
|
5958
|
+
* @public exported from `@promptbook/wizard`
|
|
5959
5959
|
* @public exported from `@promptbook/cli`
|
|
5960
5960
|
*/
|
|
5961
5961
|
$scrapersMetadataRegister.register(markdownScraperMetadata);
|
|
@@ -6054,7 +6054,7 @@
|
|
|
6054
6054
|
}
|
|
6055
6055
|
// ---
|
|
6056
6056
|
if (!llmTools.callEmbeddingModel) {
|
|
6057
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
6057
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
6058
6058
|
console.error('No callEmbeddingModel function provided');
|
|
6059
6059
|
}
|
|
6060
6060
|
else {
|
|
@@ -6080,7 +6080,7 @@
|
|
|
6080
6080
|
if (!(error instanceof PipelineExecutionError)) {
|
|
6081
6081
|
throw error;
|
|
6082
6082
|
}
|
|
6083
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
6083
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
6084
6084
|
console.error(error, "<- Note: This error is not critical to prepare the pipeline, just knowledge pieces won't have embeddings");
|
|
6085
6085
|
}
|
|
6086
6086
|
return {
|
|
@@ -6118,7 +6118,7 @@
|
|
|
6118
6118
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6119
6119
|
*
|
|
6120
6120
|
* @public exported from `@promptbook/markdown-utils`
|
|
6121
|
-
* @public exported from `@promptbook/
|
|
6121
|
+
* @public exported from `@promptbook/wizard`
|
|
6122
6122
|
* @public exported from `@promptbook/cli`
|
|
6123
6123
|
*/
|
|
6124
6124
|
const _MarkdownScraperRegistration = $scrapersRegister.register(createMarkdownScraper);
|