@promptbook/core 0.66.0-6 → 0.66.0-8

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.
Files changed (25) hide show
  1. package/esm/index.es.js +365 -168
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/azure-openai.index.d.ts +4 -0
  4. package/esm/typings/src/_packages/cli.index.d.ts +4 -2
  5. package/esm/typings/src/_packages/core.index.d.ts +2 -0
  6. package/esm/typings/src/cli/main.d.ts +2 -2
  7. package/esm/typings/src/execution/LlmExecutionTools.d.ts +1 -0
  8. package/esm/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.test.d.ts +1 -1
  9. package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts +1 -1
  10. package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.test.d.ts +1 -1
  11. package/esm/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -0
  12. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +10 -5
  13. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +10 -5
  14. package/esm/typings/src/llm-providers/azure-openai/createAzureOpenAiExecutionTools.d.ts +15 -0
  15. package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +9 -0
  16. package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +11 -0
  17. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +8 -4
  18. package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +8 -4
  19. package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +9 -5
  20. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +10 -5
  21. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +8 -4
  22. package/esm/typings/src/personas/preparePersona.test.d.ts +1 -1
  23. package/package.json +1 -1
  24. package/umd/index.umd.js +365 -167
  25. package/umd/index.umd.js.map +1 -1
package/umd/index.umd.js CHANGED
@@ -19,7 +19,7 @@
19
19
  /**
20
20
  * The version of the Promptbook library
21
21
  */
22
- var PROMPTBOOK_VERSION = '0.66.0-5';
22
+ var PROMPTBOOK_VERSION = '0.66.0-7';
23
23
  // TODO: !!!! List here all the versions and annotate + put into script
24
24
 
25
25
  /*! *****************************************************************************
@@ -1650,7 +1650,7 @@
1650
1650
  });
1651
1651
  }
1652
1652
 
1653
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.66.0-5",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.66.0-5",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.66.0-5",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.66.0-5",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"}];
1653
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.66.0-7",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.66.0-7",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.66.0-7",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.66.0-7",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"}];
1654
1654
 
1655
1655
  var defaultDiacriticsRemovalMap = [
1656
1656
  {
@@ -2243,6 +2243,60 @@
2243
2243
  enumerable: false,
2244
2244
  configurable: true
2245
2245
  });
2246
+ /**
2247
+ * Check the configuration of all execution tools
2248
+ */
2249
+ MultipleLlmExecutionTools.prototype.checkConfiguration = function () {
2250
+ return __awaiter(this, void 0, void 0, function () {
2251
+ return __generator(this, function (_a) {
2252
+ return [2 /*return*/];
2253
+ });
2254
+ });
2255
+ };
2256
+ /**
2257
+ * List all available models that can be used
2258
+ * This lists is a combination of all available models from all execution tools
2259
+ */
2260
+ MultipleLlmExecutionTools.prototype.listModels = function () {
2261
+ return __awaiter(this, void 0, void 0, function () {
2262
+ var availableModels, _a, _b, llmExecutionTools, models, e_1_1;
2263
+ var e_1, _c;
2264
+ return __generator(this, function (_d) {
2265
+ switch (_d.label) {
2266
+ case 0:
2267
+ availableModels = [];
2268
+ _d.label = 1;
2269
+ case 1:
2270
+ _d.trys.push([1, 6, 7, 8]);
2271
+ _a = __values(this.llmExecutionTools), _b = _a.next();
2272
+ _d.label = 2;
2273
+ case 2:
2274
+ if (!!_b.done) return [3 /*break*/, 5];
2275
+ llmExecutionTools = _b.value;
2276
+ return [4 /*yield*/, llmExecutionTools.listModels()];
2277
+ case 3:
2278
+ models = _d.sent();
2279
+ availableModels.push.apply(availableModels, __spreadArray([], __read(models), false));
2280
+ _d.label = 4;
2281
+ case 4:
2282
+ _b = _a.next();
2283
+ return [3 /*break*/, 2];
2284
+ case 5: return [3 /*break*/, 8];
2285
+ case 6:
2286
+ e_1_1 = _d.sent();
2287
+ e_1 = { error: e_1_1 };
2288
+ return [3 /*break*/, 8];
2289
+ case 7:
2290
+ try {
2291
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
2292
+ }
2293
+ finally { if (e_1) throw e_1.error; }
2294
+ return [7 /*endfinally*/];
2295
+ case 8: return [2 /*return*/, availableModels];
2296
+ }
2297
+ });
2298
+ });
2299
+ };
2246
2300
  /**
2247
2301
  * Calls the best available chat model
2248
2302
  */
@@ -2269,8 +2323,8 @@
2269
2323
  */
2270
2324
  MultipleLlmExecutionTools.prototype.callCommonModel = function (prompt) {
2271
2325
  return __awaiter(this, void 0, void 0, function () {
2272
- var errors, _a, _b, llmExecutionTools, _c, error_1, e_1_1;
2273
- var e_1, _d;
2326
+ var errors, _a, _b, llmExecutionTools, _c, error_1, e_2_1;
2327
+ var e_2, _d;
2274
2328
  var _this = this;
2275
2329
  return __generator(this, function (_e) {
2276
2330
  switch (_e.label) {
@@ -2326,14 +2380,14 @@
2326
2380
  return [3 /*break*/, 2];
2327
2381
  case 14: return [3 /*break*/, 17];
2328
2382
  case 15:
2329
- e_1_1 = _e.sent();
2330
- e_1 = { error: e_1_1 };
2383
+ e_2_1 = _e.sent();
2384
+ e_2 = { error: e_2_1 };
2331
2385
  return [3 /*break*/, 17];
2332
2386
  case 16:
2333
2387
  try {
2334
2388
  if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
2335
2389
  }
2336
- finally { if (e_1) throw e_1.error; }
2390
+ finally { if (e_2) throw e_2.error; }
2337
2391
  return [7 /*endfinally*/];
2338
2392
  case 17:
2339
2393
  if (errors.length === 1) {
@@ -2361,50 +2415,6 @@
2361
2415
  });
2362
2416
  });
2363
2417
  };
2364
- /**
2365
- * List all available models that can be used
2366
- * This lists is a combination of all available models from all execution tools
2367
- */
2368
- MultipleLlmExecutionTools.prototype.listModels = function () {
2369
- return __awaiter(this, void 0, void 0, function () {
2370
- var availableModels, _a, _b, llmExecutionTools, models, e_2_1;
2371
- var e_2, _c;
2372
- return __generator(this, function (_d) {
2373
- switch (_d.label) {
2374
- case 0:
2375
- availableModels = [];
2376
- _d.label = 1;
2377
- case 1:
2378
- _d.trys.push([1, 6, 7, 8]);
2379
- _a = __values(this.llmExecutionTools), _b = _a.next();
2380
- _d.label = 2;
2381
- case 2:
2382
- if (!!_b.done) return [3 /*break*/, 5];
2383
- llmExecutionTools = _b.value;
2384
- return [4 /*yield*/, llmExecutionTools.listModels()];
2385
- case 3:
2386
- models = _d.sent();
2387
- availableModels.push.apply(availableModels, __spreadArray([], __read(models), false));
2388
- _d.label = 4;
2389
- case 4:
2390
- _b = _a.next();
2391
- return [3 /*break*/, 2];
2392
- case 5: return [3 /*break*/, 8];
2393
- case 6:
2394
- e_2_1 = _d.sent();
2395
- e_2 = { error: e_2_1 };
2396
- return [3 /*break*/, 8];
2397
- case 7:
2398
- try {
2399
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
2400
- }
2401
- finally { if (e_2) throw e_2.error; }
2402
- return [7 /*endfinally*/];
2403
- case 8: return [2 /*return*/, availableModels];
2404
- }
2405
- });
2406
- });
2407
- };
2408
2418
  return MultipleLlmExecutionTools;
2409
2419
  }());
2410
2420
  /**
@@ -3861,6 +3871,13 @@
3861
3871
  // TODO: [🧠] Maybe put here some suffix
3862
3872
  return llmTools.description;
3863
3873
  },
3874
+ checkConfiguration: function () {
3875
+ return __awaiter(this, void 0, void 0, function () {
3876
+ return __generator(this, function (_a) {
3877
+ return [2 /*return*/, /* not await */ llmTools.checkConfiguration()];
3878
+ });
3879
+ });
3880
+ },
3864
3881
  listModels: function () {
3865
3882
  return /* not await */ llmTools.listModels();
3866
3883
  },
@@ -6502,6 +6519,20 @@
6502
6519
  return CallbackInterfaceTools;
6503
6520
  }());
6504
6521
 
6522
+ /**
6523
+ * @@@
6524
+ *
6525
+ * Note: `$` is used to indicate that this function is not a pure function - it access global
6526
+ *
6527
+ * @public exported from `@promptbook/utils`
6528
+ */
6529
+ function $getGlobalScope() {
6530
+ return Function('return this')();
6531
+ }
6532
+ /***
6533
+ * TODO: !!!!! Make private and promptbook registry from this
6534
+ */
6535
+
6505
6536
  /**
6506
6537
  * Register is @@@
6507
6538
  *
@@ -6516,13 +6547,31 @@
6516
6547
  return this.storage;
6517
6548
  };
6518
6549
  Register.prototype.register = function (registered) {
6519
- // !!!!!! <- TODO: What to return here
6520
- // TODO: !!!!!! Compare if same is not already registered
6521
- this.storage.push(registered);
6550
+ // <- TODO: What to return here
6551
+ var packageName = registered.packageName, className = registered.className;
6552
+ var existingRegistrationIndex = this.storage.findIndex(function (item) { return item.packageName === packageName && item.className === className; });
6553
+ var existingRegistration = this.storage[existingRegistrationIndex];
6554
+ if (!existingRegistration) {
6555
+ console.warn("[\uD83D\uDCE6] Registering ".concat(packageName, ".").concat(className, " again"));
6556
+ this.storage.push(registered);
6557
+ }
6558
+ else {
6559
+ console.warn("[\uD83D\uDCE6] Re-registering ".concat(packageName, ".").concat(className, " again"));
6560
+ this.storage[existingRegistrationIndex] = registered;
6561
+ }
6522
6562
  };
6523
6563
  return Register;
6524
6564
  }());
6525
6565
 
6566
+ // TODO: !!!!!! Move this logic to Register and rename to $Register
6567
+ var globalScope = $getGlobalScope();
6568
+ if (globalScope.$llmToolsMetadataRegister === undefined) {
6569
+ globalScope.$llmToolsMetadataRegister = [];
6570
+ }
6571
+ else if (!Array.isArray(globalScope.$llmToolsMetadataRegister)) {
6572
+ throw new UnexpectedError("Expected $llmToolsMetadataRegister to be an array, but got ".concat(typeof globalScope.$llmToolsMetadataRegister));
6573
+ }
6574
+ var _ = globalScope.$llmToolsMetadataRegister;
6526
6575
  /**
6527
6576
  * @@@
6528
6577
  *
@@ -6530,9 +6579,8 @@
6530
6579
  * @singleton Only one instance of each register is created per build, but thare can be more @@@
6531
6580
  * @public exported from `@promptbook/core`
6532
6581
  */
6533
- var $llmToolsMetadataRegister = new Register([
6534
- // TODO: !!!!!! Take from global scope
6535
- ]);
6582
+ var $llmToolsMetadataRegister = new Register(_);
6583
+ $getGlobalScope().$llmToolsMetadataRegister;
6536
6584
 
6537
6585
  /**
6538
6586
  * @@@
@@ -6573,6 +6621,29 @@
6573
6621
  enumerable: false,
6574
6622
  configurable: true
6575
6623
  });
6624
+ /**
6625
+ * Check the configuration of all execution tools
6626
+ */
6627
+ RemoteLlmExecutionTools.prototype.checkConfiguration = function () {
6628
+ return __awaiter(this, void 0, void 0, function () {
6629
+ return __generator(this, function (_a) {
6630
+ return [2 /*return*/];
6631
+ });
6632
+ });
6633
+ };
6634
+ /**
6635
+ * List all available models that can be used
6636
+ */
6637
+ RemoteLlmExecutionTools.prototype.listModels = function () {
6638
+ return __awaiter(this, void 0, void 0, function () {
6639
+ return __generator(this, function (_a) {
6640
+ return [2 /*return*/, (this.options.models ||
6641
+ [
6642
+ /* !!!!!! */
6643
+ ])];
6644
+ });
6645
+ });
6646
+ };
6576
6647
  /**
6577
6648
  * Creates a connection to the remote proxy server.
6578
6649
  */
@@ -6667,19 +6738,6 @@
6667
6738
  });
6668
6739
  });
6669
6740
  };
6670
- /**
6671
- * List all available models that can be used
6672
- */
6673
- RemoteLlmExecutionTools.prototype.listModels = function () {
6674
- return __awaiter(this, void 0, void 0, function () {
6675
- return __generator(this, function (_a) {
6676
- return [2 /*return*/, (this.options.models ||
6677
- [
6678
- /* !!! */
6679
- ])];
6680
- });
6681
- });
6682
- };
6683
6741
  return RemoteLlmExecutionTools;
6684
6742
  }());
6685
6743
  /**
@@ -6876,12 +6934,10 @@
6876
6934
  function AnthropicClaudeExecutionTools(options) {
6877
6935
  if (options === void 0) { options = { isProxied: false }; }
6878
6936
  this.options = options;
6879
- // Note: Passing only Anthropic Claude relevant options to Anthropic constructor
6880
- var anthropicOptions = __assign({}, options);
6881
- delete anthropicOptions.isVerbose;
6882
- delete anthropicOptions.isProxied;
6883
- this.client = new Anthropic__default["default"](anthropicOptions);
6884
- // <- TODO: !!!!!! Lazy-load client
6937
+ /**
6938
+ * Anthropic Claude API client.
6939
+ */
6940
+ this.client = null;
6885
6941
  }
6886
6942
  Object.defineProperty(AnthropicClaudeExecutionTools.prototype, "title", {
6887
6943
  get: function () {
@@ -6897,12 +6953,47 @@
6897
6953
  enumerable: false,
6898
6954
  configurable: true
6899
6955
  });
6956
+ AnthropicClaudeExecutionTools.prototype.getClient = function () {
6957
+ return __awaiter(this, void 0, void 0, function () {
6958
+ var anthropicOptions;
6959
+ return __generator(this, function (_a) {
6960
+ if (this.client === null) {
6961
+ anthropicOptions = __assign({}, this.options);
6962
+ delete anthropicOptions.isVerbose;
6963
+ delete anthropicOptions.isProxied;
6964
+ this.client = new Anthropic__default["default"](anthropicOptions);
6965
+ }
6966
+ return [2 /*return*/, this.client];
6967
+ });
6968
+ });
6969
+ };
6970
+ /**
6971
+ * Check the `options` passed to `constructor`
6972
+ */
6973
+ AnthropicClaudeExecutionTools.prototype.checkConfiguration = function () {
6974
+ return __awaiter(this, void 0, void 0, function () {
6975
+ return __generator(this, function (_a) {
6976
+ switch (_a.label) {
6977
+ case 0: return [4 /*yield*/, this.getClient()];
6978
+ case 1:
6979
+ _a.sent();
6980
+ return [2 /*return*/];
6981
+ }
6982
+ });
6983
+ });
6984
+ };
6985
+ /**
6986
+ * List all available Anthropic Claude models that can be used
6987
+ */
6988
+ AnthropicClaudeExecutionTools.prototype.listModels = function () {
6989
+ return ANTHROPIC_CLAUDE_MODELS;
6990
+ };
6900
6991
  /**
6901
6992
  * Calls Anthropic Claude API to use a chat model.
6902
6993
  */
6903
6994
  AnthropicClaudeExecutionTools.prototype.callChatModel = function (prompt) {
6904
6995
  return __awaiter(this, void 0, void 0, function () {
6905
- var content, parameters, modelRequirements, modelName, rawPromptContent, rawRequest, start, complete, rawResponse, contentBlock, resultContent, usage;
6996
+ var content, parameters, modelRequirements, client, modelName, rawPromptContent, rawRequest, start, complete, rawResponse, contentBlock, resultContent, usage;
6906
6997
  return __generator(this, function (_a) {
6907
6998
  switch (_a.label) {
6908
6999
  case 0:
@@ -6910,6 +7001,9 @@
6910
7001
  console.info('💬 Anthropic Claude callChatModel call');
6911
7002
  }
6912
7003
  content = prompt.content, parameters = prompt.parameters, modelRequirements = prompt.modelRequirements;
7004
+ return [4 /*yield*/, this.getClient()];
7005
+ case 1:
7006
+ client = _a.sent();
6913
7007
  // TODO: [☂] Use here more modelRequirements
6914
7008
  if (modelRequirements.modelVariant !== 'CHAT') {
6915
7009
  throw new PipelineExecutionError('Use callChatModel only for CHAT variant');
@@ -6936,8 +7030,8 @@
6936
7030
  if (this.options.isVerbose) {
6937
7031
  console.info(colors__default["default"].bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
6938
7032
  }
6939
- return [4 /*yield*/, this.client.messages.create(rawRequest)];
6940
- case 1:
7033
+ return [4 /*yield*/, client.messages.create(rawRequest)];
7034
+ case 2:
6941
7035
  rawResponse = _a.sent();
6942
7036
  if (this.options.isVerbose) {
6943
7037
  console.info(colors__default["default"].bgWhite('rawResponse'), JSON.stringify(rawResponse, null, 4));
@@ -7068,13 +7162,6 @@
7068
7162
  AnthropicClaudeExecutionTools.prototype.getDefaultChatModel = function () {
7069
7163
  return this.getDefaultModel('claude-3-opus');
7070
7164
  };
7071
- // <- Note: [🤖] getDefaultXxxModel
7072
- /**
7073
- * List all available Anthropic Claude models that can be used
7074
- */
7075
- AnthropicClaudeExecutionTools.prototype.listModels = function () {
7076
- return ANTHROPIC_CLAUDE_MODELS;
7077
- };
7078
7165
  return AnthropicClaudeExecutionTools;
7079
7166
  }());
7080
7167
  /**
@@ -7481,10 +7568,10 @@
7481
7568
  */
7482
7569
  function AzureOpenAiExecutionTools(options) {
7483
7570
  this.options = options;
7484
- this.client = new openai.OpenAIClient(
7485
- // <- TODO: [🧱] Implement in a functional (not new Class) way
7486
- "https://".concat(options.resourceName, ".openai.azure.com/"), new openai.AzureKeyCredential(options.apiKey));
7487
- // <- TODO: !!!!!! Lazy-load client
7571
+ /**
7572
+ * OpenAI Azure API client.
7573
+ */
7574
+ this.client = null;
7488
7575
  }
7489
7576
  Object.defineProperty(AzureOpenAiExecutionTools.prototype, "title", {
7490
7577
  get: function () {
@@ -7500,28 +7587,74 @@
7500
7587
  enumerable: false,
7501
7588
  configurable: true
7502
7589
  });
7590
+ AzureOpenAiExecutionTools.prototype.getClient = function () {
7591
+ return __awaiter(this, void 0, void 0, function () {
7592
+ return __generator(this, function (_a) {
7593
+ if (this.client === null) {
7594
+ this.client = new openai.OpenAIClient("https://".concat(this.options.resourceName, ".openai.azure.com/"), new openai.AzureKeyCredential(this.options.apiKey));
7595
+ }
7596
+ return [2 /*return*/, this.client];
7597
+ });
7598
+ });
7599
+ };
7600
+ /**
7601
+ * Check the `options` passed to `constructor`
7602
+ */
7603
+ AzureOpenAiExecutionTools.prototype.checkConfiguration = function () {
7604
+ return __awaiter(this, void 0, void 0, function () {
7605
+ return __generator(this, function (_a) {
7606
+ switch (_a.label) {
7607
+ case 0: return [4 /*yield*/, this.getClient()];
7608
+ case 1:
7609
+ _a.sent();
7610
+ return [2 /*return*/];
7611
+ }
7612
+ });
7613
+ });
7614
+ };
7615
+ /**
7616
+ * List all available Azure OpenAI models that can be used
7617
+ */
7618
+ AzureOpenAiExecutionTools.prototype.listModels = function () {
7619
+ return __awaiter(this, void 0, void 0, function () {
7620
+ return __generator(this, function (_a) {
7621
+ // TODO: !!! Do here some filtering which models are really available as deployment
7622
+ // @see https://management.azure.com/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/deployments?api-version=2023-05-01
7623
+ return [2 /*return*/, OPENAI_MODELS.map(function (_a) {
7624
+ var modelTitle = _a.modelTitle, modelName = _a.modelName, modelVariant = _a.modelVariant;
7625
+ return ({
7626
+ modelTitle: "Azure ".concat(modelTitle),
7627
+ modelName: modelName,
7628
+ modelVariant: modelVariant,
7629
+ });
7630
+ })];
7631
+ });
7632
+ });
7633
+ };
7503
7634
  /**
7504
7635
  * Calls OpenAI API to use a chat model.
7505
7636
  */
7506
7637
  AzureOpenAiExecutionTools.prototype.callChatModel = function (prompt) {
7507
7638
  var _a, _b;
7508
7639
  return __awaiter(this, void 0, void 0, function () {
7509
- var content, parameters, modelRequirements, modelName, modelSettings, rawPromptContent, messages, start, complete, rawRequest, rawResponse, resultContent, usage, error_1;
7510
- var _c;
7511
- return __generator(this, function (_d) {
7512
- switch (_d.label) {
7640
+ var content, parameters, modelRequirements, client, modelName, modelSettings, rawPromptContent, messages, start, complete, rawRequest, rawResponse, resultContent, usage, error_1;
7641
+ return __generator(this, function (_c) {
7642
+ switch (_c.label) {
7513
7643
  case 0:
7514
7644
  if (this.options.isVerbose) {
7515
7645
  console.info('💬 OpenAI callChatModel call');
7516
7646
  }
7517
7647
  content = prompt.content, parameters = prompt.parameters, modelRequirements = prompt.modelRequirements;
7648
+ return [4 /*yield*/, this.getClient()];
7649
+ case 1:
7650
+ client = _c.sent();
7518
7651
  // TODO: [☂] Use here more modelRequirements
7519
7652
  if (modelRequirements.modelVariant !== 'CHAT') {
7520
7653
  throw new PipelineExecutionError('Use callChatModel only for CHAT variant');
7521
7654
  }
7522
- _d.label = 1;
7523
- case 1:
7524
- _d.trys.push([1, 3, , 4]);
7655
+ _c.label = 2;
7656
+ case 2:
7657
+ _c.trys.push([2, 4, , 5]);
7525
7658
  modelName = prompt.modelRequirements.modelName || this.options.deploymentName;
7526
7659
  modelSettings = {
7527
7660
  maxTokens: modelRequirements.maxTokens,
@@ -7551,9 +7684,9 @@
7551
7684
  console.info(colors__default["default"].bgWhite('messages'), JSON.stringify(messages, null, 4));
7552
7685
  }
7553
7686
  rawRequest = [modelName, messages, modelSettings];
7554
- return [4 /*yield*/, (_c = this.client).getChatCompletions.apply(_c, __spreadArray([], __read(rawRequest), false))];
7555
- case 2:
7556
- rawResponse = _d.sent();
7687
+ return [4 /*yield*/, client.getChatCompletions.apply(client, __spreadArray([], __read(rawRequest), false))];
7688
+ case 3:
7689
+ rawResponse = _c.sent();
7557
7690
  if (this.options.isVerbose) {
7558
7691
  console.info(colors__default["default"].bgWhite('rawResponse'), JSON.stringify(rawResponse, null, 4));
7559
7692
  }
@@ -7588,10 +7721,10 @@
7588
7721
  rawResponse: rawResponse,
7589
7722
  // <- [🗯]
7590
7723
  }];
7591
- case 3:
7592
- error_1 = _d.sent();
7724
+ case 4:
7725
+ error_1 = _c.sent();
7593
7726
  throw this.transformAzureError(error_1);
7594
- case 4: return [2 /*return*/];
7727
+ case 5: return [2 /*return*/];
7595
7728
  }
7596
7729
  });
7597
7730
  });
@@ -7602,22 +7735,24 @@
7602
7735
  AzureOpenAiExecutionTools.prototype.callCompletionModel = function (prompt) {
7603
7736
  var _a, _b;
7604
7737
  return __awaiter(this, void 0, void 0, function () {
7605
- var content, parameters, modelRequirements, modelName, modelSettings, start, complete, rawPromptContent, rawRequest, rawResponse, resultContent, usage, error_2;
7606
- var _c;
7607
- return __generator(this, function (_d) {
7608
- switch (_d.label) {
7738
+ var content, parameters, modelRequirements, client, modelName, modelSettings, start, complete, rawPromptContent, rawRequest, rawResponse, resultContent, usage, error_2;
7739
+ return __generator(this, function (_c) {
7740
+ switch (_c.label) {
7609
7741
  case 0:
7610
7742
  if (this.options.isVerbose) {
7611
7743
  console.info('🖋 OpenAI callCompletionModel call');
7612
7744
  }
7613
7745
  content = prompt.content, parameters = prompt.parameters, modelRequirements = prompt.modelRequirements;
7746
+ return [4 /*yield*/, this.getClient()];
7747
+ case 1:
7748
+ client = _c.sent();
7614
7749
  // TODO: [☂] Use here more modelRequirements
7615
7750
  if (modelRequirements.modelVariant !== 'COMPLETION') {
7616
7751
  throw new PipelineExecutionError('Use callCompletionModel only for COMPLETION variant');
7617
7752
  }
7618
- _d.label = 1;
7619
- case 1:
7620
- _d.trys.push([1, 3, , 4]);
7753
+ _c.label = 2;
7754
+ case 2:
7755
+ _c.trys.push([2, 4, , 5]);
7621
7756
  modelName = prompt.modelRequirements.modelName || this.options.deploymentName;
7622
7757
  modelSettings = {
7623
7758
  maxTokens: modelRequirements.maxTokens || 2000,
@@ -7639,9 +7774,9 @@
7639
7774
  [rawPromptContent],
7640
7775
  modelSettings,
7641
7776
  ];
7642
- return [4 /*yield*/, (_c = this.client).getCompletions.apply(_c, __spreadArray([], __read(rawRequest), false))];
7643
- case 2:
7644
- rawResponse = _d.sent();
7777
+ return [4 /*yield*/, client.getCompletions.apply(client, __spreadArray([], __read(rawRequest), false))];
7778
+ case 3:
7779
+ rawResponse = _c.sent();
7645
7780
  if (this.options.isVerbose) {
7646
7781
  console.info(colors__default["default"].bgWhite('rawResponse'), JSON.stringify(rawResponse, null, 4));
7647
7782
  }
@@ -7673,10 +7808,10 @@
7673
7808
  rawResponse: rawResponse,
7674
7809
  // <- [🗯]
7675
7810
  }];
7676
- case 3:
7677
- error_2 = _d.sent();
7811
+ case 4:
7812
+ error_2 = _c.sent();
7678
7813
  throw this.transformAzureError(error_2);
7679
- case 4: return [2 /*return*/];
7814
+ case 5: return [2 /*return*/];
7680
7815
  }
7681
7816
  });
7682
7817
  });
@@ -7692,25 +7827,6 @@
7692
7827
  var code = azureError.code, message = azureError.message;
7693
7828
  return new PipelineExecutionError("".concat(code, ": ").concat(message));
7694
7829
  };
7695
- /**
7696
- * List all available Azure OpenAI models that can be used
7697
- */
7698
- AzureOpenAiExecutionTools.prototype.listModels = function () {
7699
- return __awaiter(this, void 0, void 0, function () {
7700
- return __generator(this, function (_a) {
7701
- // TODO: !!! Do here some filtering which models are really available as deployment
7702
- // @see https://management.azure.com/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/deployments?api-version=2023-05-01
7703
- return [2 /*return*/, OPENAI_MODELS.map(function (_a) {
7704
- var modelTitle = _a.modelTitle, modelName = _a.modelName, modelVariant = _a.modelVariant;
7705
- return ({
7706
- modelTitle: "Azure ".concat(modelTitle),
7707
- modelName: modelName,
7708
- modelVariant: modelVariant,
7709
- });
7710
- })];
7711
- });
7712
- });
7713
- };
7714
7830
  return AzureOpenAiExecutionTools;
7715
7831
  }());
7716
7832
  /**
@@ -7772,12 +7888,10 @@
7772
7888
  function OpenAiExecutionTools(options) {
7773
7889
  if (options === void 0) { options = {}; }
7774
7890
  this.options = options;
7775
- // Note: Passing only OpenAI relevant options to OpenAI constructor
7776
- var openAiOptions = __assign({}, options);
7777
- delete openAiOptions.isVerbose;
7778
- delete openAiOptions.user;
7779
- this.client = new OpenAI__default["default"](__assign({}, openAiOptions));
7780
- // <- TODO: !!!!!! Lazy-load client
7891
+ /**
7892
+ * OpenAI API client.
7893
+ */
7894
+ this.client = null;
7781
7895
  }
7782
7896
  Object.defineProperty(OpenAiExecutionTools.prototype, "title", {
7783
7897
  get: function () {
@@ -7793,12 +7907,54 @@
7793
7907
  enumerable: false,
7794
7908
  configurable: true
7795
7909
  });
7910
+ OpenAiExecutionTools.prototype.getClient = function () {
7911
+ return __awaiter(this, void 0, void 0, function () {
7912
+ var openAiOptions;
7913
+ return __generator(this, function (_a) {
7914
+ if (this.client === null) {
7915
+ openAiOptions = __assign({}, this.options);
7916
+ delete openAiOptions.isVerbose;
7917
+ delete openAiOptions.user;
7918
+ this.client = new OpenAI__default["default"](__assign({}, openAiOptions));
7919
+ }
7920
+ return [2 /*return*/, this.client];
7921
+ });
7922
+ });
7923
+ };
7924
+ /**
7925
+ * Check the `options` passed to `constructor`
7926
+ */
7927
+ OpenAiExecutionTools.prototype.checkConfiguration = function () {
7928
+ return __awaiter(this, void 0, void 0, function () {
7929
+ return __generator(this, function (_a) {
7930
+ switch (_a.label) {
7931
+ case 0: return [4 /*yield*/, this.getClient()];
7932
+ case 1:
7933
+ _a.sent();
7934
+ return [2 /*return*/];
7935
+ }
7936
+ });
7937
+ });
7938
+ };
7939
+ /**
7940
+ * List all available OpenAI models that can be used
7941
+ */
7942
+ OpenAiExecutionTools.prototype.listModels = function () {
7943
+ /*
7944
+ Note: Dynamic lising of the models
7945
+ const models = await this.openai.models.list({});
7946
+
7947
+ console.log({ models });
7948
+ console.log(models.data);
7949
+ */
7950
+ return OPENAI_MODELS;
7951
+ };
7796
7952
  /**
7797
7953
  * Calls OpenAI API to use a chat model.
7798
7954
  */
7799
7955
  OpenAiExecutionTools.prototype.callChatModel = function (prompt) {
7800
7956
  return __awaiter(this, void 0, void 0, function () {
7801
- var content, parameters, modelRequirements, expectFormat, modelName, modelSettings, rawPromptContent, rawRequest, start, complete, rawResponse, resultContent, usage;
7957
+ var content, parameters, modelRequirements, expectFormat, client, modelName, modelSettings, rawPromptContent, rawRequest, start, complete, rawResponse, resultContent, usage;
7802
7958
  return __generator(this, function (_a) {
7803
7959
  switch (_a.label) {
7804
7960
  case 0:
@@ -7806,6 +7962,9 @@
7806
7962
  console.info('💬 OpenAI callChatModel call', { prompt: prompt });
7807
7963
  }
7808
7964
  content = prompt.content, parameters = prompt.parameters, modelRequirements = prompt.modelRequirements, expectFormat = prompt.expectFormat;
7965
+ return [4 /*yield*/, this.getClient()];
7966
+ case 1:
7967
+ client = _a.sent();
7809
7968
  // TODO: [☂] Use here more modelRequirements
7810
7969
  if (modelRequirements.modelVariant !== 'CHAT') {
7811
7970
  throw new PipelineExecutionError('Use callChatModel only for CHAT variant');
@@ -7842,8 +8001,8 @@
7842
8001
  if (this.options.isVerbose) {
7843
8002
  console.info(colors__default["default"].bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
7844
8003
  }
7845
- return [4 /*yield*/, this.client.chat.completions.create(rawRequest)];
7846
- case 1:
8004
+ return [4 /*yield*/, client.chat.completions.create(rawRequest)];
8005
+ case 2:
7847
8006
  rawResponse = _a.sent();
7848
8007
  if (this.options.isVerbose) {
7849
8008
  console.info(colors__default["default"].bgWhite('rawResponse'), JSON.stringify(rawResponse, null, 4));
@@ -7884,7 +8043,7 @@
7884
8043
  */
7885
8044
  OpenAiExecutionTools.prototype.callCompletionModel = function (prompt) {
7886
8045
  return __awaiter(this, void 0, void 0, function () {
7887
- var content, parameters, modelRequirements, modelName, modelSettings, rawPromptContent, rawRequest, start, complete, rawResponse, resultContent, usage;
8046
+ var content, parameters, modelRequirements, client, modelName, modelSettings, rawPromptContent, rawRequest, start, complete, rawResponse, resultContent, usage;
7888
8047
  return __generator(this, function (_a) {
7889
8048
  switch (_a.label) {
7890
8049
  case 0:
@@ -7892,6 +8051,9 @@
7892
8051
  console.info('🖋 OpenAI callCompletionModel call', { prompt: prompt });
7893
8052
  }
7894
8053
  content = prompt.content, parameters = prompt.parameters, modelRequirements = prompt.modelRequirements;
8054
+ return [4 /*yield*/, this.getClient()];
8055
+ case 1:
8056
+ client = _a.sent();
7895
8057
  // TODO: [☂] Use here more modelRequirements
7896
8058
  if (modelRequirements.modelVariant !== 'COMPLETION') {
7897
8059
  throw new PipelineExecutionError('Use callCompletionModel only for COMPLETION variant');
@@ -7911,8 +8073,8 @@
7911
8073
  if (this.options.isVerbose) {
7912
8074
  console.info(colors__default["default"].bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
7913
8075
  }
7914
- return [4 /*yield*/, this.client.completions.create(rawRequest)];
7915
- case 1:
8076
+ return [4 /*yield*/, client.completions.create(rawRequest)];
8077
+ case 2:
7916
8078
  rawResponse = _a.sent();
7917
8079
  if (this.options.isVerbose) {
7918
8080
  console.info(colors__default["default"].bgWhite('rawResponse'), JSON.stringify(rawResponse, null, 4));
@@ -7950,7 +8112,7 @@
7950
8112
  */
7951
8113
  OpenAiExecutionTools.prototype.callEmbeddingModel = function (prompt) {
7952
8114
  return __awaiter(this, void 0, void 0, function () {
7953
- var content, parameters, modelRequirements, modelName, rawPromptContent, rawRequest, start, complete, rawResponse, resultContent, usage;
8115
+ var content, parameters, modelRequirements, client, modelName, rawPromptContent, rawRequest, start, complete, rawResponse, resultContent, usage;
7954
8116
  return __generator(this, function (_a) {
7955
8117
  switch (_a.label) {
7956
8118
  case 0:
@@ -7958,6 +8120,9 @@
7958
8120
  console.info('🖋 OpenAI embedding call', { prompt: prompt });
7959
8121
  }
7960
8122
  content = prompt.content, parameters = prompt.parameters, modelRequirements = prompt.modelRequirements;
8123
+ return [4 /*yield*/, this.getClient()];
8124
+ case 1:
8125
+ client = _a.sent();
7961
8126
  // TODO: [☂] Use here more modelRequirements
7962
8127
  if (modelRequirements.modelVariant !== 'EMBEDDING') {
7963
8128
  throw new PipelineExecutionError('Use embed only for EMBEDDING variant');
@@ -7972,8 +8137,8 @@
7972
8137
  if (this.options.isVerbose) {
7973
8138
  console.info(colors__default["default"].bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
7974
8139
  }
7975
- return [4 /*yield*/, this.client.embeddings.create(rawRequest)];
7976
- case 1:
8140
+ return [4 /*yield*/, client.embeddings.create(rawRequest)];
8141
+ case 2:
7977
8142
  rawResponse = _a.sent();
7978
8143
  if (this.options.isVerbose) {
7979
8144
  console.info(colors__default["default"].bgWhite('rawResponse'), JSON.stringify(rawResponse, null, 4));
@@ -8039,20 +8204,6 @@
8039
8204
  OpenAiExecutionTools.prototype.getDefaultEmbeddingModel = function () {
8040
8205
  return this.getDefaultModel('text-embedding-3-large');
8041
8206
  };
8042
- // <- Note: [🤖] getDefaultXxxModel
8043
- /**
8044
- * List all available OpenAI models that can be used
8045
- */
8046
- OpenAiExecutionTools.prototype.listModels = function () {
8047
- /*
8048
- Note: Dynamic lising of the models
8049
- const models = await this.openai.models.list({});
8050
-
8051
- console.log({ models });
8052
- console.log(models.data);
8053
- */
8054
- return OPENAI_MODELS;
8055
- };
8056
8207
  return OpenAiExecutionTools;
8057
8208
  }());
8058
8209
  /**
@@ -8400,6 +8551,52 @@
8400
8551
  },
8401
8552
  });
8402
8553
 
8554
+ /**
8555
+ * @@@ registration1 of default configuration for Azure Open AI
8556
+ *
8557
+ * Note: [🏐] Configurations registrations are done in @@@ BUT constructor @@@
8558
+ *
8559
+ * @public exported from `@promptbook/core`
8560
+ * @public exported from `@promptbook/cli`
8561
+ */
8562
+ var _AzureOpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
8563
+ title: 'Azure Open AI',
8564
+ packageName: '@promptbook/azure-openai',
8565
+ className: 'AzureOpenAiExecutionTools',
8566
+ getBoilerplateConfiguration: function () {
8567
+ return {
8568
+ title: 'Azure Open AI (boilerplate)',
8569
+ packageName: '@promptbook/azure-openai',
8570
+ className: 'AzureOpenAiExecutionTools',
8571
+ options: {
8572
+ apiKey: 'sk-',
8573
+ },
8574
+ };
8575
+ },
8576
+ createConfigurationFromEnv: function (env) {
8577
+ if (typeof env.AZUREOPENAI_RESOURCE_NAME === 'string' &&
8578
+ typeof env.AZUREOPENAI_DEPLOYMENT_NAME === 'string' &&
8579
+ typeof env.AZUREOPENAI_API_KEY === 'string') {
8580
+ return {
8581
+ title: 'Azure Open AI (from env)',
8582
+ packageName: '@promptbook/azure-openai',
8583
+ className: 'AzureOpenAiExecutionTools',
8584
+ options: {
8585
+ resourceName: env.AZUREOPENAI_RESOURCE_NAME,
8586
+ deploymentName: env.AZUREOPENAI_DEPLOYMENT_NAME,
8587
+ apiKey: env.AZUREOPENAI_API_KEY,
8588
+ },
8589
+ };
8590
+ }
8591
+ else if (typeof env.AZUREOPENAI_RESOURCE_NAME === 'string' ||
8592
+ typeof env.AZUREOPENAI_DEPLOYMENT_NAME === 'string' ||
8593
+ typeof env.AZUREOPENAI_API_KEY === 'string') {
8594
+ throw new Error(spaceTrim__default["default"]("\n You must provide all of the following environment variables:\n \n - AZUREOPENAI_RESOURCE_NAME (".concat(typeof env.AZUREOPENAI_RESOURCE_NAME === 'string' ? 'defined' : 'not defined', ")\n - AZUREOPENAI_DEPLOYMENT_NAME (").concat(typeof env.AZUREOPENAI_DEPLOYMENT_NAME === 'string' ? 'defined' : 'not defined', ")\n - AZUREOPENAI_API_KEY (").concat(typeof env.AZUREOPENAI_API_KEY === 'string' ? 'defined' : 'not defined', ") \n ")));
8595
+ }
8596
+ return null;
8597
+ },
8598
+ });
8599
+
8403
8600
  /**
8404
8601
  * @@@ registration1 of default configuration for Open AI
8405
8602
  *
@@ -8409,9 +8606,9 @@
8409
8606
  * @public exported from `@promptbook/cli`
8410
8607
  */
8411
8608
  var _OpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
8412
- title: 'Anthropic Claude',
8413
- packageName: '@promptbook/anthropic-claude',
8414
- className: 'AnthropicClaudeExecutionTools',
8609
+ title: 'Open AI',
8610
+ packageName: '@promptbook/openai',
8611
+ className: 'OpenAiExecutionTools',
8415
8612
  getBoilerplateConfiguration: function () {
8416
8613
  return {
8417
8614
  title: 'Open AI (boilerplate)',
@@ -8821,6 +9018,7 @@
8821
9018
  exports.VersionMismatchError = VersionMismatchError;
8822
9019
  exports.ZERO_USAGE = ZERO_USAGE;
8823
9020
  exports._AnthropicClaudeMetadataRegistration = _AnthropicClaudeMetadataRegistration;
9021
+ exports._AzureOpenAiMetadataRegistration = _AzureOpenAiMetadataRegistration;
8824
9022
  exports._OpenAiMetadataRegistration = _OpenAiMetadataRegistration;
8825
9023
  exports.addUsage = addUsage;
8826
9024
  exports.assertsExecutionSuccessful = assertsExecutionSuccessful;