@promptbook/legacy-documents 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/README.md
CHANGED
|
@@ -27,10 +27,6 @@ Turn your company's scattered knowledge into AI ready Books
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
<blockquote style="color: #ff8811">
|
|
31
|
-
<b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
32
|
-
</blockquote>
|
|
33
|
-
|
|
34
30
|
## 📦 Package `@promptbook/legacy-documents`
|
|
35
31
|
|
|
36
32
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
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';
|
|
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
|
/**
|
|
@@ -1878,9 +1878,10 @@ function isValidFilePath(filename) {
|
|
|
1878
1878
|
*
|
|
1879
1879
|
* Note: [🔂] This function is idempotent.
|
|
1880
1880
|
* Note: Dataurl are considered perfectly valid.
|
|
1881
|
-
* Note: There are
|
|
1882
|
-
* - `isValidUrl` which tests any URL
|
|
1883
|
-
* - `
|
|
1881
|
+
* Note: There are few similar functions:
|
|
1882
|
+
* - `isValidUrl` *(this one)* which tests any URL
|
|
1883
|
+
* - `isValidAgentUrl` which tests just agent URL
|
|
1884
|
+
* - `isValidPipelineUrl` which tests just pipeline URL
|
|
1884
1885
|
*
|
|
1885
1886
|
* @public exported from `@promptbook/utils`
|
|
1886
1887
|
*/
|
|
@@ -2676,8 +2677,9 @@ function isValidPromptbookVersion(version) {
|
|
|
2676
2677
|
/**
|
|
2677
2678
|
* Tests if given string is valid pipeline URL URL.
|
|
2678
2679
|
*
|
|
2679
|
-
* Note: There are
|
|
2680
|
+
* Note: There are few similar functions:
|
|
2680
2681
|
* - `isValidUrl` which tests any URL
|
|
2682
|
+
* - `isValidAgentUrl` which tests just agent URL
|
|
2681
2683
|
* - `isValidPipelineUrl` *(this one)* which tests just pipeline URL
|
|
2682
2684
|
*
|
|
2683
2685
|
* @public exported from `@promptbook/utils`
|
|
@@ -3928,7 +3930,7 @@ async function forEachAsync(array, options, callbackfunction) {
|
|
|
3928
3930
|
tasks.push(task);
|
|
3929
3931
|
runningTasks.push(task);
|
|
3930
3932
|
/* not await */ Promise.resolve(task).then(() => {
|
|
3931
|
-
runningTasks = runningTasks.filter((
|
|
3933
|
+
runningTasks = runningTasks.filter((runningTask) => runningTask !== task);
|
|
3932
3934
|
});
|
|
3933
3935
|
if (maxParallelCount < runningTasks.length) {
|
|
3934
3936
|
await Promise.race(runningTasks);
|
|
@@ -3985,10 +3987,14 @@ function addUsage(...usageItems) {
|
|
|
3985
3987
|
}
|
|
3986
3988
|
|
|
3987
3989
|
/**
|
|
3988
|
-
* Intercepts LLM tools and counts total usage of the tools
|
|
3990
|
+
* Intercepts LLM tools and counts total usage of the tools.
|
|
3991
|
+
*
|
|
3992
|
+
* This function wraps the provided `LlmExecutionTools` with a proxy that tracks the cumulative
|
|
3993
|
+
* usage (tokens, cost, etc.) across all model calls. It provides a way to monitor spending
|
|
3994
|
+
* in real-time through an observable.
|
|
3989
3995
|
*
|
|
3990
|
-
* @param llmTools LLM tools to be intercepted
|
|
3991
|
-
* @returns
|
|
3996
|
+
* @param llmTools - The LLM tools to be intercepted and tracked
|
|
3997
|
+
* @returns An augmented version of the tools that includes usage tracking capabilities
|
|
3992
3998
|
* @public exported from `@promptbook/core`
|
|
3993
3999
|
*/
|
|
3994
4000
|
function countUsage(llmTools) {
|
|
@@ -4063,7 +4069,7 @@ function countUsage(llmTools) {
|
|
|
4063
4069
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
4064
4070
|
* TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
|
|
4065
4071
|
* > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
|
|
4066
|
-
* TODO: [👷♂️]
|
|
4072
|
+
* TODO: [👷♂️] Write a comprehensive manual explaining the construction and usage of LLM tools in the Promptbook ecosystem
|
|
4067
4073
|
*/
|
|
4068
4074
|
|
|
4069
4075
|
/**
|
|
@@ -4253,17 +4259,21 @@ class MultipleLlmExecutionTools {
|
|
|
4253
4259
|
*/
|
|
4254
4260
|
|
|
4255
4261
|
/**
|
|
4256
|
-
* Joins multiple LLM Execution Tools into one
|
|
4262
|
+
* Joins multiple LLM Execution Tools into one.
|
|
4257
4263
|
*
|
|
4258
|
-
*
|
|
4264
|
+
* This function takes a list of `LlmExecutionTools` and returns a single unified
|
|
4265
|
+
* `MultipleLlmExecutionTools` object. It provides failover and aggregation logic:
|
|
4259
4266
|
*
|
|
4260
|
-
*
|
|
4261
|
-
*
|
|
4262
|
-
* 2
|
|
4263
|
-
* 3
|
|
4267
|
+
* 1. **Failover**: When a model call is made, it tries providers in the order they were provided.
|
|
4268
|
+
* If the first provider doesn't support the requested model or fails, it tries the next one.
|
|
4269
|
+
* 2. **Aggregation**: `listModels` returns a combined list of all models available from all providers.
|
|
4270
|
+
* 3. **Empty case**: If no tools are provided, it logs a warning (as Promptbook requires LLMs to function).
|
|
4264
4271
|
*
|
|
4272
|
+
* @param title - A descriptive title for this collection of joined tools
|
|
4273
|
+
* @param llmExecutionTools - An array of execution tools to be joined
|
|
4274
|
+
* @returns A single unified execution tool wrapper
|
|
4265
4275
|
*
|
|
4266
|
-
* Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools
|
|
4276
|
+
* Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`.
|
|
4267
4277
|
*
|
|
4268
4278
|
* @public exported from `@promptbook/core`
|
|
4269
4279
|
*/
|
|
@@ -4303,7 +4313,7 @@ function joinLlmExecutionTools(title, ...llmExecutionTools) {
|
|
|
4303
4313
|
}
|
|
4304
4314
|
/**
|
|
4305
4315
|
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
4306
|
-
* TODO: [👷♂️]
|
|
4316
|
+
* TODO: [👷♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
|
|
4307
4317
|
*/
|
|
4308
4318
|
|
|
4309
4319
|
/**
|
|
@@ -4320,7 +4330,7 @@ function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools) {
|
|
|
4320
4330
|
}
|
|
4321
4331
|
/**
|
|
4322
4332
|
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
4323
|
-
* TODO: [👷♂️]
|
|
4333
|
+
* TODO: [👷♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
|
|
4324
4334
|
*/
|
|
4325
4335
|
|
|
4326
4336
|
/**
|
|
@@ -4715,7 +4725,6 @@ const promptbookFetch = async (urlOrRequest, init) => {
|
|
|
4715
4725
|
* @public exported from `@promptbook/core`
|
|
4716
4726
|
*/
|
|
4717
4727
|
async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
4718
|
-
// console.log('!! makeKnowledgeSourceHandler', knowledgeSource);
|
|
4719
4728
|
var _a;
|
|
4720
4729
|
const { fetch = promptbookFetch } = tools;
|
|
4721
4730
|
const { knowledgeSourceContent } = knowledgeSource;
|
|
@@ -6787,7 +6796,7 @@ async function getKnowledgeForTask(options) {
|
|
|
6787
6796
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
6788
6797
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
6789
6798
|
const { index } = knowledgePiece;
|
|
6790
|
-
const knowledgePieceIndex = index.find((
|
|
6799
|
+
const knowledgePieceIndex = index.find((knowledgePieceIndex) => knowledgePieceIndex.modelName === firstKnowledgeIndex.modelName);
|
|
6791
6800
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model
|
|
6792
6801
|
if (knowledgePieceIndex === undefined) {
|
|
6793
6802
|
return {
|
|
@@ -7235,7 +7244,7 @@ async function executePipeline(options) {
|
|
|
7235
7244
|
resovedParameterNames = [...resovedParameterNames, currentTask.resultingParameterName];
|
|
7236
7245
|
})
|
|
7237
7246
|
.then(() => {
|
|
7238
|
-
resolving = resolving.filter((
|
|
7247
|
+
resolving = resolving.filter((workItem) => workItem !== work);
|
|
7239
7248
|
});
|
|
7240
7249
|
// <- Note: Errors are catched here [3]
|
|
7241
7250
|
// 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 +7410,7 @@ function createPipelineExecutor(options) {
|
|
|
7401
7410
|
// Calculate and update tldr based on pipeline progress
|
|
7402
7411
|
const cv = newOngoingResult;
|
|
7403
7412
|
// Calculate progress based on parameters resolved vs total parameters
|
|
7404
|
-
const totalParameters = pipeline.parameters.filter((
|
|
7413
|
+
const totalParameters = pipeline.parameters.filter((parameter) => !parameter.isInput).length;
|
|
7405
7414
|
let resolvedParameters = 0;
|
|
7406
7415
|
let currentTaskTitle = '';
|
|
7407
7416
|
// Get the resolved parameters from output parameters
|