@promptbook/pdf 0.81.0-9 → 0.81.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 +25 -8
- package/esm/index.es.js +182 -91
- package/esm/index.es.js.map +1 -1
- package/esm/typings/books/index.d.ts +38 -0
- package/esm/typings/src/_packages/core.index.d.ts +12 -4
- package/esm/typings/src/_packages/markdown-utils.index.d.ts +2 -2
- package/esm/typings/src/_packages/node.index.d.ts +0 -2
- package/esm/typings/src/_packages/templates.index.d.ts +2 -2
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/_packages/wizzard.index.d.ts +44 -0
- package/esm/typings/src/cli/cli-commands/make.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/run.d.ts +2 -2
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +11 -0
- package/esm/typings/src/collection/constructors/createCollectionFromUrl.d.ts +1 -1
- package/esm/typings/src/commands/index.d.ts +1 -1
- package/esm/typings/src/config.d.ts +3 -3
- package/esm/typings/src/conversion/compilePipeline.d.ts +1 -4
- package/esm/typings/src/conversion/{precompilePipeline.d.ts → parsePipeline.d.ts} +3 -3
- package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +3 -3
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +7 -7
- package/esm/typings/src/errors/utils/getErrorReportUrl.d.ts +1 -1
- package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +9 -4
- package/esm/typings/src/formfactors/image-generator/ImageGeneratorFormfactorDefinition.d.ts +24 -0
- package/esm/typings/src/formfactors/index.d.ts +31 -9
- package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +1 -1
- package/esm/typings/src/high-level-abstractions/index.d.ts +3 -3
- package/esm/typings/src/high-level-abstractions/quick-chatbot/QuickChatbotHla.d.ts +3 -0
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/{$provideLlmToolsForCli.d.ts → $provideLlmToolsForWizzardOrCli.d.ts} +2 -2
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +1 -0
- package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +2 -0
- package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +1 -0
- package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -0
- package/esm/typings/src/llm-providers/google/register-configuration.d.ts +1 -0
- package/esm/typings/src/llm-providers/google/register-constructor.d.ts +1 -0
- package/esm/typings/src/llm-providers/openai/playground/playground.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +2 -0
- package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +2 -0
- package/esm/typings/src/llm-providers/vercel/playground/playground.d.ts +1 -1
- package/esm/typings/src/other/templates/getBookTemplates.d.ts +22 -0
- package/esm/typings/src/personas/preparePersona.d.ts +4 -4
- package/esm/typings/src/pipeline/PipelineString.d.ts +0 -3
- package/esm/typings/src/pipeline/book-notation.d.ts +14 -0
- package/esm/typings/src/pipeline/isValidPipelineString.d.ts +13 -0
- package/esm/typings/src/pipeline/isValidPipelineString.test.d.ts +4 -0
- package/esm/typings/src/pipeline/validatePipelineString.d.ts +14 -0
- package/esm/typings/src/prepare/isPipelinePrepared.d.ts +3 -1
- package/esm/typings/src/prepare/preparePipeline.d.ts +2 -0
- package/esm/typings/src/prepare/prepareTasks.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/Converter.d.ts +1 -0
- package/esm/typings/src/scrapers/_common/Scraper.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/ScraperIntermediateSource.d.ts +3 -0
- package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +2 -0
- package/esm/typings/src/scrapers/_common/utils/scraperFetch.d.ts +3 -0
- package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -0
- package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -0
- package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -0
- package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -0
- package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -0
- package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -0
- package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +1 -0
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -0
- package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +2 -1
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +3 -1
- package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -0
- package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -0
- package/esm/typings/src/scripting/javascript/JavascriptEvalExecutionTools.test.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +2 -1
- package/esm/typings/src/types/typeAliases.d.ts +8 -2
- package/esm/typings/src/utils/markdown/flattenMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/markdown/{removeContentComments.d.ts → removeMarkdownComments.d.ts} +2 -2
- package/esm/typings/src/utils/organization/$sideEffect.d.ts +9 -0
- package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +1 -1
- package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +2 -2
- package/esm/typings/src/utils/validators/filePath/isRootPath.d.ts +12 -0
- package/esm/typings/src/utils/validators/filePath/isRootPath.test.d.ts +4 -0
- package/esm/typings/src/utils/validators/filePath/isValidFilePath.d.ts +3 -0
- package/esm/typings/src/wizzard/$getCompiledBook.d.ts +16 -0
- package/esm/typings/src/wizzard/wizzard.d.ts +51 -7
- package/package.json +2 -2
- package/umd/index.umd.js +182 -91
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/other/templates/getBookTemplate.d.ts +0 -21
- package/esm/typings/src/scripting/javascript/utils/unknownToString.d.ts +0 -8
- /package/esm/typings/src/conversion/{precompilePipeline.test.d.ts → parsePipeline.test.d.ts} +0 -0
- /package/esm/typings/src/utils/markdown/{removeContentComments.test.d.ts → removeMarkdownComments.test.d.ts} +0 -0
package/esm/index.es.js
CHANGED
|
@@ -22,7 +22,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
22
22
|
* @generated
|
|
23
23
|
* @see https://github.com/webgptorg/promptbook
|
|
24
24
|
*/
|
|
25
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.81.0-
|
|
25
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.81.0-24';
|
|
26
26
|
/**
|
|
27
27
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
28
28
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -176,7 +176,67 @@ var NotYetImplementedError = /** @class */ (function (_super) {
|
|
|
176
176
|
function TODO_USE() {
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book.md`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book.md`\n- INPUT PARAMETER `{availableModelNames}` List of available model names separated by comma (,)\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n\\`\\`\\`json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelRequirements}`\n"}],sourceFile:"./books/prepare-persona.book.md"}];
|
|
179
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book.md`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book.md`\n- INPUT PARAMETER `{availableModelNames}` List of available model names separated by comma (,)\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n\\`\\`\\`json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelRequirements}`\n"}],sourceFile:"./books/prepare-persona.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book.md",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book.md`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book.md"}];
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
183
|
+
*
|
|
184
|
+
* @public exported from `@promptbook/utils`
|
|
185
|
+
*/
|
|
186
|
+
function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
187
|
+
try {
|
|
188
|
+
JSON.parse(value);
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
if (!(error instanceof Error)) {
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
if (error.message.includes('Unexpected token')) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
204
|
+
*
|
|
205
|
+
* @public exported from `@promptbook/core`
|
|
206
|
+
*/
|
|
207
|
+
var ParseError = /** @class */ (function (_super) {
|
|
208
|
+
__extends(ParseError, _super);
|
|
209
|
+
function ParseError(message) {
|
|
210
|
+
var _this = _super.call(this, message) || this;
|
|
211
|
+
_this.name = 'ParseError';
|
|
212
|
+
Object.setPrototypeOf(_this, ParseError.prototype);
|
|
213
|
+
return _this;
|
|
214
|
+
}
|
|
215
|
+
return ParseError;
|
|
216
|
+
}(Error));
|
|
217
|
+
/**
|
|
218
|
+
* TODO: Maybe split `ParseError` and `ApplyError`
|
|
219
|
+
*/
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Function `validatePipelineString` will validate the if the string is a valid pipeline string
|
|
223
|
+
* It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
|
|
224
|
+
*
|
|
225
|
+
* @param {string} pipelineString the candidate for a pipeline string
|
|
226
|
+
* @returns {PipelineString} the same string as input, but validated as valid
|
|
227
|
+
* @throws {ParseError} if the string is not a valid pipeline string
|
|
228
|
+
* @public exported from `@promptbook/core`
|
|
229
|
+
*/
|
|
230
|
+
function validatePipelineString(pipelineString) {
|
|
231
|
+
if (isValidJsonString(pipelineString)) {
|
|
232
|
+
throw new ParseError('Expected a book, but got a JSON string');
|
|
233
|
+
}
|
|
234
|
+
// <- TODO: Implement the validation + add tests when the pipeline logic considered as invalid
|
|
235
|
+
return pipelineString;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* TODO: [🧠][🈴] Where is the best location for this file
|
|
239
|
+
*/
|
|
180
240
|
|
|
181
241
|
/**
|
|
182
242
|
* Prettify the html code
|
|
@@ -244,7 +304,7 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
244
304
|
if (bookVersion !== "undefined") {
|
|
245
305
|
commands.push("BOOK VERSION ".concat(bookVersion));
|
|
246
306
|
}
|
|
247
|
-
// TODO: [main]
|
|
307
|
+
// TODO: [main] !!5 This increases size of the bundle and is probbably not necessary
|
|
248
308
|
pipelineString = prettifyMarkdown(pipelineString);
|
|
249
309
|
try {
|
|
250
310
|
for (var _g = __values(parameters.filter(function (_a) {
|
|
@@ -392,12 +452,12 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
392
452
|
pipelineString += '```' + contentLanguage;
|
|
393
453
|
pipelineString += '\n';
|
|
394
454
|
pipelineString += spaceTrim$1(content);
|
|
395
|
-
// <- TODO: [main]
|
|
455
|
+
// <- TODO: [main] !!3 Escape
|
|
396
456
|
// <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
|
|
397
457
|
pipelineString += '\n';
|
|
398
458
|
pipelineString += '```';
|
|
399
459
|
pipelineString += '\n\n';
|
|
400
|
-
pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main]
|
|
460
|
+
pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!3 If the parameter here has description, add it and use taskParameterJsonToString
|
|
401
461
|
}
|
|
402
462
|
}
|
|
403
463
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
@@ -407,7 +467,7 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
407
467
|
}
|
|
408
468
|
finally { if (e_3) throw e_3.error; }
|
|
409
469
|
}
|
|
410
|
-
return pipelineString;
|
|
470
|
+
return validatePipelineString(pipelineString);
|
|
411
471
|
}
|
|
412
472
|
/**
|
|
413
473
|
* @private internal utility of `pipelineJsonToString`
|
|
@@ -468,6 +528,12 @@ var ADMIN_EMAIL = 'me@pavolhejny.com';
|
|
|
468
528
|
* @public exported from `@promptbook/core`
|
|
469
529
|
*/
|
|
470
530
|
var ADMIN_GITHUB_NAME = 'hejny';
|
|
531
|
+
/**
|
|
532
|
+
* When the title is not provided, the default title is used
|
|
533
|
+
*
|
|
534
|
+
* @public exported from `@promptbook/core`
|
|
535
|
+
*/
|
|
536
|
+
var DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
|
|
471
537
|
// <- TODO: [🧠] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
|
|
472
538
|
/**
|
|
473
539
|
* The maximum number of iterations for a loops
|
|
@@ -619,7 +685,7 @@ function $deepFreeze(objectValue) {
|
|
|
619
685
|
/**
|
|
620
686
|
* Make error report URL for the given error
|
|
621
687
|
*
|
|
622
|
-
* @private
|
|
688
|
+
* @private private within the repository
|
|
623
689
|
*/
|
|
624
690
|
function getErrorReportUrl(error) {
|
|
625
691
|
var report = {
|
|
@@ -740,7 +806,7 @@ function checkSerializableAsJson(options) {
|
|
|
740
806
|
if (!(error instanceof Error)) {
|
|
741
807
|
throw error;
|
|
742
808
|
}
|
|
743
|
-
throw new UnexpectedError(spaceTrim$1(function (block) { return "\n `".concat(name, "` is not serializable\n\n ").concat(block(error.
|
|
809
|
+
throw new UnexpectedError(spaceTrim$1(function (block) { return "\n `".concat(name, "` is not serializable\n\n ").concat(block(error.stack || error.message), "\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n "); }));
|
|
744
810
|
}
|
|
745
811
|
/*
|
|
746
812
|
TODO: [0] Is there some more elegant way to check circular references?
|
|
@@ -770,7 +836,7 @@ function checkSerializableAsJson(options) {
|
|
|
770
836
|
}
|
|
771
837
|
/**
|
|
772
838
|
* TODO: Can be return type more type-safe? like `asserts options.value is JsonValue`
|
|
773
|
-
* TODO: [🧠][main]
|
|
839
|
+
* TODO: [🧠][main] !!3 In-memory cache of same values to prevent multiple checks
|
|
774
840
|
* Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
|
|
775
841
|
*/
|
|
776
842
|
|
|
@@ -782,7 +848,6 @@ function checkSerializableAsJson(options) {
|
|
|
782
848
|
function deepClone(objectValue) {
|
|
783
849
|
return JSON.parse(JSON.stringify(objectValue));
|
|
784
850
|
/*
|
|
785
|
-
!!!!!!!!
|
|
786
851
|
TODO: [🧠] Is there a better implementation?
|
|
787
852
|
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
788
853
|
> for (const propertyName of propertyNames) {
|
|
@@ -894,25 +959,6 @@ var RESERVED_PARAMETER_NAMES = exportJson({
|
|
|
894
959
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
895
960
|
*/
|
|
896
961
|
|
|
897
|
-
/**
|
|
898
|
-
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
899
|
-
*
|
|
900
|
-
* @public exported from `@promptbook/core`
|
|
901
|
-
*/
|
|
902
|
-
var ParseError = /** @class */ (function (_super) {
|
|
903
|
-
__extends(ParseError, _super);
|
|
904
|
-
function ParseError(message) {
|
|
905
|
-
var _this = _super.call(this, message) || this;
|
|
906
|
-
_this.name = 'ParseError';
|
|
907
|
-
Object.setPrototypeOf(_this, ParseError.prototype);
|
|
908
|
-
return _this;
|
|
909
|
-
}
|
|
910
|
-
return ParseError;
|
|
911
|
-
}(Error));
|
|
912
|
-
/**
|
|
913
|
-
* TODO: Maybe split `ParseError` and `ApplyError`
|
|
914
|
-
*/
|
|
915
|
-
|
|
916
962
|
/**
|
|
917
963
|
* This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
|
|
918
964
|
*
|
|
@@ -967,7 +1013,7 @@ function isValidPromptbookVersion(version) {
|
|
|
967
1013
|
if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
|
|
968
1014
|
return false;
|
|
969
1015
|
}
|
|
970
|
-
// <- TODO: [main]
|
|
1016
|
+
// <- TODO: [main] !!3 Check isValidPromptbookVersion against PROMPTBOOK_ENGINE_VERSIONS
|
|
971
1017
|
return true;
|
|
972
1018
|
}
|
|
973
1019
|
|
|
@@ -1067,9 +1113,6 @@ function isValidPipelineUrl(url) {
|
|
|
1067
1113
|
if (!url.startsWith('https://')) {
|
|
1068
1114
|
return false;
|
|
1069
1115
|
}
|
|
1070
|
-
if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.book.md') || url.endsWith('.ptbk'))) {
|
|
1071
|
-
return false;
|
|
1072
|
-
}
|
|
1073
1116
|
if (url.includes('#')) {
|
|
1074
1117
|
// TODO: [🐠]
|
|
1075
1118
|
return false;
|
|
@@ -1100,11 +1143,11 @@ function isValidPipelineUrl(url) {
|
|
|
1100
1143
|
*/
|
|
1101
1144
|
function validatePipeline(pipeline) {
|
|
1102
1145
|
if (IS_PIPELINE_LOGIC_VALIDATED) {
|
|
1103
|
-
|
|
1146
|
+
validatePipeline_InnerFunction(pipeline);
|
|
1104
1147
|
}
|
|
1105
1148
|
else {
|
|
1106
1149
|
try {
|
|
1107
|
-
|
|
1150
|
+
validatePipeline_InnerFunction(pipeline);
|
|
1108
1151
|
}
|
|
1109
1152
|
catch (error) {
|
|
1110
1153
|
if (!(error instanceof PipelineLogicError)) {
|
|
@@ -1118,7 +1161,7 @@ function validatePipeline(pipeline) {
|
|
|
1118
1161
|
/**
|
|
1119
1162
|
* @private internal function for `validatePipeline`
|
|
1120
1163
|
*/
|
|
1121
|
-
function
|
|
1164
|
+
function validatePipeline_InnerFunction(pipeline) {
|
|
1122
1165
|
// TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
|
|
1123
1166
|
var e_1, _a, e_2, _b, e_3, _c;
|
|
1124
1167
|
var pipelineIdentification = (function () {
|
|
@@ -1342,11 +1385,11 @@ function validatePipelineCore(pipeline) {
|
|
|
1342
1385
|
_loop_3();
|
|
1343
1386
|
}
|
|
1344
1387
|
// Note: Check that formfactor is corresponding to the pipeline interface
|
|
1345
|
-
// TODO:
|
|
1388
|
+
// TODO: !!6 Implement this
|
|
1346
1389
|
// pipeline.formfactorName
|
|
1347
1390
|
}
|
|
1348
1391
|
/**
|
|
1349
|
-
* TODO:
|
|
1392
|
+
* TODO: [🧞♀️] Do not allow joker + foreach
|
|
1350
1393
|
* TODO: [🧠] Work with promptbookVersion
|
|
1351
1394
|
* TODO: Use here some json-schema, Zod or something similar and change it to:
|
|
1352
1395
|
* > /**
|
|
@@ -1358,11 +1401,11 @@ function validatePipelineCore(pipeline) {
|
|
|
1358
1401
|
* > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
|
|
1359
1402
|
*/
|
|
1360
1403
|
/**
|
|
1361
|
-
* TODO: [🧳][main]
|
|
1362
|
-
* TODO: [🧳][🐝][main]
|
|
1363
|
-
* TODO: [🧳][main]
|
|
1364
|
-
* TODO: [🧳][main]
|
|
1365
|
-
* TODO: [🧳][main]
|
|
1404
|
+
* TODO: [🧳][main] !!4 Validate that all examples match expectations
|
|
1405
|
+
* TODO: [🧳][🐝][main] !!4 Validate that knowledge is valid (non-void)
|
|
1406
|
+
* TODO: [🧳][main] !!4 Validate that persona can be used only with CHAT variant
|
|
1407
|
+
* TODO: [🧳][main] !!4 Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
|
|
1408
|
+
* TODO: [🧳][main] !!4 Validate that reserved parameter is not used as joker
|
|
1366
1409
|
* TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
|
|
1367
1410
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
1368
1411
|
*/
|
|
@@ -1498,7 +1541,7 @@ var SimplePipelineCollection = /** @class */ (function () {
|
|
|
1498
1541
|
pipelineJsonToString(unpreparePipeline(pipeline)) !==
|
|
1499
1542
|
pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
|
|
1500
1543
|
var existing = this.collection.get(pipeline.pipelineUrl);
|
|
1501
|
-
throw new PipelineUrlError(spaceTrim("\n Pipeline with URL
|
|
1544
|
+
throw new PipelineUrlError(spaceTrim("\n Pipeline with URL ".concat(pipeline.pipelineUrl, " is already in the collection \uD83C\uDF4E\n\n Conflicting files:\n ").concat(existing.sourceFile || 'Unknown', "\n ").concat(pipeline.sourceFile || 'Unknown', "\n\n Note: You have probably forgotten to run \"ptbk make\" to update the collection\n Note: Pipelines with the same URL are not allowed\n Only exepction is when the pipelines are identical\n\n ")));
|
|
1502
1545
|
}
|
|
1503
1546
|
// Note: [🧠] Overwrite existing pipeline with the same URL
|
|
1504
1547
|
this.collection.set(pipeline.pipelineUrl, pipeline);
|
|
@@ -1818,11 +1861,16 @@ function assertsExecutionSuccessful(executionResult) {
|
|
|
1818
1861
|
/**
|
|
1819
1862
|
* Determine if the pipeline is fully prepared
|
|
1820
1863
|
*
|
|
1864
|
+
* @see https://github.com/webgptorg/promptbook/discussions/196
|
|
1865
|
+
*
|
|
1821
1866
|
* @public exported from `@promptbook/core`
|
|
1822
1867
|
*/
|
|
1823
1868
|
function isPipelinePrepared(pipeline) {
|
|
1824
1869
|
// Note: Ignoring `pipeline.preparations` @@@
|
|
1825
1870
|
// Note: Ignoring `pipeline.knowledgePieces` @@@
|
|
1871
|
+
if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
|
|
1872
|
+
return false;
|
|
1873
|
+
}
|
|
1826
1874
|
if (!pipeline.personas.every(function (persona) { return persona.modelRequirements !== undefined; })) {
|
|
1827
1875
|
return false;
|
|
1828
1876
|
}
|
|
@@ -1838,7 +1886,7 @@ function isPipelinePrepared(pipeline) {
|
|
|
1838
1886
|
return true;
|
|
1839
1887
|
}
|
|
1840
1888
|
/**
|
|
1841
|
-
* TODO: [🔃][main]
|
|
1889
|
+
* TODO: [🔃][main] If the pipeline was prepared with different version or different set of models, prepare it once again
|
|
1842
1890
|
* TODO: [🐠] Maybe base this on `makeValidator`
|
|
1843
1891
|
* TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
|
|
1844
1892
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
@@ -2603,10 +2651,10 @@ function preparePersona(personaDescription, tools, options) {
|
|
|
2603
2651
|
});
|
|
2604
2652
|
}
|
|
2605
2653
|
/**
|
|
2606
|
-
* TODO: [🔃][main]
|
|
2607
|
-
* TODO: [🏢]
|
|
2608
|
-
* TODO: [🏢]
|
|
2609
|
-
* TODO: [🏢]
|
|
2654
|
+
* TODO: [🔃][main] If the persona was prepared with different version or different set of models, prepare it once again
|
|
2655
|
+
* TODO: [🏢] Check validity of `modelName` in pipeline
|
|
2656
|
+
* TODO: [🏢] Check validity of `systemMessage` in pipeline
|
|
2657
|
+
* TODO: [🏢] Check validity of `temperature` in pipeline
|
|
2610
2658
|
*/
|
|
2611
2659
|
|
|
2612
2660
|
/**
|
|
@@ -3301,21 +3349,44 @@ function isValidFilePath(filename) {
|
|
|
3301
3349
|
if (typeof filename !== 'string') {
|
|
3302
3350
|
return false;
|
|
3303
3351
|
}
|
|
3352
|
+
if (filename.split('\n').length > 1) {
|
|
3353
|
+
return false;
|
|
3354
|
+
}
|
|
3355
|
+
if (filename.split(' ').length >
|
|
3356
|
+
5 /* <- TODO: [🧠][🈷] Make some better non-arbitrary way how to distinct filenames from informational texts */) {
|
|
3357
|
+
return false;
|
|
3358
|
+
}
|
|
3304
3359
|
var filenameSlashes = filename.split('\\').join('/');
|
|
3305
3360
|
// Absolute Unix path: /hello.txt
|
|
3306
3361
|
if (/^(\/)/i.test(filenameSlashes)) {
|
|
3362
|
+
// console.log(filename, 'Absolute Unix path: /hello.txt');
|
|
3307
3363
|
return true;
|
|
3308
3364
|
}
|
|
3309
3365
|
// Absolute Windows path: /hello.txt
|
|
3310
3366
|
if (/^([A-Z]{1,2}:\/?)\//i.test(filenameSlashes)) {
|
|
3367
|
+
// console.log(filename, 'Absolute Windows path: /hello.txt');
|
|
3311
3368
|
return true;
|
|
3312
3369
|
}
|
|
3313
3370
|
// Relative path: ./hello.txt
|
|
3314
3371
|
if (/^(\.\.?\/)+/i.test(filenameSlashes)) {
|
|
3372
|
+
// console.log(filename, 'Relative path: ./hello.txt');
|
|
3373
|
+
return true;
|
|
3374
|
+
}
|
|
3375
|
+
// Allow paths like foo/hello
|
|
3376
|
+
if (/^[^/]+\/[^/]+/i.test(filenameSlashes)) {
|
|
3377
|
+
// console.log(filename, 'Allow paths like foo/hello');
|
|
3378
|
+
return true;
|
|
3379
|
+
}
|
|
3380
|
+
// Allow paths like hello.book
|
|
3381
|
+
if (/^[^/]+\.[^/]+$/i.test(filenameSlashes)) {
|
|
3382
|
+
// console.log(filename, 'Allow paths like hello.book');
|
|
3315
3383
|
return true;
|
|
3316
3384
|
}
|
|
3317
3385
|
return false;
|
|
3318
3386
|
}
|
|
3387
|
+
/**
|
|
3388
|
+
* TODO: [🍏] Implement for MacOs
|
|
3389
|
+
*/
|
|
3319
3390
|
|
|
3320
3391
|
/**
|
|
3321
3392
|
* The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
|
|
@@ -3340,6 +3411,9 @@ var scraperFetch = function (url, init) { return __awaiter(void 0, void 0, void
|
|
|
3340
3411
|
}
|
|
3341
3412
|
});
|
|
3342
3413
|
}); };
|
|
3414
|
+
/**
|
|
3415
|
+
* TODO: [🧠] Maybe rename because it is not used only for scrapers but also in `$getCompiledBook`
|
|
3416
|
+
*/
|
|
3343
3417
|
|
|
3344
3418
|
/**
|
|
3345
3419
|
* @@@
|
|
@@ -3407,7 +3481,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
3407
3481
|
},
|
|
3408
3482
|
}];
|
|
3409
3483
|
case 2:
|
|
3410
|
-
if (!
|
|
3484
|
+
if (!isValidFilePath(sourceContent)) return [3 /*break*/, 4];
|
|
3411
3485
|
if (tools.fs === undefined) {
|
|
3412
3486
|
throw new EnvironmentMismatchError('Can not import file knowledge without filesystem tools');
|
|
3413
3487
|
// <- TODO: [🧠] What is the best error type here`
|
|
@@ -3422,7 +3496,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
3422
3496
|
return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
|
|
3423
3497
|
case 3:
|
|
3424
3498
|
if (!(_f.sent())) {
|
|
3425
|
-
throw new NotFoundError(spaceTrim$1(function (block) { return "\n Can not make source handler for file which does not exist:\n\n File:\n ".concat(block(filename_1), "\n "); }));
|
|
3499
|
+
throw new NotFoundError(spaceTrim$1(function (block) { return "\n Can not make source handler for file which does not exist:\n\n File:\n ".concat(block(sourceContent), "\n\n Full file path:\n ").concat(block(filename_1), "\n "); }));
|
|
3426
3500
|
}
|
|
3427
3501
|
// TODO: [🧠][😿] Test security file - file is scoped to the project (BUT maybe do this in `filesystemTools`)
|
|
3428
3502
|
return [2 /*return*/, {
|
|
@@ -3535,7 +3609,7 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
3535
3609
|
partialPieces = __spreadArray([], __read(partialPiecesUnchecked), false);
|
|
3536
3610
|
return [2 /*return*/, "break"];
|
|
3537
3611
|
}
|
|
3538
|
-
console.warn(spaceTrim$1(function (block) { return "\n Cannot scrape knowledge from source despite the scraper `".concat(scraper.metadata.className, "` supports the mime type \"").concat(sourceHandler.mimeType, "\".\n
|
|
3612
|
+
console.warn(spaceTrim$1(function (block) { return "\n Cannot scrape knowledge from source despite the scraper `".concat(scraper.metadata.className, "` supports the mime type \"").concat(sourceHandler.mimeType, "\".\n\n The source:\n ").concat(block(knowledgeSource.sourceContent
|
|
3539
3613
|
.split('\n')
|
|
3540
3614
|
.map(function (line) { return "> ".concat(line); })
|
|
3541
3615
|
.join('\n')), "\n\n ").concat(block($registeredScrapersMessage(scrapers)), "\n\n\n "); }));
|
|
@@ -3573,7 +3647,7 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
3573
3647
|
return [7 /*endfinally*/];
|
|
3574
3648
|
case 9:
|
|
3575
3649
|
if (partialPieces === null) {
|
|
3576
|
-
throw new KnowledgeScrapeError(spaceTrim$1(function (block) { return "\n Cannot scrape knowledge\n
|
|
3650
|
+
throw new KnowledgeScrapeError(spaceTrim$1(function (block) { return "\n Cannot scrape knowledge\n\n The source:\n > ".concat(block(knowledgeSource.sourceContent
|
|
3577
3651
|
.split('\n')
|
|
3578
3652
|
.map(function (line) { return "> ".concat(line); })
|
|
3579
3653
|
.join('\n')), "\n\n No scraper found for the mime type \"").concat(sourceHandler.mimeType, "\"\n\n ").concat(block($registeredScrapersMessage(scrapers)), "\n\n\n "); }));
|
|
@@ -3664,7 +3738,7 @@ function prepareTasks(pipeline, tools, options) {
|
|
|
3664
3738
|
* TODO: [😂] Adding knowledge should be convert to async high-level abstractions, simmilar thing with expectations to sync high-level abstractions
|
|
3665
3739
|
* TODO: [🧠] Add context to each task (if missing)
|
|
3666
3740
|
* TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
|
|
3667
|
-
* TODO: [♨][main]
|
|
3741
|
+
* TODO: [♨][main] !!3 Prepare index the examples and maybe tasks
|
|
3668
3742
|
* TODO: Write tests for `preparePipeline`
|
|
3669
3743
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
3670
3744
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
@@ -3674,6 +3748,8 @@ function prepareTasks(pipeline, tools, options) {
|
|
|
3674
3748
|
/**
|
|
3675
3749
|
* Prepare pipeline from string (markdown) format to JSON format
|
|
3676
3750
|
*
|
|
3751
|
+
* @see https://github.com/webgptorg/promptbook/discussions/196
|
|
3752
|
+
*
|
|
3677
3753
|
* Note: This function does not validate logic of the pipeline
|
|
3678
3754
|
* Note: This function acts as part of compilation process
|
|
3679
3755
|
* Note: When the pipeline is already prepared, it returns the same pipeline
|
|
@@ -3686,16 +3762,17 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
3686
3762
|
<- TODO: [🧠][🪑] `promptbookVersion` */
|
|
3687
3763
|
knowledgeSources /*
|
|
3688
3764
|
<- TODO: [🧊] `knowledgePieces` */, personas /*
|
|
3689
|
-
<- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, tasksPrepared /* TODO: parameters: parametersPrepared*/;
|
|
3765
|
+
<- TODO: [🧊] `preparations` */, sources, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, title, collection, prepareTitleExecutor, _c, result, outputParameters, titleRaw, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, tasksPrepared /* TODO: parameters: parametersPrepared*/;
|
|
3766
|
+
var _d;
|
|
3690
3767
|
var _this = this;
|
|
3691
|
-
return __generator(this, function (
|
|
3692
|
-
switch (
|
|
3768
|
+
return __generator(this, function (_e) {
|
|
3769
|
+
switch (_e.label) {
|
|
3693
3770
|
case 0:
|
|
3694
3771
|
if (isPipelinePrepared(pipeline)) {
|
|
3695
3772
|
return [2 /*return*/, pipeline];
|
|
3696
3773
|
}
|
|
3697
3774
|
rootDirname = options.rootDirname, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a, _b = options.isVerbose, isVerbose = _b === void 0 ? DEFAULT_IS_VERBOSE : _b;
|
|
3698
|
-
parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
|
|
3775
|
+
parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas, sources = pipeline.sources;
|
|
3699
3776
|
if (tools === undefined || tools.llm === undefined) {
|
|
3700
3777
|
throw new MissingToolsError('LLM tools are required for preparing the pipeline');
|
|
3701
3778
|
}
|
|
@@ -3713,6 +3790,33 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
3713
3790
|
// <- TODO: [🧊]
|
|
3714
3791
|
currentPreparation,
|
|
3715
3792
|
];
|
|
3793
|
+
title = pipeline.title;
|
|
3794
|
+
if (!(title === undefined || title === '' || title === DEFAULT_BOOK_TITLE)) return [3 /*break*/, 3];
|
|
3795
|
+
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
3796
|
+
_c = createPipelineExecutor;
|
|
3797
|
+
_d = {};
|
|
3798
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book.md')];
|
|
3799
|
+
case 1:
|
|
3800
|
+
prepareTitleExecutor = _c.apply(void 0, [(_d.pipeline = _e.sent(),
|
|
3801
|
+
_d.tools = tools,
|
|
3802
|
+
_d)]);
|
|
3803
|
+
return [4 /*yield*/, prepareTitleExecutor({
|
|
3804
|
+
book: sources.map(function (_a) {
|
|
3805
|
+
var content = _a.content;
|
|
3806
|
+
return content;
|
|
3807
|
+
}).join('\n\n'),
|
|
3808
|
+
})];
|
|
3809
|
+
case 2:
|
|
3810
|
+
result = _e.sent();
|
|
3811
|
+
assertsExecutionSuccessful(result);
|
|
3812
|
+
outputParameters = result.outputParameters;
|
|
3813
|
+
titleRaw = outputParameters.title;
|
|
3814
|
+
if (isVerbose) {
|
|
3815
|
+
console.info("The title is \"".concat(titleRaw, "\""));
|
|
3816
|
+
}
|
|
3817
|
+
title = titleRaw || DEFAULT_BOOK_TITLE;
|
|
3818
|
+
_e.label = 3;
|
|
3819
|
+
case 3:
|
|
3716
3820
|
preparedPersonas = new Array(personas.length);
|
|
3717
3821
|
return [4 /*yield*/, forEachAsync(personas, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (persona, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
3718
3822
|
var modelRequirements, preparedPersona;
|
|
@@ -3731,12 +3835,12 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
3731
3835
|
}
|
|
3732
3836
|
});
|
|
3733
3837
|
}); })];
|
|
3734
|
-
case
|
|
3735
|
-
|
|
3838
|
+
case 4:
|
|
3839
|
+
_e.sent();
|
|
3736
3840
|
knowledgeSourcesPrepared = knowledgeSources.map(function (source) { return (__assign(__assign({}, source), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
|
|
3737
3841
|
return [4 /*yield*/, prepareKnowledgePieces(knowledgeSources /* <- TODO: [🧊] {knowledgeSources, knowledgePieces} */, __assign(__assign({}, tools), { llm: llmToolsWithUsage }), __assign(__assign({}, options), { rootDirname: rootDirname, maxParallelCount: maxParallelCount /* <- TODO: [🪂] */, isVerbose: isVerbose }))];
|
|
3738
|
-
case
|
|
3739
|
-
partialknowledgePiecesPrepared =
|
|
3842
|
+
case 5:
|
|
3843
|
+
partialknowledgePiecesPrepared = _e.sent();
|
|
3740
3844
|
knowledgePiecesPrepared = partialknowledgePiecesPrepared.map(function (piece) { return (__assign(__assign({}, piece), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
|
|
3741
3845
|
return [4 /*yield*/, prepareTasks({
|
|
3742
3846
|
parameters: parameters,
|
|
@@ -3747,8 +3851,8 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
3747
3851
|
maxParallelCount: maxParallelCount /* <- TODO: [🪂] */,
|
|
3748
3852
|
isVerbose: isVerbose,
|
|
3749
3853
|
})];
|
|
3750
|
-
case
|
|
3751
|
-
tasksPrepared = (
|
|
3854
|
+
case 6:
|
|
3855
|
+
tasksPrepared = (_e.sent()).tasksPrepared;
|
|
3752
3856
|
// ----- /Tasks preparation -----
|
|
3753
3857
|
// TODO: [😂] Use here all `AsyncHighLevelAbstraction`
|
|
3754
3858
|
// Note: Count total usage
|
|
@@ -3759,7 +3863,7 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
3759
3863
|
order: ORDER_OF_PIPELINE_JSON,
|
|
3760
3864
|
value: __assign(__assign({}, pipeline), {
|
|
3761
3865
|
// <- TODO: Probbably deeply clone the pipeline because `$exportJson` freezes the subobjects
|
|
3762
|
-
knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, tasks: __spreadArray([], __read(tasksPrepared), false),
|
|
3866
|
+
title: title, knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, tasks: __spreadArray([], __read(tasksPrepared), false),
|
|
3763
3867
|
// <- TODO: [🪓] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
|
|
3764
3868
|
personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }),
|
|
3765
3869
|
})];
|
|
@@ -3830,7 +3934,7 @@ function extractVariablesFromScript(script) {
|
|
|
3830
3934
|
if (!(error instanceof Error)) {
|
|
3831
3935
|
throw error;
|
|
3832
3936
|
}
|
|
3833
|
-
throw new ParseError(spaceTrim(function (block) { return "\n Can not extract variables from the script\n
|
|
3937
|
+
throw new ParseError(spaceTrim(function (block) { return "\n Can not extract variables from the script\n ".concat(block(error.stack || error.message), "\n\n Found variables:\n ").concat(Array.from(variables)
|
|
3834
3938
|
.map(function (variableName, i) { return "".concat(i + 1, ") ").concat(variableName); })
|
|
3835
3939
|
.join('\n'), "\n\n\n The script:\n\n ```javascript\n ").concat(block(originalScript), "\n ```\n "); }));
|
|
3836
3940
|
}
|
|
@@ -4110,27 +4214,6 @@ var CsvFormatDefinition = {
|
|
|
4110
4214
|
* TODO: [🏢] Allow to expect something inside CSV objects and other formats
|
|
4111
4215
|
*/
|
|
4112
4216
|
|
|
4113
|
-
/**
|
|
4114
|
-
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
4115
|
-
*
|
|
4116
|
-
* @public exported from `@promptbook/utils`
|
|
4117
|
-
*/
|
|
4118
|
-
function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
4119
|
-
try {
|
|
4120
|
-
JSON.parse(value);
|
|
4121
|
-
return true;
|
|
4122
|
-
}
|
|
4123
|
-
catch (error) {
|
|
4124
|
-
if (!(error instanceof Error)) {
|
|
4125
|
-
throw error;
|
|
4126
|
-
}
|
|
4127
|
-
if (error.message.includes('Unexpected token')) {
|
|
4128
|
-
return false;
|
|
4129
|
-
}
|
|
4130
|
-
return false;
|
|
4131
|
-
}
|
|
4132
|
-
}
|
|
4133
|
-
|
|
4134
4217
|
/**
|
|
4135
4218
|
* Definition for JSON format
|
|
4136
4219
|
*
|
|
@@ -4505,6 +4588,8 @@ function templateParameters(template, parameters) {
|
|
|
4505
4588
|
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
4506
4589
|
}
|
|
4507
4590
|
parameterValue = valueToString(parameterValue);
|
|
4591
|
+
// Escape curly braces in parameter values to prevent prompt-injection
|
|
4592
|
+
parameterValue = parameterValue.replace(/[{}]/g, '\\$&');
|
|
4508
4593
|
if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
|
|
4509
4594
|
parameterValue = parameterValue
|
|
4510
4595
|
.split('\n')
|
|
@@ -4864,7 +4949,7 @@ function executeAttempts(options) {
|
|
|
4864
4949
|
promptTitle: task.title,
|
|
4865
4950
|
promptMessage: templateParameters(task.description || '', parameters),
|
|
4866
4951
|
defaultValue: templateParameters(preparedContent, parameters),
|
|
4867
|
-
// TODO: [🧠]
|
|
4952
|
+
// TODO: [🧠] Figure out how to define placeholder in .book.md file
|
|
4868
4953
|
placeholder: undefined,
|
|
4869
4954
|
priority: priority,
|
|
4870
4955
|
}))];
|
|
@@ -5854,6 +5939,7 @@ var markdownScraperMetadata = $deepFreeze({
|
|
|
5854
5939
|
mimeTypes: ['text/markdown', 'text/plain'],
|
|
5855
5940
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
5856
5941
|
isAvilableInBrowser: true,
|
|
5942
|
+
// <- 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
|
|
5857
5943
|
requiredExecutables: [],
|
|
5858
5944
|
}); /* <- Note: [🤛] */
|
|
5859
5945
|
/**
|
|
@@ -5862,6 +5948,7 @@ var markdownScraperMetadata = $deepFreeze({
|
|
|
5862
5948
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
5863
5949
|
*
|
|
5864
5950
|
* @public exported from `@promptbook/core`
|
|
5951
|
+
* @public exported from `@promptbook/wizzard`
|
|
5865
5952
|
* @public exported from `@promptbook/cli`
|
|
5866
5953
|
*/
|
|
5867
5954
|
$scrapersMetadataRegister.register(markdownScraperMetadata);
|
|
@@ -5947,12 +6034,12 @@ var MarkdownScraper = /** @class */ (function () {
|
|
|
5947
6034
|
outputParameters = result.outputParameters;
|
|
5948
6035
|
knowledgePiecesRaw = outputParameters.knowledgePieces;
|
|
5949
6036
|
knowledgeTextPieces = (knowledgePiecesRaw || '').split('\n---\n');
|
|
5950
|
-
// <- TODO: [main]
|
|
6037
|
+
// <- TODO: [main] Smarter split and filter out empty pieces
|
|
5951
6038
|
if (isVerbose) {
|
|
5952
6039
|
console.info('knowledgeTextPieces:', knowledgeTextPieces);
|
|
5953
6040
|
}
|
|
5954
6041
|
return [4 /*yield*/, Promise.all(
|
|
5955
|
-
// TODO: [🪂]
|
|
6042
|
+
// TODO: [🪂] Do not send all at once but in chunks
|
|
5956
6043
|
knowledgeTextPieces.map(function (knowledgeTextPiece, i) { return __awaiter(_this, void 0, void 0, function () {
|
|
5957
6044
|
var name, title, knowledgePieceContent, keywords, index, titleResult, _a, titleRaw, keywordsResult, _b, keywordsRaw, embeddingResult, error_1;
|
|
5958
6045
|
return __generator(this, function (_c) {
|
|
@@ -6050,7 +6137,8 @@ var pdfScraperMetadata = $deepFreeze({
|
|
|
6050
6137
|
className: 'PdfScraper',
|
|
6051
6138
|
mimeTypes: ['application/pdf'],
|
|
6052
6139
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
6053
|
-
isAvilableInBrowser:
|
|
6140
|
+
isAvilableInBrowser: false,
|
|
6141
|
+
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
6054
6142
|
requiredExecutables: [],
|
|
6055
6143
|
}); /* <- Note: [🤛] */
|
|
6056
6144
|
/**
|
|
@@ -6059,6 +6147,7 @@ var pdfScraperMetadata = $deepFreeze({
|
|
|
6059
6147
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6060
6148
|
*
|
|
6061
6149
|
* @public exported from `@promptbook/core`
|
|
6150
|
+
* @public exported from `@promptbook/wizzard`
|
|
6062
6151
|
* @public exported from `@promptbook/cli`
|
|
6063
6152
|
*/
|
|
6064
6153
|
$scrapersMetadataRegister.register(pdfScraperMetadata);
|
|
@@ -6123,6 +6212,7 @@ var PdfScraper = /** @class */ (function () {
|
|
|
6123
6212
|
* TODO: [👣] Converted pdf documents can act as cached items - there is no need to run conversion each time
|
|
6124
6213
|
* TODO: [🪂] Do it in parallel 11:11
|
|
6125
6214
|
* Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
6215
|
+
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
6126
6216
|
*/
|
|
6127
6217
|
|
|
6128
6218
|
/**
|
|
@@ -6143,6 +6233,7 @@ var createPdfScraper = Object.assign(function (tools, options) {
|
|
|
6143
6233
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
6144
6234
|
*
|
|
6145
6235
|
* @public exported from `@promptbook/pdf`
|
|
6236
|
+
* @public exported from `@promptbook/wizzard`
|
|
6146
6237
|
* @public exported from `@promptbook/cli`
|
|
6147
6238
|
*/
|
|
6148
6239
|
var _PdfScraperRegistration = $scrapersRegister.register(createPdfScraper);
|