@promptbook/core 0.104.0-3 → 0.104.0-5
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 +38 -3
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +18 -15
- 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 +38 -3
- 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-5';
|
|
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}"`);
|
|
@@ -16954,12 +16978,13 @@ function cacheLlmTools(llmTools, options = {}) {
|
|
|
16954
16978
|
}
|
|
16955
16979
|
}
|
|
16956
16980
|
catch (error) {
|
|
16981
|
+
assertsError(error);
|
|
16957
16982
|
// If validation throws an unexpected error, don't cache
|
|
16958
16983
|
shouldCache = false;
|
|
16959
16984
|
if (isVerbose) {
|
|
16960
16985
|
console.info('Not caching result due to validation error for key:', key, {
|
|
16961
16986
|
content: promptResult.content,
|
|
16962
|
-
validationError:
|
|
16987
|
+
validationError: serializeError(error),
|
|
16963
16988
|
});
|
|
16964
16989
|
}
|
|
16965
16990
|
}
|
|
@@ -17005,6 +17030,11 @@ function cacheLlmTools(llmTools, options = {}) {
|
|
|
17005
17030
|
return /* not await */ callCommonModel(prompt);
|
|
17006
17031
|
};
|
|
17007
17032
|
}
|
|
17033
|
+
if (llmTools.callImageGenerationModel !== undefined) {
|
|
17034
|
+
proxyTools.callImageGenerationModel = async (prompt) => {
|
|
17035
|
+
return /* not await */ callCommonModel(prompt);
|
|
17036
|
+
};
|
|
17037
|
+
}
|
|
17008
17038
|
// <- Note: [🤖]
|
|
17009
17039
|
return proxyTools;
|
|
17010
17040
|
}
|
|
@@ -17043,6 +17073,11 @@ function limitTotalUsage(llmTools, options = {}) {
|
|
|
17043
17073
|
throw new LimitReachedError('Cannot call `callEmbeddingModel` because you are not allowed to spend any cost');
|
|
17044
17074
|
};
|
|
17045
17075
|
}
|
|
17076
|
+
if (proxyTools.callImageGenerationModel !== undefined) {
|
|
17077
|
+
proxyTools.callImageGenerationModel = async (prompt) => {
|
|
17078
|
+
throw new LimitReachedError('Cannot call `callImageGenerationModel` because you are not allowed to spend any cost');
|
|
17079
|
+
};
|
|
17080
|
+
}
|
|
17046
17081
|
// <- Note: [🤖]
|
|
17047
17082
|
return proxyTools;
|
|
17048
17083
|
}
|