@promptbook/cli 0.94.0 → 0.95.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -10
- package/esm/index.es.js +100 -100
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +2 -2
- package/esm/typings/src/_packages/{wizzard.index.d.ts → wizard.index.d.ts} +2 -2
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/test-command.d.ts +1 -1
- package/esm/typings/src/conversion/archive/loadArchive.d.ts +1 -1
- package/esm/typings/src/conversion/archive/saveArchive.d.ts +2 -2
- package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +1 -1
- package/esm/typings/src/dialogs/callback/CallbackInterfaceTools.d.ts +1 -1
- package/esm/typings/src/execution/AbstractTaskResult.d.ts +2 -2
- package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +1 -1
- package/esm/typings/src/execution/execution-report/ExecutionPromptReportJson.d.ts +2 -2
- package/esm/typings/src/execution/translation/automatic-translate/translateMessages.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/{$provideLlmToolsForWizzardOrCli.d.ts → $provideLlmToolsForWizardOrCli.d.ts} +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +1 -1
- package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +1 -1
- package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -1
- package/esm/typings/src/llm-providers/deepseek/register-configuration.d.ts +1 -1
- package/esm/typings/src/llm-providers/deepseek/register-constructor.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/register-configuration.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/register-constructor.d.ts +1 -1
- package/esm/typings/src/llm-providers/ollama/register-configuration.d.ts +1 -1
- package/esm/typings/src/llm-providers/ollama/register-constructor.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +2 -2
- package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +1 -1
- package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/_boilerplate/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +1 -1
- package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/document/register-metadata.d.ts +2 -2
- package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +2 -2
- package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -4
- package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +2 -2
- package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/markitdown/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +2 -2
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +2 -2
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -1
- package/esm/typings/src/scrapers/website/register-metadata.d.ts +2 -2
- package/esm/typings/src/types/typeAliases.d.ts +1 -1
- package/esm/typings/src/utils/files/listAllFiles.d.ts +1 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/esm/typings/src/{wizzard → wizard}/$getCompiledBook.d.ts +2 -2
- package/esm/typings/src/{wizzard/wizzard.d.ts → wizard/wizard.d.ts} +6 -6
- package/package.json +1 -13
- package/umd/index.umd.js +100 -100
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -47,7 +47,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
47
47
|
* @generated
|
|
48
48
|
* @see https://github.com/webgptorg/promptbook
|
|
49
49
|
*/
|
|
50
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
50
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.95.0';
|
|
51
51
|
/**
|
|
52
52
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
53
53
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -305,11 +305,11 @@ const CLI_APP_ID = 'cli';
|
|
|
305
305
|
/*
|
|
306
306
|
TODO: [🌃]
|
|
307
307
|
/**
|
|
308
|
-
* Id of application for the
|
|
308
|
+
* Id of application for the wizard when using remote server
|
|
309
309
|
*
|
|
310
310
|
* @public exported from `@promptbook/core`
|
|
311
311
|
* /
|
|
312
|
-
ex-port const
|
|
312
|
+
ex-port const WIZARD_APP_ID: string_app_id = 'wizard';
|
|
313
313
|
*/
|
|
314
314
|
/**
|
|
315
315
|
* The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createCollectionFromDirectory`
|
|
@@ -1433,7 +1433,7 @@ function checkSerializableAsJson(options) {
|
|
|
1433
1433
|
else {
|
|
1434
1434
|
for (const [subName, subValue] of Object.entries(value)) {
|
|
1435
1435
|
if (subValue === undefined) {
|
|
1436
|
-
// Note: undefined in object is serializable - it is just
|
|
1436
|
+
// Note: undefined in object is serializable - it is just omitted
|
|
1437
1437
|
continue;
|
|
1438
1438
|
}
|
|
1439
1439
|
checkSerializableAsJson({ name: `${name}.${subName}`, value: subValue, message });
|
|
@@ -2775,12 +2775,12 @@ function cacheLlmTools(llmTools, options = {}) {
|
|
|
2775
2775
|
get title() {
|
|
2776
2776
|
return `${llmTools.title} (cached)`;
|
|
2777
2777
|
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2778
|
-
// <- TODO: [🧈][🧠] Does it make
|
|
2778
|
+
// <- TODO: [🧈][🧠] Does it make sense to suffix "(cached)"?
|
|
2779
2779
|
},
|
|
2780
2780
|
get description() {
|
|
2781
2781
|
return `${llmTools.description} (cached)`;
|
|
2782
2782
|
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2783
|
-
// <- TODO: [🧈][🧠] Does it make
|
|
2783
|
+
// <- TODO: [🧈][🧠] Does it make sense to suffix "(cached)"?
|
|
2784
2784
|
},
|
|
2785
2785
|
listModels() {
|
|
2786
2786
|
// TODO: [🧠] Should be model listing also cached?
|
|
@@ -3010,12 +3010,12 @@ function countUsage(llmTools) {
|
|
|
3010
3010
|
get title() {
|
|
3011
3011
|
return `${llmTools.title} (+usage)`;
|
|
3012
3012
|
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
3013
|
-
// <- TODO: [🧈][🧠] Does it make
|
|
3013
|
+
// <- TODO: [🧈][🧠] Does it make sense to suffix "(+usage)"?
|
|
3014
3014
|
},
|
|
3015
3015
|
get description() {
|
|
3016
3016
|
return `${llmTools.description} (+usage)`;
|
|
3017
3017
|
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
3018
|
-
// <- TODO: [🧈][🧠] Does it make
|
|
3018
|
+
// <- TODO: [🧈][🧠] Does it make sense to suffix "(+usage)"?
|
|
3019
3019
|
},
|
|
3020
3020
|
checkConfiguration() {
|
|
3021
3021
|
return /* not await */ llmTools.checkConfiguration();
|
|
@@ -3274,13 +3274,13 @@ function joinLlmExecutionTools(...llmExecutionTools) {
|
|
|
3274
3274
|
|
|
3275
3275
|
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.
|
|
3276
3276
|
`);
|
|
3277
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
3277
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
3278
3278
|
console.warn(warningMessage);
|
|
3279
3279
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
3280
3280
|
/*
|
|
3281
3281
|
return {
|
|
3282
3282
|
async listModels() {
|
|
3283
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
3283
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
3284
3284
|
console.warn(
|
|
3285
3285
|
spaceTrim(
|
|
3286
3286
|
(block) => `
|
|
@@ -3432,9 +3432,9 @@ async function $provideLlmToolsFromEnv(options = {}) {
|
|
|
3432
3432
|
*
|
|
3433
3433
|
* @private within the repository - for CLI utils
|
|
3434
3434
|
*/
|
|
3435
|
-
async function $
|
|
3435
|
+
async function $provideLlmToolsForWizardOrCli(options) {
|
|
3436
3436
|
if (!$isRunningInNode()) {
|
|
3437
|
-
throw new EnvironmentMismatchError('Function `$
|
|
3437
|
+
throw new EnvironmentMismatchError('Function `$provideLlmToolsForWizardOrCli` works only in Node.js environment');
|
|
3438
3438
|
}
|
|
3439
3439
|
options = options !== null && options !== void 0 ? options : { strategy: 'BRING_YOUR_OWN_KEYS' };
|
|
3440
3440
|
const { isLoginloaded, strategy, isCacheReloaded } = options;
|
|
@@ -3468,7 +3468,7 @@ async function $provideLlmToolsForWizzardOrCli(options) {
|
|
|
3468
3468
|
llmExecutionTools = await $provideLlmToolsFromEnv();
|
|
3469
3469
|
}
|
|
3470
3470
|
else {
|
|
3471
|
-
throw new UnexpectedError(`\`$
|
|
3471
|
+
throw new UnexpectedError(`\`$provideLlmToolsForWizardOrCli\` wrong strategy "${strategy}"`);
|
|
3472
3472
|
}
|
|
3473
3473
|
return cacheLlmTools(countUsage(
|
|
3474
3474
|
// <- TODO: [🌯] We dont use countUsage at all, maybe just unwrap it
|
|
@@ -3555,7 +3555,7 @@ async function $provideLlmToolsForCli(options) {
|
|
|
3555
3555
|
if (isLoginloaded) {
|
|
3556
3556
|
throw new UnexpectedError(`\`$provideLlmToolsForCli\` isLoginloaded is not supported for strategy "BRING_YOUR_OWN_KEYS"`);
|
|
3557
3557
|
}
|
|
3558
|
-
const llm = await $
|
|
3558
|
+
const llm = await $provideLlmToolsForWizardOrCli({ strategy, ...options });
|
|
3559
3559
|
return { strategy, llm };
|
|
3560
3560
|
}
|
|
3561
3561
|
else if (strategy === 'REMOTE_SERVER') {
|
|
@@ -3564,7 +3564,7 @@ async function $provideLlmToolsForCli(options) {
|
|
|
3564
3564
|
process.exit(1);
|
|
3565
3565
|
}
|
|
3566
3566
|
const remoteServerUrl = remoteServerUrlRaw.endsWith('/') ? remoteServerUrlRaw.slice(0, -1) : remoteServerUrlRaw;
|
|
3567
|
-
const llm = await $
|
|
3567
|
+
const llm = await $provideLlmToolsForWizardOrCli({
|
|
3568
3568
|
isLoginloaded,
|
|
3569
3569
|
strategy,
|
|
3570
3570
|
appId: CLI_APP_ID,
|
|
@@ -4103,17 +4103,17 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
4103
4103
|
* Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
|
|
4104
4104
|
*/
|
|
4105
4105
|
const all = [];
|
|
4106
|
-
for (const { packageName, className, mimeTypes, documentationUrl,
|
|
4106
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersMetadataRegister.list()) {
|
|
4107
4107
|
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
4108
4108
|
continue;
|
|
4109
4109
|
}
|
|
4110
|
-
all.push({ packageName, className, mimeTypes, documentationUrl,
|
|
4110
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
4111
4111
|
}
|
|
4112
|
-
for (const { packageName, className, mimeTypes, documentationUrl,
|
|
4112
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersRegister.list()) {
|
|
4113
4113
|
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
4114
4114
|
continue;
|
|
4115
4115
|
}
|
|
4116
|
-
all.push({ packageName, className, mimeTypes, documentationUrl,
|
|
4116
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
4117
4117
|
}
|
|
4118
4118
|
for (const { metadata } of availableScrapers) {
|
|
4119
4119
|
all.push(metadata);
|
|
@@ -4125,8 +4125,8 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
4125
4125
|
const isInstalled = $scrapersRegister
|
|
4126
4126
|
.list()
|
|
4127
4127
|
.find(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
|
|
4128
|
-
const
|
|
4129
|
-
return { ...metadata, isMetadataAviailable, isInstalled,
|
|
4128
|
+
const isAvailableInTools = availableScrapers.some(({ metadata: { packageName, className } }) => metadata.packageName === packageName && metadata.className === className);
|
|
4129
|
+
return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
|
|
4130
4130
|
});
|
|
4131
4131
|
if (metadata.length === 0) {
|
|
4132
4132
|
return spaceTrim(`
|
|
@@ -4139,7 +4139,7 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
4139
4139
|
return spaceTrim((block) => `
|
|
4140
4140
|
Available scrapers are:
|
|
4141
4141
|
${block(metadata
|
|
4142
|
-
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes,
|
|
4142
|
+
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
|
|
4143
4143
|
const more = [];
|
|
4144
4144
|
// TODO: [🧠] Maybe use `documentationUrl`
|
|
4145
4145
|
if (isMetadataAviailable) {
|
|
@@ -4148,16 +4148,16 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
4148
4148
|
if (isInstalled) {
|
|
4149
4149
|
more.push(`🟩 Installed`);
|
|
4150
4150
|
} // not else
|
|
4151
|
-
if (
|
|
4151
|
+
if (isAvailableInTools) {
|
|
4152
4152
|
more.push(`🟦 Available in tools`);
|
|
4153
4153
|
} // not else
|
|
4154
4154
|
if (!isMetadataAviailable && isInstalled) {
|
|
4155
4155
|
more.push(`When no metadata registered but scraper is installed, it is an unexpected behavior`);
|
|
4156
4156
|
} // not else
|
|
4157
|
-
if (!isInstalled &&
|
|
4157
|
+
if (!isInstalled && isAvailableInTools) {
|
|
4158
4158
|
more.push(`When the scraper is not installed but available in tools, it is an unexpected compatibility behavior`);
|
|
4159
4159
|
} // not else
|
|
4160
|
-
if (!
|
|
4160
|
+
if (!isAvailableInBrowser) {
|
|
4161
4161
|
more.push(`Not usable in browser`);
|
|
4162
4162
|
}
|
|
4163
4163
|
const moreText = more.length === 0 ? '' : ` *(${more.join('; ')})*`;
|
|
@@ -4635,7 +4635,7 @@ function validatePipeline_InnerFunction(pipeline) {
|
|
|
4635
4635
|
* @param fs Filesystem tools
|
|
4636
4636
|
* @returns Pipelines loaded from the archive
|
|
4637
4637
|
*
|
|
4638
|
-
* @private utility of
|
|
4638
|
+
* @private utility of Promptbook
|
|
4639
4639
|
*/
|
|
4640
4640
|
async function loadArchive(filePath, fs) {
|
|
4641
4641
|
if (!filePath.endsWith('.bookc')) {
|
|
@@ -4657,7 +4657,7 @@ async function loadArchive(filePath, fs) {
|
|
|
4657
4657
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
4658
4658
|
*/
|
|
4659
4659
|
|
|
4660
|
-
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"}];
|
|
4660
|
+
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"}];
|
|
4661
4661
|
|
|
4662
4662
|
/**
|
|
4663
4663
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
@@ -4735,7 +4735,7 @@ function prettifyMarkdown(content) {
|
|
|
4735
4735
|
});
|
|
4736
4736
|
}
|
|
4737
4737
|
catch (error) {
|
|
4738
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
4738
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
4739
4739
|
console.error('There was an error with prettifying the markdown, using the original as the fallback', {
|
|
4740
4740
|
error,
|
|
4741
4741
|
html: content,
|
|
@@ -4983,7 +4983,7 @@ class SimplePipelineCollection {
|
|
|
4983
4983
|
|
|
4984
4984
|
Note: You have probably forgotten to run "ptbk make" to update the collection
|
|
4985
4985
|
Note: Pipelines with the same URL are not allowed
|
|
4986
|
-
Only
|
|
4986
|
+
Only exception is when the pipelines are identical
|
|
4987
4987
|
|
|
4988
4988
|
`));
|
|
4989
4989
|
}
|
|
@@ -6780,10 +6780,10 @@ function knowledgePiecesToString(knowledgePieces) {
|
|
|
6780
6780
|
*/
|
|
6781
6781
|
async function getKnowledgeForTask(options) {
|
|
6782
6782
|
const { tools, preparedPipeline, task, parameters } = options;
|
|
6783
|
-
const
|
|
6784
|
-
const
|
|
6783
|
+
const firstKnowledgePiece = preparedPipeline.knowledgePieces[0];
|
|
6784
|
+
const firstKnowledgeIndex = firstKnowledgePiece === null || firstKnowledgePiece === void 0 ? void 0 : firstKnowledgePiece.index[0];
|
|
6785
6785
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
|
|
6786
|
-
if (
|
|
6786
|
+
if (firstKnowledgePiece === undefined || firstKnowledgeIndex === undefined) {
|
|
6787
6787
|
return ''; // <- Note: Np knowledge present, return empty string
|
|
6788
6788
|
}
|
|
6789
6789
|
try {
|
|
@@ -6794,7 +6794,7 @@ async function getKnowledgeForTask(options) {
|
|
|
6794
6794
|
title: 'Knowledge Search',
|
|
6795
6795
|
modelRequirements: {
|
|
6796
6796
|
modelVariant: 'EMBEDDING',
|
|
6797
|
-
modelName:
|
|
6797
|
+
modelName: firstKnowledgeIndex.modelName,
|
|
6798
6798
|
},
|
|
6799
6799
|
content: task.content,
|
|
6800
6800
|
parameters,
|
|
@@ -6802,7 +6802,7 @@ async function getKnowledgeForTask(options) {
|
|
|
6802
6802
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
6803
6803
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
6804
6804
|
const { index } = knowledgePiece;
|
|
6805
|
-
const knowledgePieceIndex = index.find((i) => i.modelName ===
|
|
6805
|
+
const knowledgePieceIndex = index.find((i) => i.modelName === firstKnowledgeIndex.modelName);
|
|
6806
6806
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model
|
|
6807
6807
|
if (knowledgePieceIndex === undefined) {
|
|
6808
6808
|
return {
|
|
@@ -6823,8 +6823,8 @@ async function getKnowledgeForTask(options) {
|
|
|
6823
6823
|
task,
|
|
6824
6824
|
taskEmbeddingPrompt,
|
|
6825
6825
|
taskEmbeddingResult,
|
|
6826
|
-
|
|
6827
|
-
|
|
6826
|
+
firstKnowledgePiece,
|
|
6827
|
+
firstKnowledgeIndex,
|
|
6828
6828
|
knowledgePiecesWithRelevance,
|
|
6829
6829
|
knowledgePiecesSorted,
|
|
6830
6830
|
knowledgePiecesLimited,
|
|
@@ -6893,7 +6893,7 @@ async function getReservedParametersForTask(options) {
|
|
|
6893
6893
|
* @private internal utility of `createPipelineExecutor`
|
|
6894
6894
|
*/
|
|
6895
6895
|
async function executeTask(options) {
|
|
6896
|
-
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled,
|
|
6896
|
+
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
|
|
6897
6897
|
const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
6898
6898
|
// Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
|
|
6899
6899
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
@@ -6981,7 +6981,7 @@ async function executeTask(options) {
|
|
|
6981
6981
|
cacheDirname,
|
|
6982
6982
|
intermediateFilesStrategy,
|
|
6983
6983
|
isAutoInstalled,
|
|
6984
|
-
|
|
6984
|
+
isNotPreparedWarningSuppressed,
|
|
6985
6985
|
});
|
|
6986
6986
|
await onProgress({
|
|
6987
6987
|
outputParameters: {
|
|
@@ -7076,7 +7076,7 @@ async function executePipeline(options) {
|
|
|
7076
7076
|
}
|
|
7077
7077
|
return exportJson({
|
|
7078
7078
|
name: `executionReport`,
|
|
7079
|
-
message: `
|
|
7079
|
+
message: `Unsuccessful PipelineExecutorResult (with missing parameter {${parameter.name}}) PipelineExecutorResult`,
|
|
7080
7080
|
order: [],
|
|
7081
7081
|
value: {
|
|
7082
7082
|
isSuccessful: false,
|
|
@@ -7113,7 +7113,7 @@ async function executePipeline(options) {
|
|
|
7113
7113
|
return exportJson({
|
|
7114
7114
|
name: 'pipelineExecutorResult',
|
|
7115
7115
|
message: spaceTrim$1((block) => `
|
|
7116
|
-
|
|
7116
|
+
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
7117
7117
|
|
|
7118
7118
|
${block(pipelineIdentification)}
|
|
7119
7119
|
`),
|
|
@@ -7254,7 +7254,7 @@ async function executePipeline(options) {
|
|
|
7254
7254
|
}
|
|
7255
7255
|
return exportJson({
|
|
7256
7256
|
name: 'pipelineExecutorResult',
|
|
7257
|
-
message: `
|
|
7257
|
+
message: `Unsuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult`,
|
|
7258
7258
|
order: [],
|
|
7259
7259
|
value: {
|
|
7260
7260
|
isSuccessful: false,
|
|
@@ -7305,7 +7305,7 @@ async function executePipeline(options) {
|
|
|
7305
7305
|
* @public exported from `@promptbook/core`
|
|
7306
7306
|
*/
|
|
7307
7307
|
function createPipelineExecutor(options) {
|
|
7308
|
-
const { pipeline, tools, maxExecutionAttempts = DEFAULT_MAX_EXECUTION_ATTEMPTS, maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT, csvSettings = DEFAULT_CSV_SETTINGS, isVerbose = DEFAULT_IS_VERBOSE,
|
|
7308
|
+
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;
|
|
7309
7309
|
validatePipeline(pipeline);
|
|
7310
7310
|
const pipelineIdentification = (() => {
|
|
7311
7311
|
// Note: This is a 😐 implementation of [🚞]
|
|
@@ -7322,7 +7322,7 @@ function createPipelineExecutor(options) {
|
|
|
7322
7322
|
if (isPipelinePrepared(pipeline)) {
|
|
7323
7323
|
preparedPipeline = pipeline;
|
|
7324
7324
|
}
|
|
7325
|
-
else if (
|
|
7325
|
+
else if (isNotPreparedWarningSuppressed !== true) {
|
|
7326
7326
|
console.warn(spaceTrim$1((block) => `
|
|
7327
7327
|
Pipeline is not prepared
|
|
7328
7328
|
|
|
@@ -7355,7 +7355,7 @@ function createPipelineExecutor(options) {
|
|
|
7355
7355
|
maxParallelCount,
|
|
7356
7356
|
csvSettings,
|
|
7357
7357
|
isVerbose,
|
|
7358
|
-
|
|
7358
|
+
isNotPreparedWarningSuppressed,
|
|
7359
7359
|
rootDirname,
|
|
7360
7360
|
cacheDirname,
|
|
7361
7361
|
intermediateFilesStrategy,
|
|
@@ -7364,7 +7364,7 @@ function createPipelineExecutor(options) {
|
|
|
7364
7364
|
assertsError(error);
|
|
7365
7365
|
return exportJson({
|
|
7366
7366
|
name: 'pipelineExecutorResult',
|
|
7367
|
-
message: `
|
|
7367
|
+
message: `Unsuccessful PipelineExecutorResult, last catch`,
|
|
7368
7368
|
order: [],
|
|
7369
7369
|
value: {
|
|
7370
7370
|
isSuccessful: false,
|
|
@@ -7776,7 +7776,7 @@ TODO: [🧊] This is how it can look in future
|
|
|
7776
7776
|
/**
|
|
7777
7777
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
7778
7778
|
* Put `knowledgePieces` into `PrepareKnowledgeOptions`
|
|
7779
|
-
* TODO: [🪂] More than max things can run in parallel by
|
|
7779
|
+
* TODO: [🪂] More than max things can run in parallel by accident [1,[2a,2b,_],[3a,3b,_]]
|
|
7780
7780
|
* TODO: [🧠][❎] Do here proper M:N mapping
|
|
7781
7781
|
* [x] One source can make multiple pieces
|
|
7782
7782
|
* [ ] One piece can have multiple sources
|
|
@@ -8664,7 +8664,7 @@ const expectCommandParser = {
|
|
|
8664
8664
|
$taskJson.expectations[unit] = $taskJson.expectations[unit] || {};
|
|
8665
8665
|
if (command.sign === 'MINIMUM' || command.sign === 'EXACTLY') {
|
|
8666
8666
|
if ($taskJson.expectations[unit].min !== undefined) {
|
|
8667
|
-
throw new ParseError(`Already defined
|
|
8667
|
+
throw new ParseError(`Already defined minimum ${$taskJson.expectations[unit].min} ${command.unit.toLowerCase()}, now trying to redefine it to ${command.amount}`);
|
|
8668
8668
|
}
|
|
8669
8669
|
$taskJson.expectations[unit].min = command.amount;
|
|
8670
8670
|
} /* not else */
|
|
@@ -12126,7 +12126,7 @@ async function listAllFiles(path, isRecursive, fs) {
|
|
|
12126
12126
|
return fileNames;
|
|
12127
12127
|
}
|
|
12128
12128
|
/**
|
|
12129
|
-
* TODO: [😶] Unite
|
|
12129
|
+
* TODO: [😶] Unite folder listing
|
|
12130
12130
|
* Note: Not [~🟢~] because it is not directly dependent on `fs
|
|
12131
12131
|
* TODO: [🖇] What about symlinks?
|
|
12132
12132
|
*/
|
|
@@ -12273,7 +12273,7 @@ async function createCollectionFromDirectory(rootPath, tools, options) {
|
|
|
12273
12273
|
if (isCrashedOnError) {
|
|
12274
12274
|
throw new CollectionError(wrappedErrorMessage);
|
|
12275
12275
|
}
|
|
12276
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
12276
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
12277
12277
|
console.error(wrappedErrorMessage);
|
|
12278
12278
|
}
|
|
12279
12279
|
}
|
|
@@ -12340,7 +12340,7 @@ async function createCollectionFromDirectory(rootPath, tools, options) {
|
|
|
12340
12340
|
|
|
12341
12341
|
Note: You have probably forgotten to run "ptbk make" to update the collection
|
|
12342
12342
|
Note: Pipelines with the same URL are not allowed
|
|
12343
|
-
Only
|
|
12343
|
+
Only exception is when the pipelines are identical
|
|
12344
12344
|
|
|
12345
12345
|
`));
|
|
12346
12346
|
}
|
|
@@ -12364,7 +12364,7 @@ async function createCollectionFromDirectory(rootPath, tools, options) {
|
|
|
12364
12364
|
if (isCrashedOnError) {
|
|
12365
12365
|
throw new CollectionError(wrappedErrorMessage);
|
|
12366
12366
|
}
|
|
12367
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
12367
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
12368
12368
|
console.error(wrappedErrorMessage);
|
|
12369
12369
|
}
|
|
12370
12370
|
}
|
|
@@ -12387,7 +12387,7 @@ async function createCollectionFromDirectory(rootPath, tools, options) {
|
|
|
12387
12387
|
* @param books Pipelines to be saved in the archive
|
|
12388
12388
|
* @param fs Filesystem tools
|
|
12389
12389
|
*
|
|
12390
|
-
* @private utility of
|
|
12390
|
+
* @private utility of Promptbook
|
|
12391
12391
|
*/
|
|
12392
12392
|
async function saveArchive(filePath, collectionJson, fs) {
|
|
12393
12393
|
if (!filePath.endsWith('.bookc')) {
|
|
@@ -12871,7 +12871,7 @@ function $initializePrettifyCommand(program) {
|
|
|
12871
12871
|
}));
|
|
12872
12872
|
}
|
|
12873
12873
|
/**
|
|
12874
|
-
* TODO: [😶] Unite
|
|
12874
|
+
* TODO: [😶] Unite folder listing
|
|
12875
12875
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
12876
12876
|
* Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
|
|
12877
12877
|
* TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
|
|
@@ -13188,9 +13188,9 @@ function isValidPipelineString(pipelineString) {
|
|
|
13188
13188
|
*/
|
|
13189
13189
|
|
|
13190
13190
|
/**
|
|
13191
|
-
* @see ./
|
|
13191
|
+
* @see ./wizard.ts `getPipeline` method
|
|
13192
13192
|
*
|
|
13193
|
-
* @private usable through `ptbk run` and `@
|
|
13193
|
+
* @private usable through `ptbk run` and `@promptbook/wizard`
|
|
13194
13194
|
*/
|
|
13195
13195
|
async function $getCompiledBook(tools, pipelineSource, options) {
|
|
13196
13196
|
const { fs, fetch } = tools;
|
|
@@ -13405,7 +13405,7 @@ async function runInteractiveChatbot(options) {
|
|
|
13405
13405
|
}
|
|
13406
13406
|
catch (error) {
|
|
13407
13407
|
assertsError(error);
|
|
13408
|
-
// TODO: Allow to
|
|
13408
|
+
// TODO: Allow to resurrect the chatbot after an error - prompt the user to continue
|
|
13409
13409
|
console.error(colors.red(error.stack || error.message));
|
|
13410
13410
|
return process.exit(1);
|
|
13411
13411
|
}
|
|
@@ -13550,7 +13550,7 @@ function $initializeRunCommand(program) {
|
|
|
13550
13550
|
const pipelineExecutor = createPipelineExecutor({
|
|
13551
13551
|
pipeline,
|
|
13552
13552
|
tools,
|
|
13553
|
-
|
|
13553
|
+
isNotPreparedWarningSuppressed: true,
|
|
13554
13554
|
maxExecutionAttempts: DEFAULT_MAX_EXECUTION_ATTEMPTS,
|
|
13555
13555
|
// <- TODO: Why "LLM execution failed undefinedx"
|
|
13556
13556
|
maxParallelCount: 1, // <- TODO: Pass CLI argument
|
|
@@ -14797,7 +14797,7 @@ function $initializeStartServerCommand(program) {
|
|
|
14797
14797
|
}
|
|
14798
14798
|
const url = !rawUrl ? null : new URL(rawUrl);
|
|
14799
14799
|
if (url !== null && url.port !== port.toString()) {
|
|
14800
|
-
console.warn(colors.yellow(`Port in --url is different from --port which the server will listen on, this is ok only if you proxy from one port to another, for
|
|
14800
|
+
console.warn(colors.yellow(`Port in --url is different from --port which the server will listen on, this is ok only if you proxy from one port to another, for example via nginx or docker`));
|
|
14801
14801
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
14802
14802
|
}
|
|
14803
14803
|
let rootUrl = undefined;
|
|
@@ -14938,7 +14938,7 @@ function $initializeTestCommand(program) {
|
|
|
14938
14938
|
}));
|
|
14939
14939
|
}
|
|
14940
14940
|
/**
|
|
14941
|
-
* TODO: [😶] Unite
|
|
14941
|
+
* TODO: [😶] Unite folder listing
|
|
14942
14942
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14943
14943
|
* Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
|
|
14944
14944
|
* TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
|
|
@@ -15027,7 +15027,7 @@ const _CLI = {
|
|
|
15027
15027
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
15028
15028
|
*
|
|
15029
15029
|
* @public exported from `@promptbook/core`
|
|
15030
|
-
* @public exported from `@promptbook/
|
|
15030
|
+
* @public exported from `@promptbook/wizard`
|
|
15031
15031
|
* @public exported from `@promptbook/cli`
|
|
15032
15032
|
*/
|
|
15033
15033
|
const _AnthropicClaudeMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
@@ -15551,7 +15551,7 @@ const createAnthropicClaudeExecutionTools = Object.assign((options) => {
|
|
|
15551
15551
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
15552
15552
|
*
|
|
15553
15553
|
* @public exported from `@promptbook/anthropic-claude`
|
|
15554
|
-
* @public exported from `@promptbook/
|
|
15554
|
+
* @public exported from `@promptbook/wizard`
|
|
15555
15555
|
* @public exported from `@promptbook/cli`
|
|
15556
15556
|
*
|
|
15557
15557
|
*/
|
|
@@ -15567,7 +15567,7 @@ const _AnthropicClaudeRegistration = $llmToolsRegister.register(createAnthropicC
|
|
|
15567
15567
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
15568
15568
|
*
|
|
15569
15569
|
* @public exported from `@promptbook/core`
|
|
15570
|
-
* @public exported from `@promptbook/
|
|
15570
|
+
* @public exported from `@promptbook/wizard`
|
|
15571
15571
|
* @public exported from `@promptbook/cli`
|
|
15572
15572
|
*/
|
|
15573
15573
|
const _AzureOpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
@@ -16245,7 +16245,7 @@ class AzureOpenAiExecutionTools {
|
|
|
16245
16245
|
rawResponse: {
|
|
16246
16246
|
...rawResponse,
|
|
16247
16247
|
created: rawResponse.created.toISOString(),
|
|
16248
|
-
// <- TODO: Put `created` at
|
|
16248
|
+
// <- TODO: Put `created` at beginning
|
|
16249
16249
|
},
|
|
16250
16250
|
// <- [🗯]
|
|
16251
16251
|
},
|
|
@@ -16340,7 +16340,7 @@ class AzureOpenAiExecutionTools {
|
|
|
16340
16340
|
rawResponse: {
|
|
16341
16341
|
...rawResponse,
|
|
16342
16342
|
created: rawResponse.created.toISOString(),
|
|
16343
|
-
// <- TODO: Put `created` at
|
|
16343
|
+
// <- TODO: Put `created` at beginning
|
|
16344
16344
|
},
|
|
16345
16345
|
// <- [🗯]
|
|
16346
16346
|
},
|
|
@@ -16410,7 +16410,7 @@ const createAzureOpenAiExecutionTools = Object.assign((options) => {
|
|
|
16410
16410
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
16411
16411
|
*
|
|
16412
16412
|
* @public exported from `@promptbook/azure-openai`
|
|
16413
|
-
* @public exported from `@promptbook/
|
|
16413
|
+
* @public exported from `@promptbook/wizard`
|
|
16414
16414
|
* @public exported from `@promptbook/cli`
|
|
16415
16415
|
*/
|
|
16416
16416
|
const _AzureOpenAiRegistration = $llmToolsRegister.register(createAzureOpenAiExecutionTools);
|
|
@@ -16425,7 +16425,7 @@ const _AzureOpenAiRegistration = $llmToolsRegister.register(createAzureOpenAiExe
|
|
|
16425
16425
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
16426
16426
|
*
|
|
16427
16427
|
* @public exported from `@promptbook/core`
|
|
16428
|
-
* @public exported from `@promptbook/
|
|
16428
|
+
* @public exported from `@promptbook/wizard`
|
|
16429
16429
|
* @public exported from `@promptbook/cli`
|
|
16430
16430
|
*/
|
|
16431
16431
|
const _DeepseekMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
@@ -16825,7 +16825,7 @@ const createDeepseekExecutionTools = Object.assign((options) => {
|
|
|
16825
16825
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
16826
16826
|
*
|
|
16827
16827
|
* @public exported from `@promptbook/deepseek`
|
|
16828
|
-
* @public exported from `@promptbook/
|
|
16828
|
+
* @public exported from `@promptbook/wizard`
|
|
16829
16829
|
* @public exported from `@promptbook/cli`
|
|
16830
16830
|
*/
|
|
16831
16831
|
const _DeepseekRegistration = $llmToolsRegister.register(createDeepseekExecutionTools);
|
|
@@ -16840,7 +16840,7 @@ const _DeepseekRegistration = $llmToolsRegister.register(createDeepseekExecution
|
|
|
16840
16840
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
16841
16841
|
*
|
|
16842
16842
|
* @public exported from `@promptbook/core`
|
|
16843
|
-
* @public exported from `@promptbook/
|
|
16843
|
+
* @public exported from `@promptbook/wizard`
|
|
16844
16844
|
* @public exported from `@promptbook/cli`
|
|
16845
16845
|
*/
|
|
16846
16846
|
const _GoogleMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
@@ -17110,7 +17110,7 @@ const createGoogleExecutionTools = Object.assign((options) => {
|
|
|
17110
17110
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
17111
17111
|
*
|
|
17112
17112
|
* @public exported from `@promptbook/google`
|
|
17113
|
-
* @public exported from `@promptbook/
|
|
17113
|
+
* @public exported from `@promptbook/wizard`
|
|
17114
17114
|
* @public exported from `@promptbook/cli`
|
|
17115
17115
|
*/
|
|
17116
17116
|
const _GoogleRegistration = $llmToolsRegister.register(createGoogleExecutionTools);
|
|
@@ -17132,7 +17132,7 @@ const DEFAULT_OLLAMA_BASE_URL = 'http://localhost:11434/v1';
|
|
|
17132
17132
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
17133
17133
|
*
|
|
17134
17134
|
* @public exported from `@promptbook/core`
|
|
17135
|
-
* @public exported from `@promptbook/
|
|
17135
|
+
* @public exported from `@promptbook/wizard`
|
|
17136
17136
|
* @public exported from `@promptbook/cli`
|
|
17137
17137
|
*/
|
|
17138
17138
|
const _OllamaMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
@@ -17867,7 +17867,7 @@ const createOllamaExecutionTools = Object.assign((options) => {
|
|
|
17867
17867
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
17868
17868
|
*
|
|
17869
17869
|
* @public exported from `@promptbook/ollama`
|
|
17870
|
-
* @public exported from `@promptbook/
|
|
17870
|
+
* @public exported from `@promptbook/wizard`
|
|
17871
17871
|
* @public exported from `@promptbook/cli`
|
|
17872
17872
|
*/
|
|
17873
17873
|
const _OllamaRegistration = $llmToolsRegister.register(createOllamaExecutionTools);
|
|
@@ -17882,7 +17882,7 @@ const _OllamaRegistration = $llmToolsRegister.register(createOllamaExecutionTool
|
|
|
17882
17882
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
17883
17883
|
*
|
|
17884
17884
|
* @public exported from `@promptbook/core`
|
|
17885
|
-
* @public exported from `@promptbook/
|
|
17885
|
+
* @public exported from `@promptbook/wizard`
|
|
17886
17886
|
* @public exported from `@promptbook/cli`
|
|
17887
17887
|
*/
|
|
17888
17888
|
const _OpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
@@ -17924,7 +17924,7 @@ const _OpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
|
17924
17924
|
* Note: [🏐] Configurations registrations are done in the metadata registration section, but the constructor registration is handled separately.
|
|
17925
17925
|
*
|
|
17926
17926
|
* @public exported from `@promptbook/core`
|
|
17927
|
-
* @public exported from `@promptbook/
|
|
17927
|
+
* @public exported from `@promptbook/wizard`
|
|
17928
17928
|
* @public exported from `@promptbook/cli`
|
|
17929
17929
|
*/
|
|
17930
17930
|
const _OpenAiAssistantMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
@@ -18104,7 +18104,7 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
|
|
|
18104
18104
|
});
|
|
18105
18105
|
const rawRequest = {
|
|
18106
18106
|
// TODO: [👨👨👧👧] ...modelSettings,
|
|
18107
|
-
// TODO: [👨👨👧👧][🧠] What about system message for assistants, does it make
|
|
18107
|
+
// TODO: [👨👨👧👧][🧠] What about system message for assistants, does it make sense - combination of OpenAI assistants with Promptbook Personas
|
|
18108
18108
|
assistant_id: this.assistantId,
|
|
18109
18109
|
thread: {
|
|
18110
18110
|
messages: [
|
|
@@ -18192,7 +18192,7 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
|
|
|
18192
18192
|
}
|
|
18193
18193
|
}
|
|
18194
18194
|
/**
|
|
18195
|
-
* TODO: [🧠][🧙♂️] Maybe there can be some
|
|
18195
|
+
* TODO: [🧠][🧙♂️] Maybe there can be some wizard for those who want to use just OpenAI
|
|
18196
18196
|
* TODO: Maybe make custom OpenAiError
|
|
18197
18197
|
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
18198
18198
|
* TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
|
|
@@ -18245,7 +18245,7 @@ const createOpenAiExecutionTools = Object.assign((options) => {
|
|
|
18245
18245
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
18246
18246
|
*
|
|
18247
18247
|
* @public exported from `@promptbook/openai`
|
|
18248
|
-
* @public exported from `@promptbook/
|
|
18248
|
+
* @public exported from `@promptbook/wizard`
|
|
18249
18249
|
* @public exported from `@promptbook/cli`
|
|
18250
18250
|
*/
|
|
18251
18251
|
const _OpenAiRegistration = $llmToolsRegister.register(createOpenAiExecutionTools);
|
|
@@ -18255,7 +18255,7 @@ const _OpenAiRegistration = $llmToolsRegister.register(createOpenAiExecutionTool
|
|
|
18255
18255
|
* Note: [🏐] Configurations registrations are done in register-constructor.ts BUT constructor register-constructor.ts
|
|
18256
18256
|
*
|
|
18257
18257
|
* @public exported from `@promptbook/openai`
|
|
18258
|
-
* @public exported from `@promptbook/
|
|
18258
|
+
* @public exported from `@promptbook/wizard`
|
|
18259
18259
|
* @public exported from `@promptbook/cli`
|
|
18260
18260
|
*/
|
|
18261
18261
|
const _OpenAiAssistantRegistration = $llmToolsRegister.register(createOpenAiAssistantExecutionTools);
|
|
@@ -18328,7 +18328,7 @@ const markdownScraperMetadata = $deepFreeze({
|
|
|
18328
18328
|
className: 'MarkdownScraper',
|
|
18329
18329
|
mimeTypes: ['text/markdown', 'text/plain'],
|
|
18330
18330
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
18331
|
-
|
|
18331
|
+
isAvailableInBrowser: true,
|
|
18332
18332
|
// <- 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
|
|
18333
18333
|
requiredExecutables: [],
|
|
18334
18334
|
}); /* <- Note: [🤛] */
|
|
@@ -18338,7 +18338,7 @@ const markdownScraperMetadata = $deepFreeze({
|
|
|
18338
18338
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
18339
18339
|
*
|
|
18340
18340
|
* @public exported from `@promptbook/core`
|
|
18341
|
-
* @public exported from `@promptbook/
|
|
18341
|
+
* @public exported from `@promptbook/wizard`
|
|
18342
18342
|
* @public exported from `@promptbook/cli`
|
|
18343
18343
|
*/
|
|
18344
18344
|
const _MarkdownScraperMetadataRegistration = $scrapersMetadataRegister.register(markdownScraperMetadata);
|
|
@@ -18437,7 +18437,7 @@ class MarkdownScraper {
|
|
|
18437
18437
|
}
|
|
18438
18438
|
// ---
|
|
18439
18439
|
if (!llmTools.callEmbeddingModel) {
|
|
18440
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
18440
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
18441
18441
|
console.error('No callEmbeddingModel function provided');
|
|
18442
18442
|
}
|
|
18443
18443
|
else {
|
|
@@ -18463,7 +18463,7 @@ class MarkdownScraper {
|
|
|
18463
18463
|
if (!(error instanceof PipelineExecutionError)) {
|
|
18464
18464
|
throw error;
|
|
18465
18465
|
}
|
|
18466
|
-
// TODO: [🟥] Detect browser / node and make it
|
|
18466
|
+
// TODO: [🟥] Detect browser / node and make it colorful
|
|
18467
18467
|
console.error(error, "<- Note: This error is not critical to prepare the pipeline, just knowledge pieces won't have embeddings");
|
|
18468
18468
|
}
|
|
18469
18469
|
return {
|
|
@@ -18497,7 +18497,7 @@ const boilerplateScraperMetadata = $deepFreeze({
|
|
|
18497
18497
|
// <- TODO: @@ Add compatible mime types with Boilerplate scraper
|
|
18498
18498
|
],
|
|
18499
18499
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
18500
|
-
|
|
18500
|
+
isAvailableInBrowser: false,
|
|
18501
18501
|
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
18502
18502
|
requiredExecutables: [
|
|
18503
18503
|
/* @@ 'Pandoc' */
|
|
@@ -18509,7 +18509,7 @@ const boilerplateScraperMetadata = $deepFreeze({
|
|
|
18509
18509
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
18510
18510
|
*
|
|
18511
18511
|
* @public exported from `@promptbook/core`
|
|
18512
|
-
* @public exported from `@promptbook/
|
|
18512
|
+
* @public exported from `@promptbook/wizard`
|
|
18513
18513
|
* @public exported from `@promptbook/cli`
|
|
18514
18514
|
*/
|
|
18515
18515
|
const _BoilerplateScraperMetadataRegistration = $scrapersMetadataRegister.register(boilerplateScraperMetadata);
|
|
@@ -18647,7 +18647,7 @@ const createBoilerplateScraper = Object.assign((tools, options) => {
|
|
|
18647
18647
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
18648
18648
|
*
|
|
18649
18649
|
* @public exported from `@promptbook/boilerplate`
|
|
18650
|
-
* @public exported from `@promptbook/
|
|
18650
|
+
* @public exported from `@promptbook/wizard`
|
|
18651
18651
|
* @public exported from `@promptbook/cli`
|
|
18652
18652
|
*/
|
|
18653
18653
|
const _BoilerplateScraperRegistration = $scrapersRegister.register(createBoilerplateScraper);
|
|
@@ -18667,7 +18667,7 @@ const documentScraperMetadata = $deepFreeze({
|
|
|
18667
18667
|
className: 'DocumentScraper',
|
|
18668
18668
|
mimeTypes: ['application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
|
|
18669
18669
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
18670
|
-
|
|
18670
|
+
isAvailableInBrowser: false,
|
|
18671
18671
|
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
18672
18672
|
requiredExecutables: ['Pandoc'],
|
|
18673
18673
|
}); /* <- Note: [🤛] */
|
|
@@ -18677,7 +18677,7 @@ const documentScraperMetadata = $deepFreeze({
|
|
|
18677
18677
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
18678
18678
|
*
|
|
18679
18679
|
* @public exported from `@promptbook/core`
|
|
18680
|
-
* @public exported from `@promptbook/
|
|
18680
|
+
* @public exported from `@promptbook/wizard`
|
|
18681
18681
|
* @public exported from `@promptbook/cli`
|
|
18682
18682
|
*/
|
|
18683
18683
|
const _DocumentScraperMetadataRegistration = $scrapersMetadataRegister.register(documentScraperMetadata);
|
|
@@ -18803,7 +18803,7 @@ const legacyDocumentScraperMetadata = $deepFreeze({
|
|
|
18803
18803
|
className: 'LegacyDocumentScraper',
|
|
18804
18804
|
mimeTypes: ['application/msword', 'text/rtf'],
|
|
18805
18805
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
18806
|
-
|
|
18806
|
+
isAvailableInBrowser: false,
|
|
18807
18807
|
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
18808
18808
|
requiredExecutables: [
|
|
18809
18809
|
'Pandoc',
|
|
@@ -18817,7 +18817,7 @@ const legacyDocumentScraperMetadata = $deepFreeze({
|
|
|
18817
18817
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
18818
18818
|
*
|
|
18819
18819
|
* @public exported from `@promptbook/core`
|
|
18820
|
-
* @public exported from `@promptbook/
|
|
18820
|
+
* @public exported from `@promptbook/wizard`
|
|
18821
18821
|
* @public exported from `@promptbook/cli`
|
|
18822
18822
|
*/
|
|
18823
18823
|
const _LegacyDocumentScraperMetadataRegistration = $scrapersMetadataRegister.register(legacyDocumentScraperMetadata);
|
|
@@ -18978,7 +18978,7 @@ const createLegacyDocumentScraper = Object.assign((tools, options) => {
|
|
|
18978
18978
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
18979
18979
|
*
|
|
18980
18980
|
* @public exported from `@promptbook/legacy-documents`
|
|
18981
|
-
* @public exported from `@promptbook/
|
|
18981
|
+
* @public exported from `@promptbook/wizard`
|
|
18982
18982
|
* @public exported from `@promptbook/cli`
|
|
18983
18983
|
*/
|
|
18984
18984
|
const _LegacyDocumentScraperRegistration = $scrapersRegister.register(createLegacyDocumentScraper);
|
|
@@ -19005,7 +19005,7 @@ const createDocumentScraper = Object.assign((tools, options) => {
|
|
|
19005
19005
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
19006
19006
|
*
|
|
19007
19007
|
* @public exported from `@promptbook/documents`
|
|
19008
|
-
* @public exported from `@promptbook/
|
|
19008
|
+
* @public exported from `@promptbook/wizard`
|
|
19009
19009
|
* @public exported from `@promptbook/cli`
|
|
19010
19010
|
*/
|
|
19011
19011
|
const _DocumentScraperRegistration = $scrapersRegister.register(createDocumentScraper);
|
|
@@ -19032,7 +19032,7 @@ const createMarkdownScraper = Object.assign((tools, options) => {
|
|
|
19032
19032
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
19033
19033
|
*
|
|
19034
19034
|
* @public exported from `@promptbook/markdown-utils`
|
|
19035
|
-
* @public exported from `@promptbook/
|
|
19035
|
+
* @public exported from `@promptbook/wizard`
|
|
19036
19036
|
* @public exported from `@promptbook/cli`
|
|
19037
19037
|
*/
|
|
19038
19038
|
const _MarkdownScraperRegistration = $scrapersRegister.register(createMarkdownScraper);
|
|
@@ -19057,7 +19057,7 @@ const markitdownScraperMetadata = $deepFreeze({
|
|
|
19057
19057
|
// 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
19058
19058
|
],
|
|
19059
19059
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
19060
|
-
|
|
19060
|
+
isAvailableInBrowser: false,
|
|
19061
19061
|
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
19062
19062
|
requiredExecutables: [],
|
|
19063
19063
|
}); /* <- Note: [🤛] */
|
|
@@ -19067,7 +19067,7 @@ const markitdownScraperMetadata = $deepFreeze({
|
|
|
19067
19067
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
19068
19068
|
*
|
|
19069
19069
|
* @public exported from `@promptbook/core`
|
|
19070
|
-
* @public exported from `@promptbook/
|
|
19070
|
+
* @public exported from `@promptbook/wizard`
|
|
19071
19071
|
* @public exported from `@promptbook/cli`
|
|
19072
19072
|
*/
|
|
19073
19073
|
const _MarkitdownScraperMetadataRegistration = $scrapersMetadataRegister.register(markitdownScraperMetadata);
|
|
@@ -19204,7 +19204,7 @@ const createMarkitdownScraper = Object.assign((tools, options) => {
|
|
|
19204
19204
|
*
|
|
19205
19205
|
* @public exported from `@promptbook/markitdown`
|
|
19206
19206
|
* @public exported from `@promptbook/pdf`
|
|
19207
|
-
* @public exported from `@promptbook/
|
|
19207
|
+
* @public exported from `@promptbook/wizard`
|
|
19208
19208
|
* @public exported from `@promptbook/cli`
|
|
19209
19209
|
*/
|
|
19210
19210
|
const _MarkitdownScraperRegistration = $scrapersRegister.register(createMarkitdownScraper);
|
|
@@ -19225,7 +19225,7 @@ const pdfScraperMetadata = $deepFreeze({
|
|
|
19225
19225
|
className: 'PdfScraper',
|
|
19226
19226
|
mimeTypes: ['application/pdf-DISABLED'],
|
|
19227
19227
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
19228
|
-
|
|
19228
|
+
isAvailableInBrowser: false,
|
|
19229
19229
|
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
19230
19230
|
requiredExecutables: [],
|
|
19231
19231
|
}); /* <- Note: [🤛] */
|
|
@@ -19235,7 +19235,7 @@ const pdfScraperMetadata = $deepFreeze({
|
|
|
19235
19235
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
19236
19236
|
*
|
|
19237
19237
|
* @public exported from `@promptbook/core`
|
|
19238
|
-
* @public exported from `@promptbook/
|
|
19238
|
+
* @public exported from `@promptbook/wizard`
|
|
19239
19239
|
* @public exported from `@promptbook/cli`
|
|
19240
19240
|
*/
|
|
19241
19241
|
const _PdfScraperMetadataRegistration = $scrapersMetadataRegister.register(pdfScraperMetadata);
|
|
@@ -19310,7 +19310,7 @@ const createPdfScraper = Object.assign((tools, options) => {
|
|
|
19310
19310
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
19311
19311
|
*
|
|
19312
19312
|
* @public exported from `@promptbook/pdf`
|
|
19313
|
-
* @public exported from `@promptbook/
|
|
19313
|
+
* @public exported from `@promptbook/wizard`
|
|
19314
19314
|
* @public exported from `@promptbook/cli`
|
|
19315
19315
|
*/
|
|
19316
19316
|
const _PdfScraperRegistration = $scrapersRegister.register(createPdfScraper);
|
|
@@ -19330,7 +19330,7 @@ const websiteScraperMetadata = $deepFreeze({
|
|
|
19330
19330
|
className: 'WebsiteScraper',
|
|
19331
19331
|
mimeTypes: ['text/html'],
|
|
19332
19332
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
19333
|
-
|
|
19333
|
+
isAvailableInBrowser: false,
|
|
19334
19334
|
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
19335
19335
|
requiredExecutables: [],
|
|
19336
19336
|
}); /* <- Note: [🤛] */
|
|
@@ -19340,7 +19340,7 @@ const websiteScraperMetadata = $deepFreeze({
|
|
|
19340
19340
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
19341
19341
|
*
|
|
19342
19342
|
* @public exported from `@promptbook/core`
|
|
19343
|
-
* @public exported from `@promptbook/
|
|
19343
|
+
* @public exported from `@promptbook/wizard`
|
|
19344
19344
|
* @public exported from `@promptbook/cli`
|
|
19345
19345
|
*/
|
|
19346
19346
|
const _WebsiteScraperMetadataRegistration = $scrapersMetadataRegister.register(websiteScraperMetadata);
|
|
@@ -19487,7 +19487,7 @@ const createWebsiteScraper = Object.assign((tools, options) => {
|
|
|
19487
19487
|
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
19488
19488
|
*
|
|
19489
19489
|
* @public exported from `@promptbook/website-crawler`
|
|
19490
|
-
* @public exported from `@promptbook/
|
|
19490
|
+
* @public exported from `@promptbook/wizard`
|
|
19491
19491
|
* @public exported from `@promptbook/cli`
|
|
19492
19492
|
*/
|
|
19493
19493
|
const _WebsiteScraperRegistration = $scrapersRegister.register(createWebsiteScraper);
|