@promptbook/cli 0.65.0-1 → 0.65.0-3
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 +178 -13
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/anthropic-claude.index.d.ts +6 -0
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/_packages/node.index.d.ts +0 -4
- package/esm/typings/src/_packages/remote-client.index.d.ts +2 -2
- package/esm/typings/src/_packages/types.index.d.ts +16 -2
- package/esm/typings/src/llm-providers/_common/config.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/createLlmToolsFromConfiguration.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +5 -3
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +23 -2
- package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts +13 -0
- package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +3 -2
- package/esm/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Error.d.ts +2 -2
- package/esm/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Progress.d.ts +2 -2
- package/esm/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Request.d.ts +14 -2
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteLlmExecutionToolsOptions.d.ts +49 -0
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +23 -2
- package/esm/typings/src/llm-providers/remote/playground/playground.d.ts +2 -0
- package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +2 -1
- package/esm/typings/src/types/typeAliases.d.ts +6 -0
- package/package.json +2 -1
- package/umd/index.umd.js +181 -17
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +0 -26
package/esm/index.es.js
CHANGED
|
@@ -10,6 +10,7 @@ import hexEncoder from 'crypto-js/enc-hex';
|
|
|
10
10
|
import sha256 from 'crypto-js/sha256';
|
|
11
11
|
import { join } from 'path/posix';
|
|
12
12
|
import * as dotenv from 'dotenv';
|
|
13
|
+
import { io } from 'socket.io-client';
|
|
13
14
|
import Anthropic from '@anthropic-ai/sdk';
|
|
14
15
|
import { OpenAIClient, AzureKeyCredential } from '@azure/openai';
|
|
15
16
|
import OpenAI from 'openai';
|
|
@@ -19,7 +20,7 @@ import glob from 'glob-promise';
|
|
|
19
20
|
/**
|
|
20
21
|
* The version of the Promptbook library
|
|
21
22
|
*/
|
|
22
|
-
var PROMPTBOOK_VERSION = '0.65.0-
|
|
23
|
+
var PROMPTBOOK_VERSION = '0.65.0-2';
|
|
23
24
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
24
25
|
|
|
25
26
|
/*! *****************************************************************************
|
|
@@ -840,7 +841,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
840
841
|
});
|
|
841
842
|
}
|
|
842
843
|
|
|
843
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.65.0-
|
|
844
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.65.0-2",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-2",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-2",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-2",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"}];
|
|
844
845
|
|
|
845
846
|
/**
|
|
846
847
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -6568,6 +6569,147 @@ var FilesStorage = /** @class */ (function () {
|
|
|
6568
6569
|
* Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
|
|
6569
6570
|
*/
|
|
6570
6571
|
|
|
6572
|
+
/**
|
|
6573
|
+
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
6574
|
+
*
|
|
6575
|
+
* You can simply use `RemoteExecutionTools` on client-side javascript and connect to your remote server.
|
|
6576
|
+
* This is useful to make all logic on browser side but not expose your API keys or no need to use customer's GPU.
|
|
6577
|
+
*
|
|
6578
|
+
* @see https://github.com/webgptorg/promptbook#remote-server
|
|
6579
|
+
* @public exported from `@promptbook/remote-client`
|
|
6580
|
+
*/
|
|
6581
|
+
var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
6582
|
+
function RemoteLlmExecutionTools(options) {
|
|
6583
|
+
this.options = options;
|
|
6584
|
+
}
|
|
6585
|
+
Object.defineProperty(RemoteLlmExecutionTools.prototype, "title", {
|
|
6586
|
+
get: function () {
|
|
6587
|
+
// TODO: [🧠] Maybe fetch title+description from the remote server (as well as if model methods are defined)
|
|
6588
|
+
return 'Remote server';
|
|
6589
|
+
},
|
|
6590
|
+
enumerable: false,
|
|
6591
|
+
configurable: true
|
|
6592
|
+
});
|
|
6593
|
+
Object.defineProperty(RemoteLlmExecutionTools.prototype, "description", {
|
|
6594
|
+
get: function () {
|
|
6595
|
+
return 'Use all models by your remote server';
|
|
6596
|
+
},
|
|
6597
|
+
enumerable: false,
|
|
6598
|
+
configurable: true
|
|
6599
|
+
});
|
|
6600
|
+
/**
|
|
6601
|
+
* Creates a connection to the remote proxy server.
|
|
6602
|
+
*/
|
|
6603
|
+
RemoteLlmExecutionTools.prototype.makeConnection = function () {
|
|
6604
|
+
var _this = this;
|
|
6605
|
+
return new Promise(function (resolve, reject) {
|
|
6606
|
+
var socket = io(_this.options.remoteUrl, {
|
|
6607
|
+
path: _this.options.path,
|
|
6608
|
+
// path: `${this.remoteUrl.pathname}/socket.io`,
|
|
6609
|
+
transports: [/*'websocket', <- TODO: [🌬] Make websocket transport work */ 'polling'],
|
|
6610
|
+
});
|
|
6611
|
+
// console.log('Connecting to', this.options.remoteUrl.href, { socket });
|
|
6612
|
+
socket.on('connect', function () {
|
|
6613
|
+
resolve(socket);
|
|
6614
|
+
});
|
|
6615
|
+
setTimeout(function () {
|
|
6616
|
+
reject(new Error("Timeout while connecting to ".concat(_this.options.remoteUrl)));
|
|
6617
|
+
}, 60000 /* <- TODO: Timeout to config */);
|
|
6618
|
+
});
|
|
6619
|
+
};
|
|
6620
|
+
/**
|
|
6621
|
+
* Calls remote proxy server to use a chat model
|
|
6622
|
+
*/
|
|
6623
|
+
RemoteLlmExecutionTools.prototype.callChatModel = function (prompt) {
|
|
6624
|
+
if (this.options.isVerbose) {
|
|
6625
|
+
console.info("\uD83D\uDD8B Remote callChatModel call");
|
|
6626
|
+
}
|
|
6627
|
+
return /* not await */ this.callCommonModel(prompt);
|
|
6628
|
+
};
|
|
6629
|
+
/**
|
|
6630
|
+
* Calls remote proxy server to use a completion model
|
|
6631
|
+
*/
|
|
6632
|
+
RemoteLlmExecutionTools.prototype.callCompletionModel = function (prompt) {
|
|
6633
|
+
if (this.options.isVerbose) {
|
|
6634
|
+
console.info("\uD83D\uDCAC Remote callCompletionModel call");
|
|
6635
|
+
}
|
|
6636
|
+
return /* not await */ this.callCommonModel(prompt);
|
|
6637
|
+
};
|
|
6638
|
+
/**
|
|
6639
|
+
* Calls remote proxy server to use a embedding model
|
|
6640
|
+
*/
|
|
6641
|
+
RemoteLlmExecutionTools.prototype.callEmbeddingModel = function (prompt) {
|
|
6642
|
+
if (this.options.isVerbose) {
|
|
6643
|
+
console.info("\uD83D\uDCAC Remote callEmbeddingModel call");
|
|
6644
|
+
}
|
|
6645
|
+
return /* not await */ this.callCommonModel(prompt);
|
|
6646
|
+
};
|
|
6647
|
+
// <- Note: [🤖] callXxxModel
|
|
6648
|
+
/**
|
|
6649
|
+
* Calls remote proxy server to use both completion or chat model
|
|
6650
|
+
*/
|
|
6651
|
+
RemoteLlmExecutionTools.prototype.callCommonModel = function (prompt) {
|
|
6652
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6653
|
+
var socket, promptResult;
|
|
6654
|
+
return __generator(this, function (_a) {
|
|
6655
|
+
switch (_a.label) {
|
|
6656
|
+
case 0: return [4 /*yield*/, this.makeConnection()];
|
|
6657
|
+
case 1:
|
|
6658
|
+
socket = _a.sent();
|
|
6659
|
+
if (this.options.isAnonymous) {
|
|
6660
|
+
socket.emit('request', {
|
|
6661
|
+
llmToolsConfiguration: this.options.llmToolsConfiguration,
|
|
6662
|
+
prompt: prompt,
|
|
6663
|
+
// <- TODO: [🛫] `prompt` is NOT fully serializable as JSON, it contains functions which are not serializable
|
|
6664
|
+
});
|
|
6665
|
+
}
|
|
6666
|
+
else {
|
|
6667
|
+
socket.emit('request', {
|
|
6668
|
+
clientId: this.options.clientId,
|
|
6669
|
+
prompt: prompt,
|
|
6670
|
+
// <- TODO: [🛫] `prompt` is NOT fully serializable as JSON, it contains functions which are not serializable
|
|
6671
|
+
});
|
|
6672
|
+
}
|
|
6673
|
+
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
6674
|
+
socket.on('response', function (response) {
|
|
6675
|
+
resolve(response.promptResult);
|
|
6676
|
+
socket.disconnect();
|
|
6677
|
+
});
|
|
6678
|
+
socket.on('error', function (error) {
|
|
6679
|
+
reject(new PipelineExecutionError(error.errorMessage));
|
|
6680
|
+
socket.disconnect();
|
|
6681
|
+
});
|
|
6682
|
+
})];
|
|
6683
|
+
case 2:
|
|
6684
|
+
promptResult = _a.sent();
|
|
6685
|
+
socket.disconnect();
|
|
6686
|
+
return [2 /*return*/, promptResult];
|
|
6687
|
+
}
|
|
6688
|
+
});
|
|
6689
|
+
});
|
|
6690
|
+
};
|
|
6691
|
+
/**
|
|
6692
|
+
* List all available models that can be used
|
|
6693
|
+
*/
|
|
6694
|
+
RemoteLlmExecutionTools.prototype.listModels = function () {
|
|
6695
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6696
|
+
return __generator(this, function (_a) {
|
|
6697
|
+
return [2 /*return*/, [
|
|
6698
|
+
/* !!! */
|
|
6699
|
+
]];
|
|
6700
|
+
});
|
|
6701
|
+
});
|
|
6702
|
+
};
|
|
6703
|
+
return RemoteLlmExecutionTools;
|
|
6704
|
+
}());
|
|
6705
|
+
/**
|
|
6706
|
+
* TODO: [🍜] !!!!!! Default remote remoteUrl and path for anonymous server
|
|
6707
|
+
* TODO: [🍓] Allow to list compatible models with each variant
|
|
6708
|
+
* TODO: [🗯] RemoteLlmExecutionTools should extend Destroyable and implement IDestroyable
|
|
6709
|
+
* TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
|
|
6710
|
+
* TODO: [🧠] Maybe remove `@promptbook/remote-client` and just use `@promptbook/core`
|
|
6711
|
+
*/
|
|
6712
|
+
|
|
6571
6713
|
/**
|
|
6572
6714
|
* Helper of usage compute
|
|
6573
6715
|
*
|
|
@@ -6697,6 +6839,7 @@ var ANTHROPIC_CLAUDE_MODELS = [
|
|
|
6697
6839
|
* Execution Tools for calling Anthropic Claude API.
|
|
6698
6840
|
*
|
|
6699
6841
|
* @public exported from `@promptbook/anthropic-claude`
|
|
6842
|
+
* @deprecated use `createAnthropicClaudeExecutionTools` instead
|
|
6700
6843
|
*/
|
|
6701
6844
|
var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
6702
6845
|
/**
|
|
@@ -6705,11 +6848,12 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
6705
6848
|
* @param options which are relevant are directly passed to the Anthropic Claude client
|
|
6706
6849
|
*/
|
|
6707
6850
|
function AnthropicClaudeExecutionTools(options) {
|
|
6708
|
-
if (options === void 0) { options = {}; }
|
|
6851
|
+
if (options === void 0) { options = { isProxied: false }; }
|
|
6709
6852
|
this.options = options;
|
|
6710
6853
|
// Note: Passing only Anthropic Claude relevant options to Anthropic constructor
|
|
6711
6854
|
var anthropicOptions = __assign({}, options);
|
|
6712
6855
|
delete anthropicOptions.isVerbose;
|
|
6856
|
+
delete anthropicOptions.isProxied;
|
|
6713
6857
|
this.client = new Anthropic(anthropicOptions);
|
|
6714
6858
|
}
|
|
6715
6859
|
Object.defineProperty(AnthropicClaudeExecutionTools.prototype, "title", {
|
|
@@ -6912,8 +7056,32 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
6912
7056
|
* TODO: Maybe Create some common util for callChatModel and callCompletionModel
|
|
6913
7057
|
* TODO: Maybe make custom OpenaiError
|
|
6914
7058
|
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
6915
|
-
* TODO: [🍜] Auto use anonymous server in browser
|
|
7059
|
+
* TODO: [🍜] !!!!!! Auto use anonymous server in browser
|
|
6916
7060
|
* TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
|
|
7061
|
+
* TODO: [📅] Maybe instead of `RemoteLlmExecutionToolsOptions` use `proxyWithAnonymousRemoteServer` (if implemented)
|
|
7062
|
+
*/
|
|
7063
|
+
|
|
7064
|
+
/**
|
|
7065
|
+
* Execution Tools for calling Anthropic Claude API.
|
|
7066
|
+
*
|
|
7067
|
+
* @public exported from `@promptbook/anthropic-claude`
|
|
7068
|
+
*/
|
|
7069
|
+
function createAnthropicClaudeExecutionTools(options) {
|
|
7070
|
+
if (options.isProxied) {
|
|
7071
|
+
return new RemoteLlmExecutionTools(__assign(__assign({}, options), { isAnonymous: true, llmToolsConfiguration: [
|
|
7072
|
+
{
|
|
7073
|
+
title: 'Anthropic Claude (proxied)',
|
|
7074
|
+
packageName: '@promptbook/anthropic-claude',
|
|
7075
|
+
className: 'AnthropicClaudeExecutionTools',
|
|
7076
|
+
options: __assign(__assign({}, options), { isProxied: false }),
|
|
7077
|
+
},
|
|
7078
|
+
] }));
|
|
7079
|
+
}
|
|
7080
|
+
return new AnthropicClaudeExecutionTools(options);
|
|
7081
|
+
}
|
|
7082
|
+
/**
|
|
7083
|
+
* TODO: !!!!!! Make this with all LLM providers
|
|
7084
|
+
* TODO: !!!!!! Maybe change all `new AnthropicClaudeExecutionTools` -> `createAnthropicClaudeExecutionTools` in manual
|
|
6917
7085
|
*/
|
|
6918
7086
|
|
|
6919
7087
|
/**
|
|
@@ -7859,11 +8027,11 @@ var OpenAiExecutionTools = /** @class */ (function () {
|
|
|
7859
8027
|
* @private internal type for `createLlmToolsFromConfiguration`
|
|
7860
8028
|
*/
|
|
7861
8029
|
var EXECUTION_TOOLS_CLASSES = {
|
|
7862
|
-
|
|
8030
|
+
createOpenAiExecutionTools: function (options) {
|
|
7863
8031
|
return new OpenAiExecutionTools(__assign(__assign({}, options), { dangerouslyAllowBrowser: true /* <- TODO: [🧠] !!! Some mechanism for auto-detection of browser, maybe hide in `OpenAiExecutionTools` */ }));
|
|
7864
8032
|
},
|
|
7865
|
-
|
|
7866
|
-
|
|
8033
|
+
createAnthropicClaudeExecutionTools: createAnthropicClaudeExecutionTools,
|
|
8034
|
+
createAzureOpenAiExecutionTools: function (options) { return new AzureOpenAiExecutionTools(options); },
|
|
7867
8035
|
// <- Note: [🦑] Add here new LLM provider
|
|
7868
8036
|
};
|
|
7869
8037
|
/**
|
|
@@ -7877,26 +8045,23 @@ var EXECUTION_TOOLS_CLASSES = {
|
|
|
7877
8045
|
* Note: This function is not cached, every call creates new instance of `MultipleLlmExecutionTools`
|
|
7878
8046
|
*
|
|
7879
8047
|
* @returns @@@
|
|
7880
|
-
* @public exported from `@promptbook/
|
|
8048
|
+
* @public exported from `@promptbook/core`
|
|
7881
8049
|
*/
|
|
7882
8050
|
function createLlmToolsFromConfiguration(configuration, options) {
|
|
7883
8051
|
if (options === void 0) { options = {}; }
|
|
7884
|
-
if (!isRunningInNode()) {
|
|
7885
|
-
throw new EnvironmentMismatchError('Function `createLlmToolsFromEnv` works only in Node.js environment');
|
|
7886
|
-
}
|
|
7887
8052
|
var _a = options.isVerbose, isVerbose = _a === void 0 ? false : _a;
|
|
7888
8053
|
dotenv.config();
|
|
7889
8054
|
var llmTools = configuration.map(function (llmConfiguration) {
|
|
7890
|
-
return EXECUTION_TOOLS_CLASSES["
|
|
8055
|
+
return EXECUTION_TOOLS_CLASSES["create".concat(llmConfiguration.className)](__assign({ isVerbose: isVerbose }, llmConfiguration.options));
|
|
7891
8056
|
});
|
|
7892
8057
|
return joinLlmExecutionTools.apply(void 0, __spreadArray([], __read(llmTools), false));
|
|
7893
8058
|
}
|
|
7894
8059
|
/**
|
|
8060
|
+
* TODO: [🎌] Togethere with `createLlmToolsFromConfiguration` + 'EXECUTION_TOOLS_CLASSES' gets to `@promptbook/core` ALL model providers, make this more efficient
|
|
7895
8061
|
* TODO: [🧠][🎌] Dynamically install required providers
|
|
7896
8062
|
* TODO: @@@ write discussion about this - wizzard
|
|
7897
8063
|
* TODO: [🧠][🍛] Which name is better `createLlmToolsFromConfig` or `createLlmToolsFromConfiguration`?
|
|
7898
8064
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
7899
|
-
* Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
|
|
7900
8065
|
* TODO: This should be maybe not under `_common` but under `utils`
|
|
7901
8066
|
*/
|
|
7902
8067
|
|