@promptbook/pdf 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 +46 -46
- 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 +2 -14
- package/umd/index.umd.js +46 -46
- 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/pdf",
|
|
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,23 +70,11 @@
|
|
|
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/pdf.index.d.ts",
|
|
88
76
|
"peerDependencies": {
|
|
89
|
-
"@promptbook/core": "0.
|
|
77
|
+
"@promptbook/core": "0.98.0-2"
|
|
90
78
|
},
|
|
91
79
|
"dependencies": {
|
|
92
80
|
"crypto": "1.0.1",
|
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
|
|
@@ -874,7 +874,7 @@
|
|
|
874
874
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
875
875
|
*/
|
|
876
876
|
|
|
877
|
-
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"}];
|
|
877
|
+
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"}];
|
|
878
878
|
|
|
879
879
|
/**
|
|
880
880
|
* Checks if value is valid email
|
|
@@ -1031,7 +1031,7 @@
|
|
|
1031
1031
|
});
|
|
1032
1032
|
}
|
|
1033
1033
|
catch (error) {
|
|
1034
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
1034
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
1035
1035
|
console.error('There was an error with prettifying the markdown, using the original as the fallback', {
|
|
1036
1036
|
error,
|
|
1037
1037
|
html: content,
|
|
@@ -1313,7 +1313,7 @@
|
|
|
1313
1313
|
else {
|
|
1314
1314
|
for (const [subName, subValue] of Object.entries(value)) {
|
|
1315
1315
|
if (subValue === undefined) {
|
|
1316
|
-
// Note: undefined in object is serializable - it is just
|
|
1316
|
+
// Note: undefined in object is serializable - it is just omitted
|
|
1317
1317
|
continue;
|
|
1318
1318
|
}
|
|
1319
1319
|
checkSerializableAsJson({ name: `${name}.${subName}`, value: subValue, message });
|
|
@@ -2003,7 +2003,7 @@
|
|
|
2003
2003
|
|
|
2004
2004
|
Note: You have probably forgotten to run "ptbk make" to update the collection
|
|
2005
2005
|
Note: Pipelines with the same URL are not allowed
|
|
2006
|
-
Only
|
|
2006
|
+
Only exception is when the pipelines are identical
|
|
2007
2007
|
|
|
2008
2008
|
`));
|
|
2009
2009
|
}
|
|
@@ -2771,12 +2771,12 @@
|
|
|
2771
2771
|
get title() {
|
|
2772
2772
|
return `${llmTools.title} (+usage)`;
|
|
2773
2773
|
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2774
|
-
// <- TODO: [🧈][🧠] Does it make
|
|
2774
|
+
// <- TODO: [🧈][🧠] Does it make sense to suffix "(+usage)"?
|
|
2775
2775
|
},
|
|
2776
2776
|
get description() {
|
|
2777
2777
|
return `${llmTools.description} (+usage)`;
|
|
2778
2778
|
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2779
|
-
// <- TODO: [🧈][🧠] Does it make
|
|
2779
|
+
// <- TODO: [🧈][🧠] Does it make sense to suffix "(+usage)"?
|
|
2780
2780
|
},
|
|
2781
2781
|
checkConfiguration() {
|
|
2782
2782
|
return /* not await */ llmTools.checkConfiguration();
|
|
@@ -3003,13 +3003,13 @@
|
|
|
3003
3003
|
|
|
3004
3004
|
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.
|
|
3005
3005
|
`);
|
|
3006
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
3006
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
3007
3007
|
console.warn(warningMessage);
|
|
3008
3008
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
3009
3009
|
/*
|
|
3010
3010
|
return {
|
|
3011
3011
|
async listModels() {
|
|
3012
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
3012
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
3013
3013
|
console.warn(
|
|
3014
3014
|
spaceTrim(
|
|
3015
3015
|
(block) => `
|
|
@@ -3285,17 +3285,17 @@
|
|
|
3285
3285
|
* Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
|
|
3286
3286
|
*/
|
|
3287
3287
|
const all = [];
|
|
3288
|
-
for (const { packageName, className, mimeTypes, documentationUrl,
|
|
3288
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersMetadataRegister.list()) {
|
|
3289
3289
|
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
3290
3290
|
continue;
|
|
3291
3291
|
}
|
|
3292
|
-
all.push({ packageName, className, mimeTypes, documentationUrl,
|
|
3292
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
3293
3293
|
}
|
|
3294
|
-
for (const { packageName, className, mimeTypes, documentationUrl,
|
|
3294
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersRegister.list()) {
|
|
3295
3295
|
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
3296
3296
|
continue;
|
|
3297
3297
|
}
|
|
3298
|
-
all.push({ packageName, className, mimeTypes, documentationUrl,
|
|
3298
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
3299
3299
|
}
|
|
3300
3300
|
for (const { metadata } of availableScrapers) {
|
|
3301
3301
|
all.push(metadata);
|
|
@@ -3307,8 +3307,8 @@
|
|
|
3307
3307
|
const isInstalled = $scrapersRegister
|
|
3308
3308
|
.list()
|
|
3309
3309
|
.find(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
|
|
3310
|
-
const
|
|
3311
|
-
return { ...metadata, isMetadataAviailable, isInstalled,
|
|
3310
|
+
const isAvailableInTools = availableScrapers.some(({ metadata: { packageName, className } }) => metadata.packageName === packageName && metadata.className === className);
|
|
3311
|
+
return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
|
|
3312
3312
|
});
|
|
3313
3313
|
if (metadata.length === 0) {
|
|
3314
3314
|
return spaceTrim__default["default"](`
|
|
@@ -3321,7 +3321,7 @@
|
|
|
3321
3321
|
return spaceTrim__default["default"]((block) => `
|
|
3322
3322
|
Available scrapers are:
|
|
3323
3323
|
${block(metadata
|
|
3324
|
-
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes,
|
|
3324
|
+
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
|
|
3325
3325
|
const more = [];
|
|
3326
3326
|
// TODO: [🧠] Maybe use `documentationUrl`
|
|
3327
3327
|
if (isMetadataAviailable) {
|
|
@@ -3330,16 +3330,16 @@
|
|
|
3330
3330
|
if (isInstalled) {
|
|
3331
3331
|
more.push(`🟩 Installed`);
|
|
3332
3332
|
} // not else
|
|
3333
|
-
if (
|
|
3333
|
+
if (isAvailableInTools) {
|
|
3334
3334
|
more.push(`🟦 Available in tools`);
|
|
3335
3335
|
} // not else
|
|
3336
3336
|
if (!isMetadataAviailable && isInstalled) {
|
|
3337
3337
|
more.push(`When no metadata registered but scraper is installed, it is an unexpected behavior`);
|
|
3338
3338
|
} // not else
|
|
3339
|
-
if (!isInstalled &&
|
|
3339
|
+
if (!isInstalled && isAvailableInTools) {
|
|
3340
3340
|
more.push(`When the scraper is not installed but available in tools, it is an unexpected compatibility behavior`);
|
|
3341
3341
|
} // not else
|
|
3342
|
-
if (!
|
|
3342
|
+
if (!isAvailableInBrowser) {
|
|
3343
3343
|
more.push(`Not usable in browser`);
|
|
3344
3344
|
}
|
|
3345
3345
|
const moreText = more.length === 0 ? '' : ` *(${more.join('; ')})*`;
|
|
@@ -3679,7 +3679,7 @@
|
|
|
3679
3679
|
/**
|
|
3680
3680
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
3681
3681
|
* Put `knowledgePieces` into `PrepareKnowledgeOptions`
|
|
3682
|
-
* TODO: [🪂] More than max things can run in parallel by
|
|
3682
|
+
* TODO: [🪂] More than max things can run in parallel by accident [1,[2a,2b,_],[3a,3b,_]]
|
|
3683
3683
|
* TODO: [🧠][❎] Do here proper M:N mapping
|
|
3684
3684
|
* [x] One source can make multiple pieces
|
|
3685
3685
|
* [ ] One piece can have multiple sources
|
|
@@ -5351,10 +5351,10 @@
|
|
|
5351
5351
|
*/
|
|
5352
5352
|
async function getKnowledgeForTask(options) {
|
|
5353
5353
|
const { tools, preparedPipeline, task, parameters } = options;
|
|
5354
|
-
const
|
|
5355
|
-
const
|
|
5354
|
+
const firstKnowledgePiece = preparedPipeline.knowledgePieces[0];
|
|
5355
|
+
const firstKnowledgeIndex = firstKnowledgePiece === null || firstKnowledgePiece === void 0 ? void 0 : firstKnowledgePiece.index[0];
|
|
5356
5356
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
|
|
5357
|
-
if (
|
|
5357
|
+
if (firstKnowledgePiece === undefined || firstKnowledgeIndex === undefined) {
|
|
5358
5358
|
return ''; // <- Note: Np knowledge present, return empty string
|
|
5359
5359
|
}
|
|
5360
5360
|
try {
|
|
@@ -5365,7 +5365,7 @@
|
|
|
5365
5365
|
title: 'Knowledge Search',
|
|
5366
5366
|
modelRequirements: {
|
|
5367
5367
|
modelVariant: 'EMBEDDING',
|
|
5368
|
-
modelName:
|
|
5368
|
+
modelName: firstKnowledgeIndex.modelName,
|
|
5369
5369
|
},
|
|
5370
5370
|
content: task.content,
|
|
5371
5371
|
parameters,
|
|
@@ -5373,7 +5373,7 @@
|
|
|
5373
5373
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
5374
5374
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
5375
5375
|
const { index } = knowledgePiece;
|
|
5376
|
-
const knowledgePieceIndex = index.find((i) => i.modelName ===
|
|
5376
|
+
const knowledgePieceIndex = index.find((i) => i.modelName === firstKnowledgeIndex.modelName);
|
|
5377
5377
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model
|
|
5378
5378
|
if (knowledgePieceIndex === undefined) {
|
|
5379
5379
|
return {
|
|
@@ -5394,8 +5394,8 @@
|
|
|
5394
5394
|
task,
|
|
5395
5395
|
taskEmbeddingPrompt,
|
|
5396
5396
|
taskEmbeddingResult,
|
|
5397
|
-
|
|
5398
|
-
|
|
5397
|
+
firstKnowledgePiece,
|
|
5398
|
+
firstKnowledgeIndex,
|
|
5399
5399
|
knowledgePiecesWithRelevance,
|
|
5400
5400
|
knowledgePiecesSorted,
|
|
5401
5401
|
knowledgePiecesLimited,
|
|
@@ -5464,7 +5464,7 @@
|
|
|
5464
5464
|
* @private internal utility of `createPipelineExecutor`
|
|
5465
5465
|
*/
|
|
5466
5466
|
async function executeTask(options) {
|
|
5467
|
-
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled,
|
|
5467
|
+
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
|
|
5468
5468
|
const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
5469
5469
|
// Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
|
|
5470
5470
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
@@ -5552,7 +5552,7 @@
|
|
|
5552
5552
|
cacheDirname,
|
|
5553
5553
|
intermediateFilesStrategy,
|
|
5554
5554
|
isAutoInstalled,
|
|
5555
|
-
|
|
5555
|
+
isNotPreparedWarningSuppressed,
|
|
5556
5556
|
});
|
|
5557
5557
|
await onProgress({
|
|
5558
5558
|
outputParameters: {
|
|
@@ -5647,7 +5647,7 @@
|
|
|
5647
5647
|
}
|
|
5648
5648
|
return exportJson({
|
|
5649
5649
|
name: `executionReport`,
|
|
5650
|
-
message: `
|
|
5650
|
+
message: `Unsuccessful PipelineExecutorResult (with missing parameter {${parameter.name}}) PipelineExecutorResult`,
|
|
5651
5651
|
order: [],
|
|
5652
5652
|
value: {
|
|
5653
5653
|
isSuccessful: false,
|
|
@@ -5684,7 +5684,7 @@
|
|
|
5684
5684
|
return exportJson({
|
|
5685
5685
|
name: 'pipelineExecutorResult',
|
|
5686
5686
|
message: spaceTrim.spaceTrim((block) => `
|
|
5687
|
-
|
|
5687
|
+
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
5688
5688
|
|
|
5689
5689
|
${block(pipelineIdentification)}
|
|
5690
5690
|
`),
|
|
@@ -5825,7 +5825,7 @@
|
|
|
5825
5825
|
}
|
|
5826
5826
|
return exportJson({
|
|
5827
5827
|
name: 'pipelineExecutorResult',
|
|
5828
|
-
message: `
|
|
5828
|
+
message: `Unsuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult`,
|
|
5829
5829
|
order: [],
|
|
5830
5830
|
value: {
|
|
5831
5831
|
isSuccessful: false,
|
|
@@ -5876,7 +5876,7 @@
|
|
|
5876
5876
|
* @public exported from `@promptbook/core`
|
|
5877
5877
|
*/
|
|
5878
5878
|
function createPipelineExecutor(options) {
|
|
5879
|
-
const { pipeline, tools, maxExecutionAttempts = DEFAULT_MAX_EXECUTION_ATTEMPTS, maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT, csvSettings = DEFAULT_CSV_SETTINGS, isVerbose = DEFAULT_IS_VERBOSE,
|
|
5879
|
+
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;
|
|
5880
5880
|
validatePipeline(pipeline);
|
|
5881
5881
|
const pipelineIdentification = (() => {
|
|
5882
5882
|
// Note: This is a 😐 implementation of [🚞]
|
|
@@ -5893,7 +5893,7 @@
|
|
|
5893
5893
|
if (isPipelinePrepared(pipeline)) {
|
|
5894
5894
|
preparedPipeline = pipeline;
|
|
5895
5895
|
}
|
|
5896
|
-
else if (
|
|
5896
|
+
else if (isNotPreparedWarningSuppressed !== true) {
|
|
5897
5897
|
console.warn(spaceTrim.spaceTrim((block) => `
|
|
5898
5898
|
Pipeline is not prepared
|
|
5899
5899
|
|
|
@@ -5926,7 +5926,7 @@
|
|
|
5926
5926
|
maxParallelCount,
|
|
5927
5927
|
csvSettings,
|
|
5928
5928
|
isVerbose,
|
|
5929
|
-
|
|
5929
|
+
isNotPreparedWarningSuppressed,
|
|
5930
5930
|
rootDirname,
|
|
5931
5931
|
cacheDirname,
|
|
5932
5932
|
intermediateFilesStrategy,
|
|
@@ -5935,7 +5935,7 @@
|
|
|
5935
5935
|
assertsError(error);
|
|
5936
5936
|
return exportJson({
|
|
5937
5937
|
name: 'pipelineExecutorResult',
|
|
5938
|
-
message: `
|
|
5938
|
+
message: `Unsuccessful PipelineExecutorResult, last catch`,
|
|
5939
5939
|
order: [],
|
|
5940
5940
|
value: {
|
|
5941
5941
|
isSuccessful: false,
|
|
@@ -5973,7 +5973,7 @@
|
|
|
5973
5973
|
className: 'MarkdownScraper',
|
|
5974
5974
|
mimeTypes: ['text/markdown', 'text/plain'],
|
|
5975
5975
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
5976
|
-
|
|
5976
|
+
isAvailableInBrowser: true,
|
|
5977
5977
|
// <- 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
|
|
5978
5978
|
requiredExecutables: [],
|
|
5979
5979
|
}); /* <- Note: [🤛] */
|
|
@@ -5983,7 +5983,7 @@
|
|
|
5983
5983
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
5984
5984
|
*
|
|
5985
5985
|
* @public exported from `@promptbook/core`
|
|
5986
|
-
* @public exported from `@promptbook/
|
|
5986
|
+
* @public exported from `@promptbook/wizard`
|
|
5987
5987
|
* @public exported from `@promptbook/cli`
|
|
5988
5988
|
*/
|
|
5989
5989
|
$scrapersMetadataRegister.register(markdownScraperMetadata);
|
|
@@ -6082,7 +6082,7 @@
|
|
|
6082
6082
|
}
|
|
6083
6083
|
// ---
|
|
6084
6084
|
if (!llmTools.callEmbeddingModel) {
|
|
6085
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
6085
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
6086
6086
|
console.error('No callEmbeddingModel function provided');
|
|
6087
6087
|
}
|
|
6088
6088
|
else {
|
|
@@ -6108,7 +6108,7 @@
|
|
|
6108
6108
|
if (!(error instanceof PipelineExecutionError)) {
|
|
6109
6109
|
throw error;
|
|
6110
6110
|
}
|
|
6111
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
6111
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
6112
6112
|
console.error(error, "<- Note: This error is not critical to prepare the pipeline, just knowledge pieces won't have embeddings");
|
|
6113
6113
|
}
|
|
6114
6114
|
return {
|
|
@@ -6144,7 +6144,7 @@
|
|
|
6144
6144
|
// 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
6145
6145
|
],
|
|
6146
6146
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
6147
|
-
|
|
6147
|
+
isAvailableInBrowser: false,
|
|
6148
6148
|
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
6149
6149
|
requiredExecutables: [],
|
|
6150
6150
|
}); /* <- Note: [🤛] */
|
|
@@ -6154,7 +6154,7 @@
|
|
|
6154
6154
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6155
6155
|
*
|
|
6156
6156
|
* @public exported from `@promptbook/core`
|
|
6157
|
-
* @public exported from `@promptbook/
|
|
6157
|
+
* @public exported from `@promptbook/wizard`
|
|
6158
6158
|
* @public exported from `@promptbook/cli`
|
|
6159
6159
|
*/
|
|
6160
6160
|
$scrapersMetadataRegister.register(markitdownScraperMetadata);
|
|
@@ -6291,7 +6291,7 @@
|
|
|
6291
6291
|
*
|
|
6292
6292
|
* @public exported from `@promptbook/markitdown`
|
|
6293
6293
|
* @public exported from `@promptbook/pdf`
|
|
6294
|
-
* @public exported from `@promptbook/
|
|
6294
|
+
* @public exported from `@promptbook/wizard`
|
|
6295
6295
|
* @public exported from `@promptbook/cli`
|
|
6296
6296
|
*/
|
|
6297
6297
|
const _MarkitdownScraperRegistration = $scrapersRegister.register(createMarkitdownScraper);
|
|
@@ -6312,7 +6312,7 @@
|
|
|
6312
6312
|
className: 'PdfScraper',
|
|
6313
6313
|
mimeTypes: ['application/pdf-DISABLED'],
|
|
6314
6314
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
6315
|
-
|
|
6315
|
+
isAvailableInBrowser: false,
|
|
6316
6316
|
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
6317
6317
|
requiredExecutables: [],
|
|
6318
6318
|
}); /* <- Note: [🤛] */
|
|
@@ -6322,7 +6322,7 @@
|
|
|
6322
6322
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6323
6323
|
*
|
|
6324
6324
|
* @public exported from `@promptbook/core`
|
|
6325
|
-
* @public exported from `@promptbook/
|
|
6325
|
+
* @public exported from `@promptbook/wizard`
|
|
6326
6326
|
* @public exported from `@promptbook/cli`
|
|
6327
6327
|
*/
|
|
6328
6328
|
$scrapersMetadataRegister.register(pdfScraperMetadata);
|
|
@@ -6397,7 +6397,7 @@
|
|
|
6397
6397
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6398
6398
|
*
|
|
6399
6399
|
* @public exported from `@promptbook/pdf`
|
|
6400
|
-
* @public exported from `@promptbook/
|
|
6400
|
+
* @public exported from `@promptbook/wizard`
|
|
6401
6401
|
* @public exported from `@promptbook/cli`
|
|
6402
6402
|
*/
|
|
6403
6403
|
const _PdfScraperRegistration = $scrapersRegister.register(createPdfScraper);
|