@promptbook/documents 0.104.0-13 → 0.104.0-14
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 +25 -17
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +0 -6
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +4 -1
- package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +5 -1
- package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +4 -0
- package/esm/typings/src/book-components/icons/AboutIcon.d.ts +5 -1
- package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +6 -2
- package/esm/typings/src/book-components/icons/CameraIcon.d.ts +6 -2
- package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +5 -1
- package/esm/typings/src/book-components/icons/MenuIcon.d.ts +5 -1
- package/esm/typings/src/book-components/icons/SaveIcon.d.ts +6 -2
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +7 -5
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +7 -3
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +11 -7
- package/esm/typings/src/remote-server/ui/ServerApp.d.ts +5 -1
- package/esm/typings/src/types/typeAliasEmoji.d.ts +2 -2
- package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +4 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +25 -17
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -26,7 +26,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
26
26
|
* @generated
|
|
27
27
|
* @see https://github.com/webgptorg/promptbook
|
|
28
28
|
*/
|
|
29
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-
|
|
29
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-14';
|
|
30
30
|
/**
|
|
31
31
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
32
32
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1756,8 +1756,8 @@ for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
|
|
|
1756
1756
|
*/
|
|
1757
1757
|
function removeDiacritics(input) {
|
|
1758
1758
|
/*eslint no-control-regex: "off"*/
|
|
1759
|
-
return input.replace(/[^\u0000-\u007E]/g, (
|
|
1760
|
-
return DIACRITIC_VARIANTS_LETTERS[
|
|
1759
|
+
return input.replace(/[^\u0000-\u007E]/g, (character) => {
|
|
1760
|
+
return DIACRITIC_VARIANTS_LETTERS[character] || character;
|
|
1761
1761
|
});
|
|
1762
1762
|
}
|
|
1763
1763
|
/**
|
|
@@ -3928,7 +3928,7 @@ async function forEachAsync(array, options, callbackfunction) {
|
|
|
3928
3928
|
tasks.push(task);
|
|
3929
3929
|
runningTasks.push(task);
|
|
3930
3930
|
/* not await */ Promise.resolve(task).then(() => {
|
|
3931
|
-
runningTasks = runningTasks.filter((
|
|
3931
|
+
runningTasks = runningTasks.filter((runningTask) => runningTask !== task);
|
|
3932
3932
|
});
|
|
3933
3933
|
if (maxParallelCount < runningTasks.length) {
|
|
3934
3934
|
await Promise.race(runningTasks);
|
|
@@ -3985,10 +3985,14 @@ function addUsage(...usageItems) {
|
|
|
3985
3985
|
}
|
|
3986
3986
|
|
|
3987
3987
|
/**
|
|
3988
|
-
* Intercepts LLM tools and counts total usage of the tools
|
|
3988
|
+
* Intercepts LLM tools and counts total usage of the tools.
|
|
3989
3989
|
*
|
|
3990
|
-
*
|
|
3991
|
-
*
|
|
3990
|
+
* This function wraps the provided `LlmExecutionTools` with a proxy that tracks the cumulative
|
|
3991
|
+
* usage (tokens, cost, etc.) across all model calls. It provides a way to monitor spending
|
|
3992
|
+
* in real-time through an observable.
|
|
3993
|
+
*
|
|
3994
|
+
* @param llmTools - The LLM tools to be intercepted and tracked
|
|
3995
|
+
* @returns An augmented version of the tools that includes usage tracking capabilities
|
|
3992
3996
|
* @public exported from `@promptbook/core`
|
|
3993
3997
|
*/
|
|
3994
3998
|
function countUsage(llmTools) {
|
|
@@ -4253,17 +4257,21 @@ class MultipleLlmExecutionTools {
|
|
|
4253
4257
|
*/
|
|
4254
4258
|
|
|
4255
4259
|
/**
|
|
4256
|
-
* Joins multiple LLM Execution Tools into one
|
|
4260
|
+
* Joins multiple LLM Execution Tools into one.
|
|
4257
4261
|
*
|
|
4258
|
-
*
|
|
4262
|
+
* This function takes a list of `LlmExecutionTools` and returns a single unified
|
|
4263
|
+
* `MultipleLlmExecutionTools` object. It provides failover and aggregation logic:
|
|
4259
4264
|
*
|
|
4260
|
-
*
|
|
4261
|
-
*
|
|
4262
|
-
* 2
|
|
4263
|
-
* 3
|
|
4265
|
+
* 1. **Failover**: When a model call is made, it tries providers in the order they were provided.
|
|
4266
|
+
* If the first provider doesn't support the requested model or fails, it tries the next one.
|
|
4267
|
+
* 2. **Aggregation**: `listModels` returns a combined list of all models available from all providers.
|
|
4268
|
+
* 3. **Empty case**: If no tools are provided, it logs a warning (as Promptbook requires LLMs to function).
|
|
4264
4269
|
*
|
|
4270
|
+
* @param title - A descriptive title for this collection of joined tools
|
|
4271
|
+
* @param llmExecutionTools - An array of execution tools to be joined
|
|
4272
|
+
* @returns A single unified execution tool wrapper
|
|
4265
4273
|
*
|
|
4266
|
-
* Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools
|
|
4274
|
+
* Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`.
|
|
4267
4275
|
*
|
|
4268
4276
|
* @public exported from `@promptbook/core`
|
|
4269
4277
|
*/
|
|
@@ -6787,7 +6795,7 @@ async function getKnowledgeForTask(options) {
|
|
|
6787
6795
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
6788
6796
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
6789
6797
|
const { index } = knowledgePiece;
|
|
6790
|
-
const knowledgePieceIndex = index.find((
|
|
6798
|
+
const knowledgePieceIndex = index.find((knowledgePieceIndex) => knowledgePieceIndex.modelName === firstKnowledgeIndex.modelName);
|
|
6791
6799
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model
|
|
6792
6800
|
if (knowledgePieceIndex === undefined) {
|
|
6793
6801
|
return {
|
|
@@ -7235,7 +7243,7 @@ async function executePipeline(options) {
|
|
|
7235
7243
|
resovedParameterNames = [...resovedParameterNames, currentTask.resultingParameterName];
|
|
7236
7244
|
})
|
|
7237
7245
|
.then(() => {
|
|
7238
|
-
resolving = resolving.filter((
|
|
7246
|
+
resolving = resolving.filter((workItem) => workItem !== work);
|
|
7239
7247
|
});
|
|
7240
7248
|
// <- Note: Errors are catched here [3]
|
|
7241
7249
|
// TODO: BUT if in multiple tasks are errors, only the first one is catched so maybe we should catch errors here and save them to errors array here
|
|
@@ -7401,7 +7409,7 @@ function createPipelineExecutor(options) {
|
|
|
7401
7409
|
// Calculate and update tldr based on pipeline progress
|
|
7402
7410
|
const cv = newOngoingResult;
|
|
7403
7411
|
// Calculate progress based on parameters resolved vs total parameters
|
|
7404
|
-
const totalParameters = pipeline.parameters.filter((
|
|
7412
|
+
const totalParameters = pipeline.parameters.filter((parameter) => !parameter.isInput).length;
|
|
7405
7413
|
let resolvedParameters = 0;
|
|
7406
7414
|
let currentTaskTitle = '';
|
|
7407
7415
|
// Get the resolved parameters from output parameters
|