@promptbook/core 0.65.0 → 0.66.0-0
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 +66 -26
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/utils.index.d.ts +10 -8
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +2 -2
- package/esm/typings/src/llm-providers/mocked/fakeTextToExpectations.d.ts +1 -0
- package/esm/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +2 -1
- package/esm/typings/src/utils/currentDate.d.ts +2 -0
- package/esm/typings/src/utils/deepFreeze.d.ts +2 -1
- package/esm/typings/src/utils/environment/getGlobalScope.d.ts +9 -0
- package/esm/typings/src/utils/environment/isRunningInBrowser.d.ts +8 -0
- package/esm/typings/src/utils/environment/isRunningInNode.d.ts +8 -0
- package/esm/typings/src/utils/environment/isRunningInWebWorker.d.ts +8 -0
- package/esm/typings/src/utils/files/isDirectoryExisting.d.ts +3 -1
- package/esm/typings/src/utils/files/isFileExisting.d.ts +3 -1
- package/esm/typings/src/utils/files/listAllFiles.d.ts +3 -1
- package/esm/typings/src/utils/random/randomSeed.d.ts +1 -0
- package/package.json +3 -3
- package/umd/index.umd.js +66 -26
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/utils/isRunningInWhatever.d.ts +0 -18
package/esm/index.es.js
CHANGED
|
@@ -14,7 +14,7 @@ import moment from 'moment';
|
|
|
14
14
|
/**
|
|
15
15
|
* The version of the Promptbook library
|
|
16
16
|
*/
|
|
17
|
-
var PROMPTBOOK_VERSION = '0.65.0
|
|
17
|
+
var PROMPTBOOK_VERSION = '0.65.0';
|
|
18
18
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
19
19
|
|
|
20
20
|
/*! *****************************************************************************
|
|
@@ -413,12 +413,13 @@ function promptTemplateParameterJsonToString(promptTemplateParameterJson) {
|
|
|
413
413
|
/**
|
|
414
414
|
* @@@
|
|
415
415
|
*
|
|
416
|
+
* Note: `$` is used to indicate that this function is not a pure function - it mutates given object
|
|
416
417
|
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
417
418
|
*
|
|
418
419
|
* @returns The same object as the input, but deeply frozen
|
|
419
420
|
* @public exported from `@promptbook/utils`
|
|
420
421
|
*/
|
|
421
|
-
function deepFreeze(objectValue) {
|
|
422
|
+
function $deepFreeze(objectValue) {
|
|
422
423
|
var e_1, _a;
|
|
423
424
|
var propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
424
425
|
try {
|
|
@@ -426,7 +427,7 @@ function deepFreeze(objectValue) {
|
|
|
426
427
|
var propertyName = propertyNames_1_1.value;
|
|
427
428
|
var value = objectValue[propertyName];
|
|
428
429
|
if (value && typeof value === 'object') {
|
|
429
|
-
deepFreeze(value);
|
|
430
|
+
$deepFreeze(value);
|
|
430
431
|
}
|
|
431
432
|
}
|
|
432
433
|
}
|
|
@@ -449,7 +450,7 @@ function deepFreeze(objectValue) {
|
|
|
449
450
|
* @private this is in comparison to `deepFreeze` a more specific utility and maybe not very good practice to use without specific reason and considerations
|
|
450
451
|
*/
|
|
451
452
|
function deepFreezeWithSameType(objectValue) {
|
|
452
|
-
return deepFreeze(objectValue);
|
|
453
|
+
return $deepFreeze(objectValue);
|
|
453
454
|
}
|
|
454
455
|
/**
|
|
455
456
|
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
@@ -551,7 +552,7 @@ var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
|
|
|
551
552
|
*
|
|
552
553
|
* @public exported from `@promptbook/core`
|
|
553
554
|
*/
|
|
554
|
-
var RESERVED_PARAMETER_NAMES = deepFreeze([
|
|
555
|
+
var RESERVED_PARAMETER_NAMES = $deepFreeze([
|
|
555
556
|
'content',
|
|
556
557
|
'context',
|
|
557
558
|
'knowledge',
|
|
@@ -1461,7 +1462,7 @@ function deepClone(objectValue) {
|
|
|
1461
1462
|
*
|
|
1462
1463
|
* @public exported from `@promptbook/core`
|
|
1463
1464
|
*/
|
|
1464
|
-
var ZERO_USAGE = deepFreeze({
|
|
1465
|
+
var ZERO_USAGE = $deepFreeze({
|
|
1465
1466
|
price: { value: 0 },
|
|
1466
1467
|
input: {
|
|
1467
1468
|
tokensCount: { value: 0 },
|
|
@@ -1629,7 +1630,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
1629
1630
|
});
|
|
1630
1631
|
}
|
|
1631
1632
|
|
|
1632
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.65.0
|
|
1633
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.65.0",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",dependentParameterNames:["knowledgeContent"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.65.0",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.65.0",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.65.0",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Option `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
|
|
1633
1634
|
|
|
1634
1635
|
var defaultDiacriticsRemovalMap = [
|
|
1635
1636
|
{
|
|
@@ -3126,20 +3127,20 @@ function createPipelineExecutor(options) {
|
|
|
3126
3127
|
case 'EMBEDDING': return [3 /*break*/, 12];
|
|
3127
3128
|
}
|
|
3128
3129
|
return [3 /*break*/, 14];
|
|
3129
|
-
case 8: return [4 /*yield*/, llmTools.callChatModel(deepFreeze(prompt))];
|
|
3130
|
+
case 8: return [4 /*yield*/, llmTools.callChatModel($deepFreeze(prompt))];
|
|
3130
3131
|
case 9:
|
|
3131
3132
|
chatResult = _u.sent();
|
|
3132
3133
|
// TODO: [🍬] Destroy chatThread
|
|
3133
3134
|
result = chatResult;
|
|
3134
3135
|
resultString = chatResult.content;
|
|
3135
3136
|
return [3 /*break*/, 15];
|
|
3136
|
-
case 10: return [4 /*yield*/, llmTools.callCompletionModel(deepFreeze(prompt))];
|
|
3137
|
+
case 10: return [4 /*yield*/, llmTools.callCompletionModel($deepFreeze(prompt))];
|
|
3137
3138
|
case 11:
|
|
3138
3139
|
completionResult = _u.sent();
|
|
3139
3140
|
result = completionResult;
|
|
3140
3141
|
resultString = completionResult.content;
|
|
3141
3142
|
return [3 /*break*/, 15];
|
|
3142
|
-
case 12: return [4 /*yield*/, llmTools.callEmbeddingModel(deepFreeze(prompt))];
|
|
3143
|
+
case 12: return [4 /*yield*/, llmTools.callEmbeddingModel($deepFreeze(prompt))];
|
|
3143
3144
|
case 13:
|
|
3144
3145
|
embeddingResult = _u.sent();
|
|
3145
3146
|
result = embeddingResult;
|
|
@@ -3167,7 +3168,7 @@ function createPipelineExecutor(options) {
|
|
|
3167
3168
|
_u.label = 19;
|
|
3168
3169
|
case 19:
|
|
3169
3170
|
_u.trys.push([19, 21, , 22]);
|
|
3170
|
-
return [4 /*yield*/, scriptTools.execute(deepFreeze({
|
|
3171
|
+
return [4 /*yield*/, scriptTools.execute($deepFreeze({
|
|
3171
3172
|
scriptLanguage: currentTemplate.contentLanguage,
|
|
3172
3173
|
script: preparedContent,
|
|
3173
3174
|
parameters: parameters,
|
|
@@ -3215,7 +3216,7 @@ function createPipelineExecutor(options) {
|
|
|
3215
3216
|
if (tools.userInterface === undefined) {
|
|
3216
3217
|
throw new PipelineExecutionError('User interface tools are not available');
|
|
3217
3218
|
}
|
|
3218
|
-
return [4 /*yield*/, tools.userInterface.promptDialog(deepFreeze({
|
|
3219
|
+
return [4 /*yield*/, tools.userInterface.promptDialog($deepFreeze({
|
|
3219
3220
|
promptTitle: currentTemplate.title,
|
|
3220
3221
|
promptMessage: replaceParameters(currentTemplate.description || '', parameters),
|
|
3221
3222
|
defaultValue: replaceParameters(preparedContent, parameters),
|
|
@@ -4010,7 +4011,9 @@ function prepareTemplates(pipeline, options) {
|
|
|
4010
4011
|
promptTemplates = pipeline.promptTemplates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
4011
4012
|
// TODO: !!!!! Apply samples to each template (if missing and is for the template defined)
|
|
4012
4013
|
TODO_USE(parameters);
|
|
4013
|
-
promptTemplatesPrepared = new Array(
|
|
4014
|
+
promptTemplatesPrepared = new Array(
|
|
4015
|
+
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
4016
|
+
promptTemplates.length);
|
|
4014
4017
|
return [4 /*yield*/, forEachAsync(promptTemplates, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (template, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
4015
4018
|
var dependentParameterNames, preparedContent, preparedTemplate;
|
|
4016
4019
|
return __generator(this, function (_a) {
|
|
@@ -4083,7 +4086,9 @@ function preparePipeline(pipeline, options) {
|
|
|
4083
4086
|
// <- TODO: [🧊]
|
|
4084
4087
|
currentPreparation,
|
|
4085
4088
|
];
|
|
4086
|
-
preparedPersonas = new Array(
|
|
4089
|
+
preparedPersonas = new Array(
|
|
4090
|
+
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
4091
|
+
personas.length);
|
|
4087
4092
|
return [4 /*yield*/, forEachAsync(personas, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (persona, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
4088
4093
|
var modelRequirements, preparedPersona;
|
|
4089
4094
|
return __generator(this, function (_a) {
|
|
@@ -6510,7 +6515,9 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
6510
6515
|
*/
|
|
6511
6516
|
RemoteLlmExecutionTools.prototype.makeConnection = function () {
|
|
6512
6517
|
var _this = this;
|
|
6513
|
-
return new Promise(
|
|
6518
|
+
return new Promise(
|
|
6519
|
+
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
6520
|
+
function (resolve, reject) {
|
|
6514
6521
|
var socket = io(_this.options.remoteUrl, {
|
|
6515
6522
|
path: _this.options.path,
|
|
6516
6523
|
// path: `${this.remoteUrl.pathname}/socket.io`,
|
|
@@ -6632,12 +6639,21 @@ function computeUsage(value) {
|
|
|
6632
6639
|
/**
|
|
6633
6640
|
* List of available Anthropic Claude models with pricing
|
|
6634
6641
|
*
|
|
6635
|
-
* Note: Done at 2024-
|
|
6642
|
+
* Note: Done at 2024-08-16
|
|
6636
6643
|
*
|
|
6637
6644
|
* @see https://docs.anthropic.com/en/docs/models-overview
|
|
6638
6645
|
* @public exported from `@promptbook/anthropic-claude`
|
|
6639
6646
|
*/
|
|
6640
6647
|
var ANTHROPIC_CLAUDE_MODELS = [
|
|
6648
|
+
{
|
|
6649
|
+
modelVariant: 'CHAT',
|
|
6650
|
+
modelTitle: 'Claude 3.5 Sonnet',
|
|
6651
|
+
modelName: 'claude-3-5-sonnet-20240620',
|
|
6652
|
+
pricing: {
|
|
6653
|
+
prompt: computeUsage("$3.00 / 1M tokens"),
|
|
6654
|
+
output: computeUsage("$15.00 / 1M tokens"),
|
|
6655
|
+
},
|
|
6656
|
+
},
|
|
6641
6657
|
{
|
|
6642
6658
|
modelVariant: 'CHAT',
|
|
6643
6659
|
modelTitle: 'Claude 3 Opus',
|
|
@@ -6699,7 +6715,7 @@ var ANTHROPIC_CLAUDE_MODELS = [
|
|
|
6699
6715
|
* TODO: [🧠] !!! Add embedding models OR Anthropic has only chat+completion models?
|
|
6700
6716
|
* TODO: [🧠] Some mechanism to propagate unsureness
|
|
6701
6717
|
* TODO: [🧠][👮♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
|
|
6702
|
-
* TODO: [
|
|
6718
|
+
* TODO: [🎰] Some mechanism to auto-update available models
|
|
6703
6719
|
*/
|
|
6704
6720
|
|
|
6705
6721
|
/**
|
|
@@ -6763,7 +6779,9 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
6763
6779
|
var anthropicOptions = __assign({}, options);
|
|
6764
6780
|
delete anthropicOptions.isVerbose;
|
|
6765
6781
|
delete anthropicOptions.isProxied;
|
|
6766
|
-
this.client = new Anthropic(
|
|
6782
|
+
this.client = new Anthropic(
|
|
6783
|
+
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
6784
|
+
anthropicOptions);
|
|
6767
6785
|
}
|
|
6768
6786
|
Object.defineProperty(AnthropicClaudeExecutionTools.prototype, "title", {
|
|
6769
6787
|
get: function () {
|
|
@@ -6784,7 +6802,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
6784
6802
|
*/
|
|
6785
6803
|
AnthropicClaudeExecutionTools.prototype.callChatModel = function (prompt) {
|
|
6786
6804
|
return __awaiter(this, void 0, void 0, function () {
|
|
6787
|
-
var content, parameters, modelRequirements, modelName, rawPromptContent, rawRequest, start, complete, rawResponse, resultContent, usage;
|
|
6805
|
+
var content, parameters, modelRequirements, modelName, rawPromptContent, rawRequest, start, complete, rawResponse, contentBlock, resultContent, usage;
|
|
6788
6806
|
return __generator(this, function (_a) {
|
|
6789
6807
|
switch (_a.label) {
|
|
6790
6808
|
case 0:
|
|
@@ -6830,11 +6848,16 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
6830
6848
|
if (rawResponse.content.length > 1) {
|
|
6831
6849
|
throw new PipelineExecutionError('More than one content blocks from Anthropic Claude');
|
|
6832
6850
|
}
|
|
6833
|
-
|
|
6851
|
+
contentBlock = rawResponse.content[0];
|
|
6852
|
+
if (contentBlock.type !== 'text') {
|
|
6853
|
+
throw new PipelineExecutionError("Returned content is not \"text\" type but \"".concat(contentBlock.type, "\""));
|
|
6854
|
+
}
|
|
6855
|
+
console.log('!!!!!! rawResponse.usage', rawResponse.usage);
|
|
6856
|
+
resultContent = contentBlock.text;
|
|
6834
6857
|
// eslint-disable-next-line prefer-const
|
|
6835
6858
|
complete = getCurrentIsoDate();
|
|
6836
6859
|
usage = {
|
|
6837
|
-
price: { value: 0, isUncertain: true } /* <- TODO: [🐞] Compute usage */,
|
|
6860
|
+
price: { value: 0, isUncertain: true } /* <- TODO: [🐞] !!!!!! Compute usage */,
|
|
6838
6861
|
input: __assign({ tokensCount: uncertainNumber(rawResponse.usage.input_tokens) }, computeUsageCounts(prompt.content)),
|
|
6839
6862
|
output: __assign({ tokensCount: uncertainNumber(rawResponse.usage.output_tokens) }, computeUsageCounts(prompt.content)),
|
|
6840
6863
|
};
|
|
@@ -6985,7 +7008,9 @@ function createAnthropicClaudeExecutionTools(options) {
|
|
|
6985
7008
|
},
|
|
6986
7009
|
], models: ANTHROPIC_CLAUDE_MODELS }));
|
|
6987
7010
|
}
|
|
6988
|
-
return new AnthropicClaudeExecutionTools(
|
|
7011
|
+
return new AnthropicClaudeExecutionTools(
|
|
7012
|
+
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
7013
|
+
options);
|
|
6989
7014
|
}
|
|
6990
7015
|
/**
|
|
6991
7016
|
* TODO: [🧠] !!!! Make anonymous this with all LLM providers
|
|
@@ -7334,7 +7359,8 @@ var OPENAI_MODELS = [
|
|
|
7334
7359
|
/**
|
|
7335
7360
|
* Note: [🤖] Add models of new variant
|
|
7336
7361
|
* TODO: [🧠] Some mechanism to propagate unsureness
|
|
7337
|
-
* TODO: [
|
|
7362
|
+
* TODO: [🎰] Some mechanism to auto-update available models
|
|
7363
|
+
* TODO: [🎰][👮♀️] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
|
|
7338
7364
|
* TODO: [🧠][👮♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
|
|
7339
7365
|
* @see https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4
|
|
7340
7366
|
* @see https://openai.com/api/pricing/
|
|
@@ -7357,7 +7383,11 @@ var AzureOpenAiExecutionTools = /** @class */ (function () {
|
|
|
7357
7383
|
*/
|
|
7358
7384
|
function AzureOpenAiExecutionTools(options) {
|
|
7359
7385
|
this.options = options;
|
|
7360
|
-
this.client = new OpenAIClient(
|
|
7386
|
+
this.client = new OpenAIClient(
|
|
7387
|
+
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
7388
|
+
"https://".concat(options.resourceName, ".openai.azure.com/"), new AzureKeyCredential(
|
|
7389
|
+
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
7390
|
+
options.apiKey));
|
|
7361
7391
|
}
|
|
7362
7392
|
Object.defineProperty(AzureOpenAiExecutionTools.prototype, "title", {
|
|
7363
7393
|
get: function () {
|
|
@@ -7976,7 +8006,11 @@ var EXECUTION_TOOLS_CLASSES = {
|
|
|
7976
8006
|
return new OpenAiExecutionTools(__assign(__assign({}, options), { dangerouslyAllowBrowser: true /* <- TODO: [🧠] !!! Some mechanism for auto-detection of browser, maybe hide in `OpenAiExecutionTools` */ }));
|
|
7977
8007
|
},
|
|
7978
8008
|
createAnthropicClaudeExecutionTools: createAnthropicClaudeExecutionTools,
|
|
7979
|
-
createAzureOpenAiExecutionTools: function (options) {
|
|
8009
|
+
createAzureOpenAiExecutionTools: function (options) {
|
|
8010
|
+
return new AzureOpenAiExecutionTools(
|
|
8011
|
+
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
8012
|
+
options);
|
|
8013
|
+
},
|
|
7980
8014
|
// <- Note: [🦑] Add here new LLM provider
|
|
7981
8015
|
};
|
|
7982
8016
|
/**
|
|
@@ -8064,6 +8098,8 @@ var MemoryStorage = /** @class */ (function () {
|
|
|
8064
8098
|
/**
|
|
8065
8099
|
* Simple wrapper `new Date().toISOString()`
|
|
8066
8100
|
*
|
|
8101
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic because it depends on the current time
|
|
8102
|
+
*
|
|
8067
8103
|
* @returns string_date branded type
|
|
8068
8104
|
* @public exported from `@promptbook/utils`
|
|
8069
8105
|
*/
|
|
@@ -8083,7 +8119,11 @@ function $currentDate() {
|
|
|
8083
8119
|
function cacheLlmTools(llmTools, options) {
|
|
8084
8120
|
var _this = this;
|
|
8085
8121
|
if (options === void 0) { options = {}; }
|
|
8086
|
-
var _a = options.storage, storage = _a === void 0 ? new MemoryStorage() : _a,
|
|
8122
|
+
var _a = options.storage, storage = _a === void 0 ? new MemoryStorage() : _a,
|
|
8123
|
+
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
8124
|
+
_b = options.isReloaded,
|
|
8125
|
+
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
8126
|
+
isReloaded = _b === void 0 ? false : _b;
|
|
8087
8127
|
var proxyTools = __assign(__assign({}, llmTools), {
|
|
8088
8128
|
// <- Note: [🥫]
|
|
8089
8129
|
get title() {
|