@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
|
@@ -102,12 +102,12 @@ import { createLlmToolsFromConfiguration } from '../llm-providers/_common/regist
|
|
|
102
102
|
import { cacheLlmTools } from '../llm-providers/_common/utils/cache/cacheLlmTools';
|
|
103
103
|
import { countUsage } from '../llm-providers/_common/utils/count-total-usage/countUsage';
|
|
104
104
|
import { limitTotalUsage } from '../llm-providers/_common/utils/count-total-usage/limitTotalUsage';
|
|
105
|
+
import { joinLlmExecutionTools } from '../llm-providers/_multiple/joinLlmExecutionTools';
|
|
106
|
+
import { MultipleLlmExecutionTools } from '../llm-providers/_multiple/MultipleLlmExecutionTools';
|
|
105
107
|
import { _AnthropicClaudeMetadataRegistration } from '../llm-providers/anthropic-claude/register-configuration';
|
|
106
108
|
import { _AzureOpenAiMetadataRegistration } from '../llm-providers/azure-openai/register-configuration';
|
|
107
109
|
import { _DeepseekMetadataRegistration } from '../llm-providers/deepseek/register-configuration';
|
|
108
110
|
import { _GoogleMetadataRegistration } from '../llm-providers/google/register-configuration';
|
|
109
|
-
import { joinLlmExecutionTools } from '../llm-providers/multiple/joinLlmExecutionTools';
|
|
110
|
-
import { MultipleLlmExecutionTools } from '../llm-providers/multiple/MultipleLlmExecutionTools';
|
|
111
111
|
import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
112
112
|
import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
113
113
|
import { migratePipeline } from '../migrations/migratePipeline';
|
|
@@ -249,12 +249,12 @@ export { createLlmToolsFromConfiguration };
|
|
|
249
249
|
export { cacheLlmTools };
|
|
250
250
|
export { countUsage };
|
|
251
251
|
export { limitTotalUsage };
|
|
252
|
+
export { joinLlmExecutionTools };
|
|
253
|
+
export { MultipleLlmExecutionTools };
|
|
252
254
|
export { _AnthropicClaudeMetadataRegistration };
|
|
253
255
|
export { _AzureOpenAiMetadataRegistration };
|
|
254
256
|
export { _DeepseekMetadataRegistration };
|
|
255
257
|
export { _GoogleMetadataRegistration };
|
|
256
|
-
export { joinLlmExecutionTools };
|
|
257
|
-
export { MultipleLlmExecutionTools };
|
|
258
258
|
export { _OpenAiMetadataRegistration };
|
|
259
259
|
export { _OpenAiAssistantMetadataRegistration };
|
|
260
260
|
export { migratePipeline };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MultipleLlmExecutionTools } from '../../
|
|
1
|
+
import { MultipleLlmExecutionTools } from '../../_multiple/MultipleLlmExecutionTools';
|
|
2
2
|
import type { CreateLlmToolsFromConfigurationOptions } from './createLlmToolsFromConfiguration';
|
|
3
3
|
/**
|
|
4
4
|
* Automatically configures LLM tools from environment variables in Node.js
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { string_user_id } from '../../../types/typeAliases';
|
|
2
|
-
import { MultipleLlmExecutionTools } from '../../
|
|
2
|
+
import { MultipleLlmExecutionTools } from '../../_multiple/MultipleLlmExecutionTools';
|
|
3
3
|
import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
|
|
4
4
|
/**
|
|
5
5
|
* Options for `$provideLlmToolsFromEnv`
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.92.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.92.0-33`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
* @generated
|
|
58
58
|
* @see https://github.com/webgptorg/promptbook
|
|
59
59
|
*/
|
|
60
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
60
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-34';
|
|
61
61
|
/**
|
|
62
62
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
63
63
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2596,10 +2596,10 @@
|
|
|
2596
2596
|
}
|
|
2597
2597
|
get title() {
|
|
2598
2598
|
// TODO: [🧠] Maybe fetch title+description from the remote server (as well as if model methods are defined)
|
|
2599
|
-
return '
|
|
2599
|
+
return 'Promptbook remote server';
|
|
2600
2600
|
}
|
|
2601
2601
|
get description() {
|
|
2602
|
-
return
|
|
2602
|
+
return `Models from Promptbook remote server ${this.options.remoteServerUrl}`;
|
|
2603
2603
|
}
|
|
2604
2604
|
/**
|
|
2605
2605
|
* Check the configuration of all execution tools
|
|
@@ -2692,23 +2692,6 @@
|
|
|
2692
2692
|
* TODO: [🧠] Maybe remove `@promptbook/remote-client` and just use `@promptbook/core`
|
|
2693
2693
|
*/
|
|
2694
2694
|
|
|
2695
|
-
/**
|
|
2696
|
-
* Parses the task and returns the list of all parameter names
|
|
2697
|
-
*
|
|
2698
|
-
* @param template the string template with parameters in {curly} braces
|
|
2699
|
-
* @returns the list of parameter names
|
|
2700
|
-
* @public exported from `@promptbook/utils`
|
|
2701
|
-
*/
|
|
2702
|
-
function extractParameterNames(template) {
|
|
2703
|
-
const matches = template.matchAll(/{\w+}/g);
|
|
2704
|
-
const parameterNames = new Set();
|
|
2705
|
-
for (const match of matches) {
|
|
2706
|
-
const parameterName = match[0].slice(1, -1);
|
|
2707
|
-
parameterNames.add(parameterName);
|
|
2708
|
-
}
|
|
2709
|
-
return parameterNames;
|
|
2710
|
-
}
|
|
2711
|
-
|
|
2712
2695
|
/**
|
|
2713
2696
|
* Stores data in memory (HEAP)
|
|
2714
2697
|
*
|
|
@@ -2768,6 +2751,23 @@
|
|
|
2768
2751
|
return new Date().toISOString();
|
|
2769
2752
|
}
|
|
2770
2753
|
|
|
2754
|
+
/**
|
|
2755
|
+
* Parses the task and returns the list of all parameter names
|
|
2756
|
+
*
|
|
2757
|
+
* @param template the string template with parameters in {curly} braces
|
|
2758
|
+
* @returns the list of parameter names
|
|
2759
|
+
* @public exported from `@promptbook/utils`
|
|
2760
|
+
*/
|
|
2761
|
+
function extractParameterNames(template) {
|
|
2762
|
+
const matches = template.matchAll(/{\w+}/g);
|
|
2763
|
+
const parameterNames = new Set();
|
|
2764
|
+
for (const match of matches) {
|
|
2765
|
+
const parameterName = match[0].slice(1, -1);
|
|
2766
|
+
parameterNames.add(parameterName);
|
|
2767
|
+
}
|
|
2768
|
+
return parameterNames;
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
2771
|
/**
|
|
2772
2772
|
* Intercepts LLM tools and counts total usage of the tools
|
|
2773
2773
|
*
|
|
@@ -2783,12 +2783,14 @@
|
|
|
2783
2783
|
...llmTools,
|
|
2784
2784
|
// <- Note: [🥫]
|
|
2785
2785
|
get title() {
|
|
2786
|
-
|
|
2787
|
-
|
|
2786
|
+
return `${llmTools.title} (cached)`;
|
|
2787
|
+
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2788
|
+
// <- TODO: [🧈][🧠] Does it make sence to suffix "(cached)"?
|
|
2788
2789
|
},
|
|
2789
2790
|
get description() {
|
|
2790
|
-
|
|
2791
|
-
|
|
2791
|
+
return `${llmTools.description} (cached)`;
|
|
2792
|
+
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
2793
|
+
// <- TODO: [🧈][🧠] Does it make sence to suffix "(cached)"?
|
|
2792
2794
|
},
|
|
2793
2795
|
listModels() {
|
|
2794
2796
|
// TODO: [🧠] Should be model listing also cached?
|
|
@@ -3015,12 +3017,14 @@
|
|
|
3015
3017
|
const spending = new rxjs.Subject();
|
|
3016
3018
|
const proxyTools = {
|
|
3017
3019
|
get title() {
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
+
return `${llmTools.title} (+usage)`;
|
|
3021
|
+
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
3022
|
+
// <- TODO: [🧈][🧠] Does it make sence to suffix "(+usage)"?
|
|
3020
3023
|
},
|
|
3021
3024
|
get description() {
|
|
3022
|
-
|
|
3023
|
-
|
|
3025
|
+
return `${llmTools.description} (+usage)`;
|
|
3026
|
+
// <- TODO: [🧈] Maybe standartize the suffix when wrapping `LlmExecutionTools` up
|
|
3027
|
+
// <- TODO: [🧈][🧠] Does it make sence to suffix "(+usage)"?
|
|
3024
3028
|
},
|
|
3025
3029
|
checkConfiguration() {
|
|
3026
3030
|
return /* not await */ llmTools.checkConfiguration();
|
|
@@ -3123,7 +3127,14 @@
|
|
|
3123
3127
|
return 'Multiple LLM Providers';
|
|
3124
3128
|
}
|
|
3125
3129
|
get description() {
|
|
3126
|
-
|
|
3130
|
+
const innerModelsTitlesAndDescriptions = this.llmExecutionTools
|
|
3131
|
+
.map(({ title, description }, index) => `${index + 1}) \`${title}\`\n${description}`)
|
|
3132
|
+
.join('\n\n');
|
|
3133
|
+
return spaceTrim__default["default"]((block) => `
|
|
3134
|
+
Multiple LLM Providers:
|
|
3135
|
+
|
|
3136
|
+
${block(innerModelsTitlesAndDescriptions)}
|
|
3137
|
+
`);
|
|
3127
3138
|
}
|
|
3128
3139
|
/**
|
|
3129
3140
|
* Check the configuration of all execution tools
|
|
@@ -6773,6 +6784,7 @@
|
|
|
6773
6784
|
*/
|
|
6774
6785
|
async function getKnowledgeForTask(options) {
|
|
6775
6786
|
const { tools, preparedPipeline, task, parameters } = options;
|
|
6787
|
+
console.log('!!! getKnowledgeForTask', options);
|
|
6776
6788
|
const firstKnowlegePiece = preparedPipeline.knowledgePieces[0];
|
|
6777
6789
|
const firstKnowlegeIndex = firstKnowlegePiece === null || firstKnowlegePiece === void 0 ? void 0 : firstKnowlegePiece.index[0];
|
|
6778
6790
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model, use also keyword search
|
|
@@ -16480,12 +16492,14 @@
|
|
|
16480
16492
|
const { vercelProvider, availableModels, userId, additionalChatSettings = {} } = options;
|
|
16481
16493
|
if (!/Vercel/i.test(title)) {
|
|
16482
16494
|
title = `${title} (through Vercel)`;
|
|
16495
|
+
// <- TODO: [🧈] Maybe standartize the suffix
|
|
16483
16496
|
} /* not else */
|
|
16484
16497
|
if (description === undefined) {
|
|
16485
16498
|
description = `Implementation of ${title} through Vercel`;
|
|
16486
16499
|
} /* not else */
|
|
16487
16500
|
if (!/Vercel/i.test(description)) {
|
|
16488
16501
|
description = `${description} (through Vercel)`;
|
|
16502
|
+
// <- TODO: [🧈] Maybe standartize the suffix
|
|
16489
16503
|
} /* not else */
|
|
16490
16504
|
return {
|
|
16491
16505
|
title,
|
|
@@ -17872,6 +17886,12 @@
|
|
|
17872
17886
|
}
|
|
17873
17887
|
// ---
|
|
17874
17888
|
if (!llmTools.callEmbeddingModel) {
|
|
17889
|
+
console.log('!!! No callEmbeddingModel function provided', {
|
|
17890
|
+
'llmTools.title': llmTools.title,
|
|
17891
|
+
'llmTools.description': llmTools.description,
|
|
17892
|
+
'llmTools.callEmbeddingModel': llmTools.callEmbeddingModel,
|
|
17893
|
+
llmTools,
|
|
17894
|
+
});
|
|
17875
17895
|
// TODO: [🟥] Detect browser / node and make it colorfull
|
|
17876
17896
|
console.error('No callEmbeddingModel function provided');
|
|
17877
17897
|
}
|