@promptbook/node 0.104.0-2 → 0.104.0-4
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 +23 -2
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +7 -11
- package/esm/typings/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +6 -2
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/types/Message.d.ts +49 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +23 -2
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -28,7 +28,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
28
28
|
* @generated
|
|
29
29
|
* @see https://github.com/webgptorg/promptbook
|
|
30
30
|
*/
|
|
31
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-
|
|
31
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-4';
|
|
32
32
|
/**
|
|
33
33
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
34
34
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -4039,6 +4039,12 @@ class MultipleLlmExecutionTools {
|
|
|
4039
4039
|
callEmbeddingModel(prompt) {
|
|
4040
4040
|
return this.callCommonModel(prompt);
|
|
4041
4041
|
}
|
|
4042
|
+
/**
|
|
4043
|
+
* Calls the best available embedding model
|
|
4044
|
+
*/
|
|
4045
|
+
callImageGenerationModel(prompt) {
|
|
4046
|
+
return this.callCommonModel(prompt);
|
|
4047
|
+
}
|
|
4042
4048
|
// <- Note: [🤖]
|
|
4043
4049
|
/**
|
|
4044
4050
|
* Calls the best available model
|
|
@@ -4065,6 +4071,11 @@ class MultipleLlmExecutionTools {
|
|
|
4065
4071
|
continue llm;
|
|
4066
4072
|
}
|
|
4067
4073
|
return await llmExecutionTools.callEmbeddingModel(prompt);
|
|
4074
|
+
case 'IMAGE_GENERATION':
|
|
4075
|
+
if (llmExecutionTools.callImageGenerationModel === undefined) {
|
|
4076
|
+
continue llm;
|
|
4077
|
+
}
|
|
4078
|
+
return await llmExecutionTools.callImageGenerationModel(prompt);
|
|
4068
4079
|
// <- case [🤖]:
|
|
4069
4080
|
default:
|
|
4070
4081
|
throw new UnexpectedError(`Unknown model variant "${prompt.modelRequirements.modelVariant}" in ${llmExecutionTools.title}`);
|
|
@@ -4968,8 +4979,9 @@ async function executeAttempts(options) {
|
|
|
4968
4979
|
$ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
|
|
4969
4980
|
break variant;
|
|
4970
4981
|
case 'EMBEDDING':
|
|
4982
|
+
case 'IMAGE_GENERATION':
|
|
4971
4983
|
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
4972
|
-
|
|
4984
|
+
${modelRequirements.modelVariant} model can not be used in pipeline
|
|
4973
4985
|
|
|
4974
4986
|
This should be catched during parsing
|
|
4975
4987
|
|
|
@@ -6194,6 +6206,15 @@ function countUsage(llmTools) {
|
|
|
6194
6206
|
return promptResult;
|
|
6195
6207
|
};
|
|
6196
6208
|
}
|
|
6209
|
+
if (llmTools.callImageGenerationModel !== undefined) {
|
|
6210
|
+
proxyTools.callImageGenerationModel = async (prompt) => {
|
|
6211
|
+
// console.info('[🚕] callImageGenerationModel through countTotalUsage');
|
|
6212
|
+
const promptResult = await llmTools.callImageGenerationModel(prompt);
|
|
6213
|
+
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
6214
|
+
spending.next(promptResult.usage);
|
|
6215
|
+
return promptResult;
|
|
6216
|
+
};
|
|
6217
|
+
}
|
|
6197
6218
|
// <- Note: [🤖]
|
|
6198
6219
|
return proxyTools;
|
|
6199
6220
|
}
|