@promptbook/cli 0.92.0-33 → 0.92.0-34
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 +49 -29
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -4
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +1 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +49 -29
- package/umd/index.umd.js.map +1 -1
- /package/esm/typings/src/llm-providers/{multiple → _multiple}/MultipleLlmExecutionTools.d.ts +0 -0
- /package/esm/typings/src/llm-providers/{multiple → _multiple}/joinLlmExecutionTools.d.ts +0 -0
- /package/esm/typings/src/llm-providers/{multiple → _multiple}/playground/playground.d.ts +0 -0
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.92.0-
|
|
50
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-34';
|
|
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
|
|
@@ -2586,10 +2586,10 @@ class RemoteLlmExecutionTools {
|
|
|
2586
2586
|
}
|
|
2587
2587
|
get title() {
|
|
2588
2588
|
// TODO: [🧠] Maybe fetch title+description from the remote server (as well as if model methods are defined)
|
|
2589
|
-
return '
|
|
2589
|
+
return 'Promptbook remote server';
|
|
2590
2590
|
}
|
|
2591
2591
|
get description() {
|
|
2592
|
-
return
|
|
2592
|
+
return `Models from Promptbook remote server ${this.options.remoteServerUrl}`;
|
|
2593
2593
|
}
|
|
2594
2594
|
/**
|
|
2595
2595
|
* Check the configuration of all execution tools
|
|
@@ -2682,23 +2682,6 @@ class RemoteLlmExecutionTools {
|
|
|
2682
2682
|
* TODO: [🧠] Maybe remove `@promptbook/remote-client` and just use `@promptbook/core`
|
|
2683
2683
|
*/
|
|
2684
2684
|
|
|
2685
|
-
/**
|
|
2686
|
-
* Parses the task and returns the list of all parameter names
|
|
2687
|
-
*
|
|
2688
|
-
* @param template the string template with parameters in {curly} braces
|
|
2689
|
-
* @returns the list of parameter names
|
|
2690
|
-
* @public exported from `@promptbook/utils`
|
|
2691
|
-
*/
|
|
2692
|
-
function extractParameterNames(template) {
|
|
2693
|
-
const matches = template.matchAll(/{\w+}/g);
|
|
2694
|
-
const parameterNames = new Set();
|
|
2695
|
-
for (const match of matches) {
|
|
2696
|
-
const parameterName = match[0].slice(1, -1);
|
|
2697
|
-
parameterNames.add(parameterName);
|
|
2698
|
-
}
|
|
2699
|
-
return parameterNames;
|
|
2700
|
-
}
|
|
2701
|
-
|
|
2702
2685
|
/**
|
|
2703
2686
|
* Stores data in memory (HEAP)
|
|
2704
2687
|
*
|
|
@@ -2758,6 +2741,23 @@ function $getCurrentDate() {
|
|
|
2758
2741
|
return new Date().toISOString();
|
|
2759
2742
|
}
|
|
2760
2743
|
|
|
2744
|
+
/**
|
|
2745
|
+
* Parses the task and returns the list of all parameter names
|
|
2746
|
+
*
|
|
2747
|
+
* @param template the string template with parameters in {curly} braces
|
|
2748
|
+
* @returns the list of parameter names
|
|
2749
|
+
* @public exported from `@promptbook/utils`
|
|
2750
|
+
*/
|
|
2751
|
+
function extractParameterNames(template) {
|
|
2752
|
+
const matches = template.matchAll(/{\w+}/g);
|
|
2753
|
+
const parameterNames = new Set();
|
|
2754
|
+
for (const match of matches) {
|
|
2755
|
+
const parameterName = match[0].slice(1, -1);
|
|
2756
|
+
parameterNames.add(parameterName);
|
|
2757
|
+
}
|
|
2758
|
+
return parameterNames;
|
|
2759
|
+
}
|
|
2760
|
+
|
|
2761
2761
|
/**
|
|
2762
2762
|
* Intercepts LLM tools and counts total usage of the tools
|
|
2763
2763
|
*
|
|
@@ -2773,12 +2773,14 @@ function cacheLlmTools(llmTools, options = {}) {
|
|
|
2773
2773
|
...llmTools,
|
|
2774
2774
|
// <- Note: [🥫]
|
|
2775
2775
|
get title() {
|
|
2776
|
-
|
|
2777
|
-
|
|
2776
|
+
return `${llmTools.title} (cached)`;
|
|
2777
|
+
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2778
|
+
// <- TODO: [🧈][🧠] Does it make sence to suffix "(cached)"?
|
|
2778
2779
|
},
|
|
2779
2780
|
get description() {
|
|
2780
|
-
|
|
2781
|
-
|
|
2781
|
+
return `${llmTools.description} (cached)`;
|
|
2782
|
+
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2783
|
+
// <- TODO: [🧈][🧠] Does it make sence to suffix "(cached)"?
|
|
2782
2784
|
},
|
|
2783
2785
|
listModels() {
|
|
2784
2786
|
// TODO: [🧠] Should be model listing also cached?
|
|
@@ -3005,12 +3007,14 @@ function countUsage(llmTools) {
|
|
|
3005
3007
|
const spending = new Subject();
|
|
3006
3008
|
const proxyTools = {
|
|
3007
3009
|
get title() {
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
+
return `${llmTools.title} (+usage)`;
|
|
3011
|
+
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
3012
|
+
// <- TODO: [🧈][🧠] Does it make sence to suffix "(+usage)"?
|
|
3010
3013
|
},
|
|
3011
3014
|
get description() {
|
|
3012
|
-
|
|
3013
|
-
|
|
3015
|
+
return `${llmTools.description} (+usage)`;
|
|
3016
|
+
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
3017
|
+
// <- TODO: [🧈][🧠] Does it make sence to suffix "(+usage)"?
|
|
3014
3018
|
},
|
|
3015
3019
|
checkConfiguration() {
|
|
3016
3020
|
return /* not await */ llmTools.checkConfiguration();
|
|
@@ -3113,7 +3117,14 @@ class MultipleLlmExecutionTools {
|
|
|
3113
3117
|
return 'Multiple LLM Providers';
|
|
3114
3118
|
}
|
|
3115
3119
|
get description() {
|
|
3116
|
-
|
|
3120
|
+
const innerModelsTitlesAndDescriptions = this.llmExecutionTools
|
|
3121
|
+
.map(({ title, description }, index) => `${index + 1}) \`${title}\`\n${description}`)
|
|
3122
|
+
.join('\n\n');
|
|
3123
|
+
return spaceTrim((block) => `
|
|
3124
|
+
Multiple LLM Providers:
|
|
3125
|
+
|
|
3126
|
+
${block(innerModelsTitlesAndDescriptions)}
|
|
3127
|
+
`);
|
|
3117
3128
|
}
|
|
3118
3129
|
/**
|
|
3119
3130
|
* Check the configuration of all execution tools
|
|
@@ -6763,6 +6774,7 @@ function knowledgePiecesToString(knowledgePieces) {
|
|
|
6763
6774
|
*/
|
|
6764
6775
|
async function getKnowledgeForTask(options) {
|
|
6765
6776
|
const { tools, preparedPipeline, task, parameters } = options;
|
|
6777
|
+
console.log('!!! getKnowledgeForTask', options);
|
|
6766
6778
|
const firstKnowlegePiece = preparedPipeline.knowledgePieces[0];
|
|
6767
6779
|
const firstKnowlegeIndex = firstKnowlegePiece === null || firstKnowlegePiece === void 0 ? void 0 : firstKnowlegePiece.index[0];
|
|
6768
6780
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
|
|
@@ -16470,12 +16482,14 @@ function createExecutionToolsFromVercelProvider(options) {
|
|
|
16470
16482
|
const { vercelProvider, availableModels, userId, additionalChatSettings = {} } = options;
|
|
16471
16483
|
if (!/Vercel/i.test(title)) {
|
|
16472
16484
|
title = `${title} (through Vercel)`;
|
|
16485
|
+
// <- TODO: [🧈] Maybe standartize the suffix
|
|
16473
16486
|
} /* not else */
|
|
16474
16487
|
if (description === undefined) {
|
|
16475
16488
|
description = `Implementation of ${title} through Vercel`;
|
|
16476
16489
|
} /* not else */
|
|
16477
16490
|
if (!/Vercel/i.test(description)) {
|
|
16478
16491
|
description = `${description} (through Vercel)`;
|
|
16492
|
+
// <- TODO: [🧈] Maybe standartize the suffix
|
|
16479
16493
|
} /* not else */
|
|
16480
16494
|
return {
|
|
16481
16495
|
title,
|
|
@@ -17862,6 +17876,12 @@ class MarkdownScraper {
|
|
|
17862
17876
|
}
|
|
17863
17877
|
// ---
|
|
17864
17878
|
if (!llmTools.callEmbeddingModel) {
|
|
17879
|
+
console.log('!!! No callEmbeddingModel function provided', {
|
|
17880
|
+
'llmTools.title': llmTools.title,
|
|
17881
|
+
'llmTools.description': llmTools.description,
|
|
17882
|
+
'llmTools.callEmbeddingModel': llmTools.callEmbeddingModel,
|
|
17883
|
+
llmTools,
|
|
17884
|
+
});
|
|
17865
17885
|
// TODO: [🟥] Detect browser / node and make it colorfull
|
|
17866
17886
|
console.error('No callEmbeddingModel function provided');
|
|
17867
17887
|
}
|