@promptbook/remote-server 0.104.0-9 → 0.104.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 +0 -4
- package/esm/index.es.js +34 -25
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +0 -6
- package/esm/typings/src/_packages/core.index.d.ts +8 -6
- package/esm/typings/src/_packages/types.index.d.ts +8 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +24 -0
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +12 -2
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.tools.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/save/_common/string_chat_format_name.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +6 -3
- package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +5 -1
- package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +5 -1
- 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/AgentCollection.d.ts +1 -1
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +9 -7
- package/esm/typings/src/commands/_common/types/Command.d.ts +1 -1
- package/esm/typings/src/commitments/META/META_DESCRIPTION.d.ts +41 -0
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +2 -2
- package/esm/typings/src/commitments/_base/BookCommitment.d.ts +1 -1
- package/esm/typings/src/config.d.ts +8 -1
- package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +8 -4
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +1 -1
- package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +12 -8
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +7 -1
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/utils/mapToolsToOpenAi.d.ts +8 -0
- package/esm/typings/src/remote-server/ui/ServerApp.d.ts +5 -1
- package/esm/typings/src/scrapers/_common/utils/promptbookFetch.test.d.ts +1 -0
- package/esm/typings/src/search-engines/SearchEngine.d.ts +9 -0
- package/esm/typings/src/search-engines/SearchResult.d.ts +18 -0
- package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +15 -0
- package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +15 -0
- package/esm/typings/src/types/LlmToolDefinition.d.ts +20 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +13 -0
- package/esm/typings/src/types/typeAliasEmoji.d.ts +2 -2
- package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +7 -2
- package/esm/typings/src/utils/random/$randomItem.d.ts +1 -1
- package/esm/typings/src/utils/random/$randomSeed.d.ts +1 -1
- package/esm/typings/src/utils/validators/url/isValidAgentUrl.d.ts +16 -0
- package/esm/typings/src/utils/validators/url/isValidAgentUrl.test.d.ts +1 -0
- package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -1
- package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +4 -3
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +34 -25
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/servers.d.ts +0 -50
package/umd/index.umd.js
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
* @generated
|
|
48
48
|
* @see https://github.com/webgptorg/promptbook
|
|
49
49
|
*/
|
|
50
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.104.0
|
|
50
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.104.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
|
|
@@ -2462,9 +2462,10 @@
|
|
|
2462
2462
|
*
|
|
2463
2463
|
* Note: [🔂] This function is idempotent.
|
|
2464
2464
|
* Note: Dataurl are considered perfectly valid.
|
|
2465
|
-
* Note: There are
|
|
2466
|
-
* - `isValidUrl` which tests any URL
|
|
2467
|
-
* - `
|
|
2465
|
+
* Note: There are few similar functions:
|
|
2466
|
+
* - `isValidUrl` *(this one)* which tests any URL
|
|
2467
|
+
* - `isValidAgentUrl` which tests just agent URL
|
|
2468
|
+
* - `isValidPipelineUrl` which tests just pipeline URL
|
|
2468
2469
|
*
|
|
2469
2470
|
* @public exported from `@promptbook/utils`
|
|
2470
2471
|
*/
|
|
@@ -2490,8 +2491,9 @@
|
|
|
2490
2491
|
/**
|
|
2491
2492
|
* Tests if given string is valid pipeline URL URL.
|
|
2492
2493
|
*
|
|
2493
|
-
* Note: There are
|
|
2494
|
+
* Note: There are few similar functions:
|
|
2494
2495
|
* - `isValidUrl` which tests any URL
|
|
2496
|
+
* - `isValidAgentUrl` which tests just agent URL
|
|
2495
2497
|
* - `isValidPipelineUrl` *(this one)* which tests just pipeline URL
|
|
2496
2498
|
*
|
|
2497
2499
|
* @public exported from `@promptbook/utils`
|
|
@@ -3726,7 +3728,7 @@
|
|
|
3726
3728
|
tasks.push(task);
|
|
3727
3729
|
runningTasks.push(task);
|
|
3728
3730
|
/* not await */ Promise.resolve(task).then(() => {
|
|
3729
|
-
runningTasks = runningTasks.filter((
|
|
3731
|
+
runningTasks = runningTasks.filter((runningTask) => runningTask !== task);
|
|
3730
3732
|
});
|
|
3731
3733
|
if (maxParallelCount < runningTasks.length) {
|
|
3732
3734
|
await Promise.race(runningTasks);
|
|
@@ -3783,10 +3785,14 @@
|
|
|
3783
3785
|
}
|
|
3784
3786
|
|
|
3785
3787
|
/**
|
|
3786
|
-
* Intercepts LLM tools and counts total usage of the tools
|
|
3788
|
+
* Intercepts LLM tools and counts total usage of the tools.
|
|
3789
|
+
*
|
|
3790
|
+
* This function wraps the provided `LlmExecutionTools` with a proxy that tracks the cumulative
|
|
3791
|
+
* usage (tokens, cost, etc.) across all model calls. It provides a way to monitor spending
|
|
3792
|
+
* in real-time through an observable.
|
|
3787
3793
|
*
|
|
3788
|
-
* @param llmTools LLM tools to be intercepted
|
|
3789
|
-
* @returns
|
|
3794
|
+
* @param llmTools - The LLM tools to be intercepted and tracked
|
|
3795
|
+
* @returns An augmented version of the tools that includes usage tracking capabilities
|
|
3790
3796
|
* @public exported from `@promptbook/core`
|
|
3791
3797
|
*/
|
|
3792
3798
|
function countUsage(llmTools) {
|
|
@@ -3861,7 +3867,7 @@
|
|
|
3861
3867
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
3862
3868
|
* TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
|
|
3863
3869
|
* > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
|
|
3864
|
-
* TODO: [👷♂️]
|
|
3870
|
+
* TODO: [👷♂️] Write a comprehensive manual explaining the construction and usage of LLM tools in the Promptbook ecosystem
|
|
3865
3871
|
*/
|
|
3866
3872
|
|
|
3867
3873
|
/**
|
|
@@ -4051,17 +4057,21 @@
|
|
|
4051
4057
|
*/
|
|
4052
4058
|
|
|
4053
4059
|
/**
|
|
4054
|
-
* Joins multiple LLM Execution Tools into one
|
|
4060
|
+
* Joins multiple LLM Execution Tools into one.
|
|
4055
4061
|
*
|
|
4056
|
-
*
|
|
4062
|
+
* This function takes a list of `LlmExecutionTools` and returns a single unified
|
|
4063
|
+
* `MultipleLlmExecutionTools` object. It provides failover and aggregation logic:
|
|
4057
4064
|
*
|
|
4058
|
-
*
|
|
4059
|
-
*
|
|
4060
|
-
* 2
|
|
4061
|
-
* 3
|
|
4065
|
+
* 1. **Failover**: When a model call is made, it tries providers in the order they were provided.
|
|
4066
|
+
* If the first provider doesn't support the requested model or fails, it tries the next one.
|
|
4067
|
+
* 2. **Aggregation**: `listModels` returns a combined list of all models available from all providers.
|
|
4068
|
+
* 3. **Empty case**: If no tools are provided, it logs a warning (as Promptbook requires LLMs to function).
|
|
4062
4069
|
*
|
|
4070
|
+
* @param title - A descriptive title for this collection of joined tools
|
|
4071
|
+
* @param llmExecutionTools - An array of execution tools to be joined
|
|
4072
|
+
* @returns A single unified execution tool wrapper
|
|
4063
4073
|
*
|
|
4064
|
-
* Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools
|
|
4074
|
+
* Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`.
|
|
4065
4075
|
*
|
|
4066
4076
|
* @public exported from `@promptbook/core`
|
|
4067
4077
|
*/
|
|
@@ -4101,7 +4111,7 @@
|
|
|
4101
4111
|
}
|
|
4102
4112
|
/**
|
|
4103
4113
|
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
4104
|
-
* TODO: [👷♂️]
|
|
4114
|
+
* TODO: [👷♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
|
|
4105
4115
|
*/
|
|
4106
4116
|
|
|
4107
4117
|
/**
|
|
@@ -4118,7 +4128,7 @@
|
|
|
4118
4128
|
}
|
|
4119
4129
|
/**
|
|
4120
4130
|
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
4121
|
-
* TODO: [👷♂️]
|
|
4131
|
+
* TODO: [👷♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
|
|
4122
4132
|
*/
|
|
4123
4133
|
|
|
4124
4134
|
/**
|
|
@@ -4688,8 +4698,8 @@
|
|
|
4688
4698
|
*/
|
|
4689
4699
|
function removeDiacritics(input) {
|
|
4690
4700
|
/*eslint no-control-regex: "off"*/
|
|
4691
|
-
return input.replace(/[^\u0000-\u007E]/g, (
|
|
4692
|
-
return DIACRITIC_VARIANTS_LETTERS[
|
|
4701
|
+
return input.replace(/[^\u0000-\u007E]/g, (character) => {
|
|
4702
|
+
return DIACRITIC_VARIANTS_LETTERS[character] || character;
|
|
4693
4703
|
});
|
|
4694
4704
|
}
|
|
4695
4705
|
/**
|
|
@@ -4918,7 +4928,6 @@
|
|
|
4918
4928
|
* @public exported from `@promptbook/core`
|
|
4919
4929
|
*/
|
|
4920
4930
|
async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
4921
|
-
// console.log('!! makeKnowledgeSourceHandler', knowledgeSource);
|
|
4922
4931
|
var _a;
|
|
4923
4932
|
const { fetch = promptbookFetch } = tools;
|
|
4924
4933
|
const { knowledgeSourceContent } = knowledgeSource;
|
|
@@ -7007,7 +7016,7 @@
|
|
|
7007
7016
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
7008
7017
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
7009
7018
|
const { index } = knowledgePiece;
|
|
7010
|
-
const knowledgePieceIndex = index.find((
|
|
7019
|
+
const knowledgePieceIndex = index.find((knowledgePieceIndex) => knowledgePieceIndex.modelName === firstKnowledgeIndex.modelName);
|
|
7011
7020
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model
|
|
7012
7021
|
if (knowledgePieceIndex === undefined) {
|
|
7013
7022
|
return {
|
|
@@ -7455,7 +7464,7 @@
|
|
|
7455
7464
|
resovedParameterNames = [...resovedParameterNames, currentTask.resultingParameterName];
|
|
7456
7465
|
})
|
|
7457
7466
|
.then(() => {
|
|
7458
|
-
resolving = resolving.filter((
|
|
7467
|
+
resolving = resolving.filter((workItem) => workItem !== work);
|
|
7459
7468
|
});
|
|
7460
7469
|
// <- Note: Errors are catched here [3]
|
|
7461
7470
|
// 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
|
|
@@ -7621,7 +7630,7 @@
|
|
|
7621
7630
|
// Calculate and update tldr based on pipeline progress
|
|
7622
7631
|
const cv = newOngoingResult;
|
|
7623
7632
|
// Calculate progress based on parameters resolved vs total parameters
|
|
7624
|
-
const totalParameters = pipeline.parameters.filter((
|
|
7633
|
+
const totalParameters = pipeline.parameters.filter((parameter) => !parameter.isInput).length;
|
|
7625
7634
|
let resolvedParameters = 0;
|
|
7626
7635
|
let currentTaskTitle = '';
|
|
7627
7636
|
// Get the resolved parameters from output parameters
|