@promptbook/core 0.104.0-3 → 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 +36 -2
- package/esm/index.es.js.map +1 -1
- 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/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +36 -2
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -27,7 +27,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
27
27
|
* @generated
|
|
28
28
|
* @see https://github.com/webgptorg/promptbook
|
|
29
29
|
*/
|
|
30
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-
|
|
30
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-4';
|
|
31
31
|
/**
|
|
32
32
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
33
33
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -3744,6 +3744,15 @@ function countUsage(llmTools) {
|
|
|
3744
3744
|
return promptResult;
|
|
3745
3745
|
};
|
|
3746
3746
|
}
|
|
3747
|
+
if (llmTools.callImageGenerationModel !== undefined) {
|
|
3748
|
+
proxyTools.callImageGenerationModel = async (prompt) => {
|
|
3749
|
+
// console.info('[🚕] callImageGenerationModel through countTotalUsage');
|
|
3750
|
+
const promptResult = await llmTools.callImageGenerationModel(prompt);
|
|
3751
|
+
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
3752
|
+
spending.next(promptResult.usage);
|
|
3753
|
+
return promptResult;
|
|
3754
|
+
};
|
|
3755
|
+
}
|
|
3747
3756
|
// <- Note: [🤖]
|
|
3748
3757
|
return proxyTools;
|
|
3749
3758
|
}
|
|
@@ -3853,6 +3862,12 @@ class MultipleLlmExecutionTools {
|
|
|
3853
3862
|
callEmbeddingModel(prompt) {
|
|
3854
3863
|
return this.callCommonModel(prompt);
|
|
3855
3864
|
}
|
|
3865
|
+
/**
|
|
3866
|
+
* Calls the best available embedding model
|
|
3867
|
+
*/
|
|
3868
|
+
callImageGenerationModel(prompt) {
|
|
3869
|
+
return this.callCommonModel(prompt);
|
|
3870
|
+
}
|
|
3856
3871
|
// <- Note: [🤖]
|
|
3857
3872
|
/**
|
|
3858
3873
|
* Calls the best available model
|
|
@@ -3879,6 +3894,11 @@ class MultipleLlmExecutionTools {
|
|
|
3879
3894
|
continue llm;
|
|
3880
3895
|
}
|
|
3881
3896
|
return await llmExecutionTools.callEmbeddingModel(prompt);
|
|
3897
|
+
case 'IMAGE_GENERATION':
|
|
3898
|
+
if (llmExecutionTools.callImageGenerationModel === undefined) {
|
|
3899
|
+
continue llm;
|
|
3900
|
+
}
|
|
3901
|
+
return await llmExecutionTools.callImageGenerationModel(prompt);
|
|
3882
3902
|
// <- case [🤖]:
|
|
3883
3903
|
default:
|
|
3884
3904
|
throw new UnexpectedError(`Unknown model variant "${prompt.modelRequirements.modelVariant}" in ${llmExecutionTools.title}`);
|
|
@@ -6304,8 +6324,9 @@ async function executeAttempts(options) {
|
|
|
6304
6324
|
$ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
|
|
6305
6325
|
break variant;
|
|
6306
6326
|
case 'EMBEDDING':
|
|
6327
|
+
case 'IMAGE_GENERATION':
|
|
6307
6328
|
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
6308
|
-
|
|
6329
|
+
${modelRequirements.modelVariant} model can not be used in pipeline
|
|
6309
6330
|
|
|
6310
6331
|
This should be catched during parsing
|
|
6311
6332
|
|
|
@@ -16918,6 +16939,9 @@ function cacheLlmTools(llmTools, options = {}) {
|
|
|
16918
16939
|
case 'EMBEDDING':
|
|
16919
16940
|
promptResult = await llmTools.callEmbeddingModel(prompt);
|
|
16920
16941
|
break variant;
|
|
16942
|
+
case 'IMAGE_GENERATION':
|
|
16943
|
+
promptResult = await llmTools.callImageGenerationModel(prompt);
|
|
16944
|
+
break variant;
|
|
16921
16945
|
// <- case [🤖]:
|
|
16922
16946
|
default:
|
|
16923
16947
|
throw new PipelineExecutionError(`Unknown model variant "${prompt.modelRequirements.modelVariant}"`);
|
|
@@ -17005,6 +17029,11 @@ function cacheLlmTools(llmTools, options = {}) {
|
|
|
17005
17029
|
return /* not await */ callCommonModel(prompt);
|
|
17006
17030
|
};
|
|
17007
17031
|
}
|
|
17032
|
+
if (llmTools.callImageGenerationModel !== undefined) {
|
|
17033
|
+
proxyTools.callImageGenerationModel = async (prompt) => {
|
|
17034
|
+
return /* not await */ callCommonModel(prompt);
|
|
17035
|
+
};
|
|
17036
|
+
}
|
|
17008
17037
|
// <- Note: [🤖]
|
|
17009
17038
|
return proxyTools;
|
|
17010
17039
|
}
|
|
@@ -17043,6 +17072,11 @@ function limitTotalUsage(llmTools, options = {}) {
|
|
|
17043
17072
|
throw new LimitReachedError('Cannot call `callEmbeddingModel` because you are not allowed to spend any cost');
|
|
17044
17073
|
};
|
|
17045
17074
|
}
|
|
17075
|
+
if (proxyTools.callImageGenerationModel !== undefined) {
|
|
17076
|
+
proxyTools.callImageGenerationModel = async (prompt) => {
|
|
17077
|
+
throw new LimitReachedError('Cannot call `callImageGenerationModel` because you are not allowed to spend any cost');
|
|
17078
|
+
};
|
|
17079
|
+
}
|
|
17046
17080
|
// <- Note: [🤖]
|
|
17047
17081
|
return proxyTools;
|
|
17048
17082
|
}
|