@promptbook/legacy-documents 0.94.0-7 → 0.95.0
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 +8 -21
- package/esm/index.es.js +45 -45
- 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 +25 -14
- package/umd/index.umd.js +45 -45
- 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.94.0
|
|
18
|
+
* It follows semantic versioning (e.g., `0.94.0`).
|
|
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/legacy-documents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.95.0",
|
|
4
4
|
"description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -36,6 +36,29 @@
|
|
|
36
36
|
"o1-mini",
|
|
37
37
|
"o1-preview",
|
|
38
38
|
"anthropic",
|
|
39
|
+
"claude",
|
|
40
|
+
"claude-3",
|
|
41
|
+
"claude-3-opus",
|
|
42
|
+
"claude-3-sonnet",
|
|
43
|
+
"claude-3-haiku",
|
|
44
|
+
"gemini",
|
|
45
|
+
"gemini-pro",
|
|
46
|
+
"gemini-flash",
|
|
47
|
+
"mixtral",
|
|
48
|
+
"mistral",
|
|
49
|
+
"ollama",
|
|
50
|
+
"ai-orchestration",
|
|
51
|
+
"prompt-engineering",
|
|
52
|
+
"llmops",
|
|
53
|
+
"multimodal",
|
|
54
|
+
"reasoning",
|
|
55
|
+
"rag",
|
|
56
|
+
"embeddings",
|
|
57
|
+
"function-calling",
|
|
58
|
+
"large-language-models",
|
|
59
|
+
"ai-application-framework",
|
|
60
|
+
"text-generation",
|
|
61
|
+
"ai-agents",
|
|
39
62
|
"LLMOps"
|
|
40
63
|
],
|
|
41
64
|
"license": "BUSL-1.1",
|
|
@@ -47,23 +70,11 @@
|
|
|
47
70
|
"node": ">=16.0.0",
|
|
48
71
|
"npm": ">=8.0.0"
|
|
49
72
|
},
|
|
50
|
-
"cspell": {
|
|
51
|
-
"version": "0.2",
|
|
52
|
-
"language": "en",
|
|
53
|
-
"ignorePaths": [
|
|
54
|
-
"node_modules",
|
|
55
|
-
".next",
|
|
56
|
-
"coverage",
|
|
57
|
-
"dist",
|
|
58
|
-
".git"
|
|
59
|
-
],
|
|
60
|
-
"words": []
|
|
61
|
-
},
|
|
62
73
|
"main": "./umd/index.umd.js",
|
|
63
74
|
"module": "./esm/index.es.js",
|
|
64
75
|
"typings": "./esm/typings/src/_packages/legacy-documents.index.d.ts",
|
|
65
76
|
"peerDependencies": {
|
|
66
|
-
"@promptbook/core": "0.
|
|
77
|
+
"@promptbook/core": "0.95.0"
|
|
67
78
|
},
|
|
68
79
|
"dependencies": {
|
|
69
80
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* @generated
|
|
27
27
|
* @see https://github.com/webgptorg/promptbook
|
|
28
28
|
*/
|
|
29
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
29
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.95.0';
|
|
30
30
|
/**
|
|
31
31
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
32
32
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1052,7 +1052,7 @@
|
|
|
1052
1052
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
1053
1053
|
*/
|
|
1054
1054
|
|
|
1055
|
-
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"}];
|
|
1055
|
+
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"}];
|
|
1056
1056
|
|
|
1057
1057
|
/**
|
|
1058
1058
|
* Checks if value is valid email
|
|
@@ -1209,7 +1209,7 @@
|
|
|
1209
1209
|
});
|
|
1210
1210
|
}
|
|
1211
1211
|
catch (error) {
|
|
1212
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
1212
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
1213
1213
|
console.error('There was an error with prettifying the markdown, using the original as the fallback', {
|
|
1214
1214
|
error,
|
|
1215
1215
|
html: content,
|
|
@@ -1491,7 +1491,7 @@
|
|
|
1491
1491
|
else {
|
|
1492
1492
|
for (const [subName, subValue] of Object.entries(value)) {
|
|
1493
1493
|
if (subValue === undefined) {
|
|
1494
|
-
// Note: undefined in object is serializable - it is just
|
|
1494
|
+
// Note: undefined in object is serializable - it is just omitted
|
|
1495
1495
|
continue;
|
|
1496
1496
|
}
|
|
1497
1497
|
checkSerializableAsJson({ name: `${name}.${subName}`, value: subValue, message });
|
|
@@ -2181,7 +2181,7 @@
|
|
|
2181
2181
|
|
|
2182
2182
|
Note: You have probably forgotten to run "ptbk make" to update the collection
|
|
2183
2183
|
Note: Pipelines with the same URL are not allowed
|
|
2184
|
-
Only
|
|
2184
|
+
Only exception is when the pipelines are identical
|
|
2185
2185
|
|
|
2186
2186
|
`));
|
|
2187
2187
|
}
|
|
@@ -2931,12 +2931,12 @@
|
|
|
2931
2931
|
get title() {
|
|
2932
2932
|
return `${llmTools.title} (+usage)`;
|
|
2933
2933
|
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2934
|
-
// <- TODO: [🧈][🧠] Does it make
|
|
2934
|
+
// <- TODO: [🧈][🧠] Does it make sense to suffix "(+usage)"?
|
|
2935
2935
|
},
|
|
2936
2936
|
get description() {
|
|
2937
2937
|
return `${llmTools.description} (+usage)`;
|
|
2938
2938
|
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2939
|
-
// <- TODO: [🧈][🧠] Does it make
|
|
2939
|
+
// <- TODO: [🧈][🧠] Does it make sense to suffix "(+usage)"?
|
|
2940
2940
|
},
|
|
2941
2941
|
checkConfiguration() {
|
|
2942
2942
|
return /* not await */ llmTools.checkConfiguration();
|
|
@@ -3163,13 +3163,13 @@
|
|
|
3163
3163
|
|
|
3164
3164
|
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.
|
|
3165
3165
|
`);
|
|
3166
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
3166
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
3167
3167
|
console.warn(warningMessage);
|
|
3168
3168
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
3169
3169
|
/*
|
|
3170
3170
|
return {
|
|
3171
3171
|
async listModels() {
|
|
3172
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
3172
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
3173
3173
|
console.warn(
|
|
3174
3174
|
spaceTrim(
|
|
3175
3175
|
(block) => `
|
|
@@ -3445,17 +3445,17 @@
|
|
|
3445
3445
|
* Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
|
|
3446
3446
|
*/
|
|
3447
3447
|
const all = [];
|
|
3448
|
-
for (const { packageName, className, mimeTypes, documentationUrl,
|
|
3448
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersMetadataRegister.list()) {
|
|
3449
3449
|
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
3450
3450
|
continue;
|
|
3451
3451
|
}
|
|
3452
|
-
all.push({ packageName, className, mimeTypes, documentationUrl,
|
|
3452
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
3453
3453
|
}
|
|
3454
|
-
for (const { packageName, className, mimeTypes, documentationUrl,
|
|
3454
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersRegister.list()) {
|
|
3455
3455
|
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
3456
3456
|
continue;
|
|
3457
3457
|
}
|
|
3458
|
-
all.push({ packageName, className, mimeTypes, documentationUrl,
|
|
3458
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
3459
3459
|
}
|
|
3460
3460
|
for (const { metadata } of availableScrapers) {
|
|
3461
3461
|
all.push(metadata);
|
|
@@ -3467,8 +3467,8 @@
|
|
|
3467
3467
|
const isInstalled = $scrapersRegister
|
|
3468
3468
|
.list()
|
|
3469
3469
|
.find(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
|
|
3470
|
-
const
|
|
3471
|
-
return { ...metadata, isMetadataAviailable, isInstalled,
|
|
3470
|
+
const isAvailableInTools = availableScrapers.some(({ metadata: { packageName, className } }) => metadata.packageName === packageName && metadata.className === className);
|
|
3471
|
+
return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
|
|
3472
3472
|
});
|
|
3473
3473
|
if (metadata.length === 0) {
|
|
3474
3474
|
return spaceTrim__default["default"](`
|
|
@@ -3481,7 +3481,7 @@
|
|
|
3481
3481
|
return spaceTrim__default["default"]((block) => `
|
|
3482
3482
|
Available scrapers are:
|
|
3483
3483
|
${block(metadata
|
|
3484
|
-
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes,
|
|
3484
|
+
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
|
|
3485
3485
|
const more = [];
|
|
3486
3486
|
// TODO: [🧠] Maybe use `documentationUrl`
|
|
3487
3487
|
if (isMetadataAviailable) {
|
|
@@ -3490,16 +3490,16 @@
|
|
|
3490
3490
|
if (isInstalled) {
|
|
3491
3491
|
more.push(`🟩 Installed`);
|
|
3492
3492
|
} // not else
|
|
3493
|
-
if (
|
|
3493
|
+
if (isAvailableInTools) {
|
|
3494
3494
|
more.push(`🟦 Available in tools`);
|
|
3495
3495
|
} // not else
|
|
3496
3496
|
if (!isMetadataAviailable && isInstalled) {
|
|
3497
3497
|
more.push(`When no metadata registered but scraper is installed, it is an unexpected behavior`);
|
|
3498
3498
|
} // not else
|
|
3499
|
-
if (!isInstalled &&
|
|
3499
|
+
if (!isInstalled && isAvailableInTools) {
|
|
3500
3500
|
more.push(`When the scraper is not installed but available in tools, it is an unexpected compatibility behavior`);
|
|
3501
3501
|
} // not else
|
|
3502
|
-
if (!
|
|
3502
|
+
if (!isAvailableInBrowser) {
|
|
3503
3503
|
more.push(`Not usable in browser`);
|
|
3504
3504
|
}
|
|
3505
3505
|
const moreText = more.length === 0 ? '' : ` *(${more.join('; ')})*`;
|
|
@@ -3829,7 +3829,7 @@
|
|
|
3829
3829
|
/**
|
|
3830
3830
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
3831
3831
|
* Put `knowledgePieces` into `PrepareKnowledgeOptions`
|
|
3832
|
-
* TODO: [🪂] More than max things can run in parallel by
|
|
3832
|
+
* TODO: [🪂] More than max things can run in parallel by accident [1,[2a,2b,_],[3a,3b,_]]
|
|
3833
3833
|
* TODO: [🧠][❎] Do here proper M:N mapping
|
|
3834
3834
|
* [x] One source can make multiple pieces
|
|
3835
3835
|
* [ ] One piece can have multiple sources
|
|
@@ -5501,10 +5501,10 @@
|
|
|
5501
5501
|
*/
|
|
5502
5502
|
async function getKnowledgeForTask(options) {
|
|
5503
5503
|
const { tools, preparedPipeline, task, parameters } = options;
|
|
5504
|
-
const
|
|
5505
|
-
const
|
|
5504
|
+
const firstKnowledgePiece = preparedPipeline.knowledgePieces[0];
|
|
5505
|
+
const firstKnowledgeIndex = firstKnowledgePiece === null || firstKnowledgePiece === void 0 ? void 0 : firstKnowledgePiece.index[0];
|
|
5506
5506
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
|
|
5507
|
-
if (
|
|
5507
|
+
if (firstKnowledgePiece === undefined || firstKnowledgeIndex === undefined) {
|
|
5508
5508
|
return ''; // <- Note: Np knowledge present, return empty string
|
|
5509
5509
|
}
|
|
5510
5510
|
try {
|
|
@@ -5515,7 +5515,7 @@
|
|
|
5515
5515
|
title: 'Knowledge Search',
|
|
5516
5516
|
modelRequirements: {
|
|
5517
5517
|
modelVariant: 'EMBEDDING',
|
|
5518
|
-
modelName:
|
|
5518
|
+
modelName: firstKnowledgeIndex.modelName,
|
|
5519
5519
|
},
|
|
5520
5520
|
content: task.content,
|
|
5521
5521
|
parameters,
|
|
@@ -5523,7 +5523,7 @@
|
|
|
5523
5523
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
5524
5524
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
5525
5525
|
const { index } = knowledgePiece;
|
|
5526
|
-
const knowledgePieceIndex = index.find((i) => i.modelName ===
|
|
5526
|
+
const knowledgePieceIndex = index.find((i) => i.modelName === firstKnowledgeIndex.modelName);
|
|
5527
5527
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model
|
|
5528
5528
|
if (knowledgePieceIndex === undefined) {
|
|
5529
5529
|
return {
|
|
@@ -5544,8 +5544,8 @@
|
|
|
5544
5544
|
task,
|
|
5545
5545
|
taskEmbeddingPrompt,
|
|
5546
5546
|
taskEmbeddingResult,
|
|
5547
|
-
|
|
5548
|
-
|
|
5547
|
+
firstKnowledgePiece,
|
|
5548
|
+
firstKnowledgeIndex,
|
|
5549
5549
|
knowledgePiecesWithRelevance,
|
|
5550
5550
|
knowledgePiecesSorted,
|
|
5551
5551
|
knowledgePiecesLimited,
|
|
@@ -5614,7 +5614,7 @@
|
|
|
5614
5614
|
* @private internal utility of `createPipelineExecutor`
|
|
5615
5615
|
*/
|
|
5616
5616
|
async function executeTask(options) {
|
|
5617
|
-
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled,
|
|
5617
|
+
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
|
|
5618
5618
|
const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
5619
5619
|
// Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
|
|
5620
5620
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
@@ -5702,7 +5702,7 @@
|
|
|
5702
5702
|
cacheDirname,
|
|
5703
5703
|
intermediateFilesStrategy,
|
|
5704
5704
|
isAutoInstalled,
|
|
5705
|
-
|
|
5705
|
+
isNotPreparedWarningSuppressed,
|
|
5706
5706
|
});
|
|
5707
5707
|
await onProgress({
|
|
5708
5708
|
outputParameters: {
|
|
@@ -5797,7 +5797,7 @@
|
|
|
5797
5797
|
}
|
|
5798
5798
|
return exportJson({
|
|
5799
5799
|
name: `executionReport`,
|
|
5800
|
-
message: `
|
|
5800
|
+
message: `Unsuccessful PipelineExecutorResult (with missing parameter {${parameter.name}}) PipelineExecutorResult`,
|
|
5801
5801
|
order: [],
|
|
5802
5802
|
value: {
|
|
5803
5803
|
isSuccessful: false,
|
|
@@ -5834,7 +5834,7 @@
|
|
|
5834
5834
|
return exportJson({
|
|
5835
5835
|
name: 'pipelineExecutorResult',
|
|
5836
5836
|
message: spaceTrim.spaceTrim((block) => `
|
|
5837
|
-
|
|
5837
|
+
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
5838
5838
|
|
|
5839
5839
|
${block(pipelineIdentification)}
|
|
5840
5840
|
`),
|
|
@@ -5975,7 +5975,7 @@
|
|
|
5975
5975
|
}
|
|
5976
5976
|
return exportJson({
|
|
5977
5977
|
name: 'pipelineExecutorResult',
|
|
5978
|
-
message: `
|
|
5978
|
+
message: `Unsuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult`,
|
|
5979
5979
|
order: [],
|
|
5980
5980
|
value: {
|
|
5981
5981
|
isSuccessful: false,
|
|
@@ -6026,7 +6026,7 @@
|
|
|
6026
6026
|
* @public exported from `@promptbook/core`
|
|
6027
6027
|
*/
|
|
6028
6028
|
function createPipelineExecutor(options) {
|
|
6029
|
-
const { pipeline, tools, maxExecutionAttempts = DEFAULT_MAX_EXECUTION_ATTEMPTS, maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT, csvSettings = DEFAULT_CSV_SETTINGS, isVerbose = DEFAULT_IS_VERBOSE,
|
|
6029
|
+
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;
|
|
6030
6030
|
validatePipeline(pipeline);
|
|
6031
6031
|
const pipelineIdentification = (() => {
|
|
6032
6032
|
// Note: This is a 😐 implementation of [🚞]
|
|
@@ -6043,7 +6043,7 @@
|
|
|
6043
6043
|
if (isPipelinePrepared(pipeline)) {
|
|
6044
6044
|
preparedPipeline = pipeline;
|
|
6045
6045
|
}
|
|
6046
|
-
else if (
|
|
6046
|
+
else if (isNotPreparedWarningSuppressed !== true) {
|
|
6047
6047
|
console.warn(spaceTrim.spaceTrim((block) => `
|
|
6048
6048
|
Pipeline is not prepared
|
|
6049
6049
|
|
|
@@ -6076,7 +6076,7 @@
|
|
|
6076
6076
|
maxParallelCount,
|
|
6077
6077
|
csvSettings,
|
|
6078
6078
|
isVerbose,
|
|
6079
|
-
|
|
6079
|
+
isNotPreparedWarningSuppressed,
|
|
6080
6080
|
rootDirname,
|
|
6081
6081
|
cacheDirname,
|
|
6082
6082
|
intermediateFilesStrategy,
|
|
@@ -6085,7 +6085,7 @@
|
|
|
6085
6085
|
assertsError(error);
|
|
6086
6086
|
return exportJson({
|
|
6087
6087
|
name: 'pipelineExecutorResult',
|
|
6088
|
-
message: `
|
|
6088
|
+
message: `Unsuccessful PipelineExecutorResult, last catch`,
|
|
6089
6089
|
order: [],
|
|
6090
6090
|
value: {
|
|
6091
6091
|
isSuccessful: false,
|
|
@@ -6123,7 +6123,7 @@
|
|
|
6123
6123
|
className: 'MarkdownScraper',
|
|
6124
6124
|
mimeTypes: ['text/markdown', 'text/plain'],
|
|
6125
6125
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
6126
|
-
|
|
6126
|
+
isAvailableInBrowser: true,
|
|
6127
6127
|
// <- 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
|
|
6128
6128
|
requiredExecutables: [],
|
|
6129
6129
|
}); /* <- Note: [🤛] */
|
|
@@ -6133,7 +6133,7 @@
|
|
|
6133
6133
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6134
6134
|
*
|
|
6135
6135
|
* @public exported from `@promptbook/core`
|
|
6136
|
-
* @public exported from `@promptbook/
|
|
6136
|
+
* @public exported from `@promptbook/wizard`
|
|
6137
6137
|
* @public exported from `@promptbook/cli`
|
|
6138
6138
|
*/
|
|
6139
6139
|
$scrapersMetadataRegister.register(markdownScraperMetadata);
|
|
@@ -6232,7 +6232,7 @@
|
|
|
6232
6232
|
}
|
|
6233
6233
|
// ---
|
|
6234
6234
|
if (!llmTools.callEmbeddingModel) {
|
|
6235
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
6235
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
6236
6236
|
console.error('No callEmbeddingModel function provided');
|
|
6237
6237
|
}
|
|
6238
6238
|
else {
|
|
@@ -6258,7 +6258,7 @@
|
|
|
6258
6258
|
if (!(error instanceof PipelineExecutionError)) {
|
|
6259
6259
|
throw error;
|
|
6260
6260
|
}
|
|
6261
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
6261
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
6262
6262
|
console.error(error, "<- Note: This error is not critical to prepare the pipeline, just knowledge pieces won't have embeddings");
|
|
6263
6263
|
}
|
|
6264
6264
|
return {
|
|
@@ -6289,7 +6289,7 @@
|
|
|
6289
6289
|
className: 'DocumentScraper',
|
|
6290
6290
|
mimeTypes: ['application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
|
|
6291
6291
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
6292
|
-
|
|
6292
|
+
isAvailableInBrowser: false,
|
|
6293
6293
|
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
6294
6294
|
requiredExecutables: ['Pandoc'],
|
|
6295
6295
|
}); /* <- Note: [🤛] */
|
|
@@ -6299,7 +6299,7 @@
|
|
|
6299
6299
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6300
6300
|
*
|
|
6301
6301
|
* @public exported from `@promptbook/core`
|
|
6302
|
-
* @public exported from `@promptbook/
|
|
6302
|
+
* @public exported from `@promptbook/wizard`
|
|
6303
6303
|
* @public exported from `@promptbook/cli`
|
|
6304
6304
|
*/
|
|
6305
6305
|
$scrapersMetadataRegister.register(documentScraperMetadata);
|
|
@@ -6425,7 +6425,7 @@
|
|
|
6425
6425
|
className: 'LegacyDocumentScraper',
|
|
6426
6426
|
mimeTypes: ['application/msword', 'text/rtf'],
|
|
6427
6427
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
6428
|
-
|
|
6428
|
+
isAvailableInBrowser: false,
|
|
6429
6429
|
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
6430
6430
|
requiredExecutables: [
|
|
6431
6431
|
'Pandoc',
|
|
@@ -6439,7 +6439,7 @@
|
|
|
6439
6439
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6440
6440
|
*
|
|
6441
6441
|
* @public exported from `@promptbook/core`
|
|
6442
|
-
* @public exported from `@promptbook/
|
|
6442
|
+
* @public exported from `@promptbook/wizard`
|
|
6443
6443
|
* @public exported from `@promptbook/cli`
|
|
6444
6444
|
*/
|
|
6445
6445
|
$scrapersMetadataRegister.register(legacyDocumentScraperMetadata);
|
|
@@ -6600,7 +6600,7 @@
|
|
|
6600
6600
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6601
6601
|
*
|
|
6602
6602
|
* @public exported from `@promptbook/legacy-documents`
|
|
6603
|
-
* @public exported from `@promptbook/
|
|
6603
|
+
* @public exported from `@promptbook/wizard`
|
|
6604
6604
|
* @public exported from `@promptbook/cli`
|
|
6605
6605
|
*/
|
|
6606
6606
|
const _LegacyDocumentScraperRegistration = $scrapersRegister.register(createLegacyDocumentScraper);
|