@promptbook/core 0.92.0-29 → 0.92.0-30
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/esm/index.es.js +60 -43
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +2 -2
- package/esm/typings/src/config.d.ts +1 -1
- package/esm/typings/src/remote-server/openapi.d.ts +1 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +64 -47
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -27,7 +27,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
27
27
|
* @generated
|
|
28
28
|
* @see https://github.com/webgptorg/promptbook
|
|
29
29
|
*/
|
|
30
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
30
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-30';
|
|
31
31
|
/**
|
|
32
32
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
33
33
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -493,7 +493,7 @@ const DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME = `getPipelineCollection`;
|
|
|
493
493
|
*
|
|
494
494
|
* @public exported from `@promptbook/core`
|
|
495
495
|
*/
|
|
496
|
-
const
|
|
496
|
+
const DEFAULT_MAX_REQUESTS_PER_MINUTE = 60;
|
|
497
497
|
/**
|
|
498
498
|
* Indicates whether pipeline logic validation is enabled. When true, the pipeline logic is checked for consistency.
|
|
499
499
|
*
|
|
@@ -2918,13 +2918,10 @@ const CsvFormatParser = {
|
|
|
2918
2918
|
if (onProgress) {
|
|
2919
2919
|
// Note: Report the CSV with all rows mapped so far
|
|
2920
2920
|
/*
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
);
|
|
2926
|
-
|
|
2927
|
-
|
|
2921
|
+
// TODO: [🛕] Report progress with all the rows including the pending ones
|
|
2922
|
+
const progressData = mappedData.map((row, i) =>
|
|
2923
|
+
i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
|
|
2924
|
+
);
|
|
2928
2925
|
*/
|
|
2929
2926
|
await onProgress(unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
2930
2927
|
}
|
|
@@ -9777,24 +9774,25 @@ function addAutoGeneratedSection(content, options) {
|
|
|
9777
9774
|
*/
|
|
9778
9775
|
function renderPromptbookMermaid(pipelineJson, options) {
|
|
9779
9776
|
const { linkTask = () => null } = options || {};
|
|
9780
|
-
const MERMAID_PREFIX = '
|
|
9781
|
-
const
|
|
9782
|
-
const
|
|
9777
|
+
const MERMAID_PREFIX = 'pipeline_';
|
|
9778
|
+
const MERMAID_KNOWLEDGE_NAME = MERMAID_PREFIX + 'knowledge';
|
|
9779
|
+
const MERMAID_RESERVED_NAME = MERMAID_PREFIX + 'reserved';
|
|
9780
|
+
const MERMAID_INPUT_NAME = MERMAID_PREFIX + 'input';
|
|
9781
|
+
const MERMAID_OUTPUT_NAME = MERMAID_PREFIX + 'output';
|
|
9783
9782
|
const parameterNameToTaskName = (parameterName) => {
|
|
9784
9783
|
if (parameterName === 'knowledge') {
|
|
9785
|
-
return
|
|
9786
|
-
// <- TODO: !!!! Check that this works
|
|
9784
|
+
return MERMAID_KNOWLEDGE_NAME;
|
|
9787
9785
|
}
|
|
9788
9786
|
else if (RESERVED_PARAMETER_NAMES.includes(parameterName)) {
|
|
9789
|
-
return
|
|
9787
|
+
return MERMAID_RESERVED_NAME;
|
|
9790
9788
|
}
|
|
9791
9789
|
const parameter = pipelineJson.parameters.find((parameter) => parameter.name === parameterName);
|
|
9792
9790
|
if (!parameter) {
|
|
9793
9791
|
throw new UnexpectedError(`Could not find {${parameterName}}`);
|
|
9794
|
-
// <- TODO:
|
|
9792
|
+
// <- TODO: This causes problems when {knowledge} and other reserved parameters are used
|
|
9795
9793
|
}
|
|
9796
9794
|
if (parameter.isInput) {
|
|
9797
|
-
return
|
|
9795
|
+
return MERMAID_INPUT_NAME;
|
|
9798
9796
|
}
|
|
9799
9797
|
const task = pipelineJson.tasks.find((task) => task.resultingParameterName === parameterName);
|
|
9800
9798
|
if (!task) {
|
|
@@ -9802,32 +9800,17 @@ function renderPromptbookMermaid(pipelineJson, options) {
|
|
|
9802
9800
|
}
|
|
9803
9801
|
return MERMAID_PREFIX + (task.name || normalizeTo_camelCase('task-' + titleToName(task.title)));
|
|
9804
9802
|
};
|
|
9805
|
-
const
|
|
9806
|
-
|
|
9807
|
-
%% 🔮 Tip: Open this on GitHub or in the VSCode website to see the Mermaid graph visually
|
|
9808
|
-
|
|
9809
|
-
flowchart LR
|
|
9810
|
-
subgraph "${pipelineJson.title}"
|
|
9811
|
-
|
|
9812
|
-
direction TB
|
|
9813
|
-
|
|
9814
|
-
input((Input)):::input
|
|
9815
|
-
${RESERVED_NAME}((Other)):::${RESERVED_NAME}
|
|
9816
|
-
${KNOWLEDGE_NAME}((Knowledgebase)):::${KNOWLEDGE_NAME}
|
|
9817
|
-
${block(pipelineJson.tasks
|
|
9803
|
+
const inputAndIntermediateParametersMermaid = pipelineJson.tasks
|
|
9818
9804
|
.flatMap(({ title, dependentParameterNames, resultingParameterName }) => [
|
|
9819
9805
|
`${parameterNameToTaskName(resultingParameterName)}("${title}")`,
|
|
9820
9806
|
...dependentParameterNames.map((dependentParameterName) => `${parameterNameToTaskName(dependentParameterName)}--"{${dependentParameterName}}"-->${parameterNameToTaskName(resultingParameterName)}`),
|
|
9821
9807
|
])
|
|
9822
|
-
.join('\n')
|
|
9823
|
-
|
|
9824
|
-
${block(pipelineJson.parameters
|
|
9808
|
+
.join('\n');
|
|
9809
|
+
const outputParametersMermaid = pipelineJson.parameters
|
|
9825
9810
|
.filter(({ isOutput }) => isOutput)
|
|
9826
|
-
.map(({ name }) => `${parameterNameToTaskName(name)}--"{${name}}"
|
|
9827
|
-
.join('\n')
|
|
9828
|
-
|
|
9829
|
-
|
|
9830
|
-
${block(pipelineJson.tasks
|
|
9811
|
+
.map(({ name }) => `${parameterNameToTaskName(name)}--"{${name}}"-->${MERMAID_OUTPUT_NAME}`)
|
|
9812
|
+
.join('\n');
|
|
9813
|
+
const linksMermaid = pipelineJson.tasks
|
|
9831
9814
|
.map((task) => {
|
|
9832
9815
|
const link = linkTask(task);
|
|
9833
9816
|
if (link === null) {
|
|
@@ -9838,10 +9821,44 @@ function renderPromptbookMermaid(pipelineJson, options) {
|
|
|
9838
9821
|
return `click ${taskName} href "${href}" "${title}";`;
|
|
9839
9822
|
})
|
|
9840
9823
|
.filter((line) => line !== '')
|
|
9841
|
-
.join('\n')
|
|
9824
|
+
.join('\n');
|
|
9825
|
+
const interactionPointsMermaid = Object.entries({
|
|
9826
|
+
[MERMAID_INPUT_NAME]: 'Input',
|
|
9827
|
+
[MERMAID_OUTPUT_NAME]: 'Output',
|
|
9828
|
+
[MERMAID_RESERVED_NAME]: 'Other',
|
|
9829
|
+
[MERMAID_KNOWLEDGE_NAME]: 'Knowledge',
|
|
9830
|
+
})
|
|
9831
|
+
.filter(([MERMAID_NAME]) => (inputAndIntermediateParametersMermaid + outputParametersMermaid).includes(MERMAID_NAME))
|
|
9832
|
+
.map(([MERMAID_NAME, title]) => `${MERMAID_NAME}((${title})):::${MERMAID_NAME}`)
|
|
9833
|
+
.join('\n');
|
|
9834
|
+
const promptbookMermaid = spaceTrim$1((block) => `
|
|
9835
|
+
|
|
9836
|
+
%% 🔮 Tip: Open this on GitHub or in the VSCode website to see the Mermaid graph visually
|
|
9837
|
+
|
|
9838
|
+
flowchart LR
|
|
9839
|
+
subgraph "${pipelineJson.title}"
|
|
9840
|
+
|
|
9841
|
+
%% Basic configuration
|
|
9842
|
+
direction TB
|
|
9843
|
+
|
|
9844
|
+
%% Interaction points from pipeline to outside
|
|
9845
|
+
${block(interactionPointsMermaid)}
|
|
9846
|
+
|
|
9847
|
+
%% Input and intermediate parameters
|
|
9848
|
+
${block(inputAndIntermediateParametersMermaid)}
|
|
9849
|
+
|
|
9850
|
+
|
|
9851
|
+
%% Output parameters
|
|
9852
|
+
${block(outputParametersMermaid)}
|
|
9853
|
+
|
|
9854
|
+
%% Links
|
|
9855
|
+
${block(linksMermaid)}
|
|
9842
9856
|
|
|
9843
|
-
|
|
9844
|
-
classDef
|
|
9857
|
+
%% Styles
|
|
9858
|
+
classDef ${MERMAID_INPUT_NAME} color: grey;
|
|
9859
|
+
classDef ${MERMAID_OUTPUT_NAME} color: grey;
|
|
9860
|
+
classDef ${MERMAID_RESERVED_NAME} color: grey;
|
|
9861
|
+
classDef ${MERMAID_KNOWLEDGE_NAME} color: grey;
|
|
9845
9862
|
|
|
9846
9863
|
end;
|
|
9847
9864
|
|
|
@@ -11088,7 +11105,7 @@ const _OpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
|
11088
11105
|
className: 'OpenAiExecutionTools',
|
|
11089
11106
|
options: {
|
|
11090
11107
|
apiKey: 'sk-',
|
|
11091
|
-
maxRequestsPerMinute:
|
|
11108
|
+
maxRequestsPerMinute: DEFAULT_MAX_REQUESTS_PER_MINUTE,
|
|
11092
11109
|
},
|
|
11093
11110
|
};
|
|
11094
11111
|
},
|
|
@@ -11636,5 +11653,5 @@ class PrefixStorage {
|
|
|
11636
11653
|
}
|
|
11637
11654
|
}
|
|
11638
11655
|
|
|
11639
|
-
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, AbstractFormatError, AuthenticationError, BIG_DATASET_TRESHOLD, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CLI_APP_ID, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CompletionFormfactorDefinition, CsvFormatError, CsvFormatParser, DEFAULT_BOOKS_DIRNAME, DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, DEFAULT_BOOK_TITLE, DEFAULT_CSV_SETTINGS, DEFAULT_DOWNLOAD_CACHE_DIRNAME, DEFAULT_EXECUTION_CACHE_DIRNAME, DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_PROMPT_TASK_TITLE, DEFAULT_REMOTE_SERVER_URL,
|
|
11656
|
+
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, AbstractFormatError, AuthenticationError, BIG_DATASET_TRESHOLD, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CLI_APP_ID, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CompletionFormfactorDefinition, CsvFormatError, CsvFormatParser, DEFAULT_BOOKS_DIRNAME, DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, DEFAULT_BOOK_TITLE, DEFAULT_CSV_SETTINGS, DEFAULT_DOWNLOAD_CACHE_DIRNAME, DEFAULT_EXECUTION_CACHE_DIRNAME, DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_MAX_REQUESTS_PER_MINUTE, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_PROMPT_TASK_TITLE, DEFAULT_REMOTE_SERVER_URL, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TASK_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FAILED_VALUE_PLACEHOLDER, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_ORDERS, MODEL_TRUST_LEVELS, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, PENDING_VALUE_PLACEHOLDER, PLAYGROUND_APP_ID, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, PromptbookFetchError, REMOTE_SERVER_URLS, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatParser, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UNCERTAIN_ZERO_VALUE, UnexpectedError, WrappedError, ZERO_USAGE, ZERO_VALUE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _BoilerplateScraperMetadataRegistration, _DeepseekMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _MarkitdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, book, cacheLlmTools, collectionToJson, compilePipeline, computeCosineSimilarity, countUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, filterModels, getPipelineInterface, identificationToPromptbookToken, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, isValidPipelineString, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, migratePipeline, parsePipeline, pipelineJsonToString, prepareKnowledgePieces, preparePersona, preparePipeline, prettifyPipelineString, promptbookFetch, promptbookTokenToIdentification, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline, validatePipelineString };
|
|
11640
11657
|
//# sourceMappingURL=index.es.js.map
|