@promptbook/core 0.65.0-2 → 0.65.0-4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.es.js +212 -11
- 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 +2 -0
- package/esm/typings/src/_packages/node.index.d.ts +0 -2
- 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/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 +215 -32
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +0 -26
package/umd/index.umd.js
CHANGED
|
@@ -1,34 +1,15 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('prettier'), require('prettier/parser-html'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'prettier', 'prettier/parser-html', 'crypto-js/enc-hex', 'crypto-js/sha256', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-core"] = {}, global.spaceTrim, global.prettier, global.parserHtml, global.hexEncoder, global.sha256, global.
|
|
5
|
-
})(this, (function (exports, spaceTrim, prettier, parserHtml, hexEncoder, sha256,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('prettier'), require('prettier/parser-html'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('socket.io-client'), require('@anthropic-ai/sdk'), require('colors'), require('@azure/openai'), require('openai'), require('moment')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'prettier', 'prettier/parser-html', 'crypto-js/enc-hex', 'crypto-js/sha256', 'socket.io-client', '@anthropic-ai/sdk', 'colors', '@azure/openai', 'openai', 'moment'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-core"] = {}, global.spaceTrim, global.prettier, global.parserHtml, global.hexEncoder, global.sha256, global.socket_ioClient, global.Anthropic, global.colors, global.openai, global.OpenAI, global.moment));
|
|
5
|
+
})(this, (function (exports, spaceTrim, prettier, parserHtml, hexEncoder, sha256, socket_ioClient, Anthropic, colors, openai, OpenAI, moment) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
|
-
function _interopNamespace(e) {
|
|
10
|
-
if (e && e.__esModule) return e;
|
|
11
|
-
var n = Object.create(null);
|
|
12
|
-
if (e) {
|
|
13
|
-
Object.keys(e).forEach(function (k) {
|
|
14
|
-
if (k !== 'default') {
|
|
15
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () { return e[k]; }
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
n["default"] = e;
|
|
24
|
-
return Object.freeze(n);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
9
|
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
|
|
28
10
|
var parserHtml__default = /*#__PURE__*/_interopDefaultLegacy(parserHtml);
|
|
29
11
|
var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
|
|
30
12
|
var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
|
|
31
|
-
var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
|
|
32
13
|
var Anthropic__default = /*#__PURE__*/_interopDefaultLegacy(Anthropic);
|
|
33
14
|
var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
|
|
34
15
|
var OpenAI__default = /*#__PURE__*/_interopDefaultLegacy(OpenAI);
|
|
@@ -38,7 +19,7 @@
|
|
|
38
19
|
/**
|
|
39
20
|
* The version of the Promptbook library
|
|
40
21
|
*/
|
|
41
|
-
var PROMPTBOOK_VERSION = '0.65.0-
|
|
22
|
+
var PROMPTBOOK_VERSION = '0.65.0-3';
|
|
42
23
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
43
24
|
|
|
44
25
|
/*! *****************************************************************************
|
|
@@ -1653,7 +1634,7 @@
|
|
|
1653
1634
|
});
|
|
1654
1635
|
}
|
|
1655
1636
|
|
|
1656
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.65.0-
|
|
1637
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.65.0-3",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-3",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-3",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-3",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"}];
|
|
1657
1638
|
|
|
1658
1639
|
var defaultDiacriticsRemovalMap = [
|
|
1659
1640
|
{
|
|
@@ -6501,6 +6482,147 @@
|
|
|
6501
6482
|
return CallbackInterfaceTools;
|
|
6502
6483
|
}());
|
|
6503
6484
|
|
|
6485
|
+
/**
|
|
6486
|
+
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
6487
|
+
*
|
|
6488
|
+
* You can simply use `RemoteExecutionTools` on client-side javascript and connect to your remote server.
|
|
6489
|
+
* This is useful to make all logic on browser side but not expose your API keys or no need to use customer's GPU.
|
|
6490
|
+
*
|
|
6491
|
+
* @see https://github.com/webgptorg/promptbook#remote-server
|
|
6492
|
+
* @public exported from `@promptbook/remote-client`
|
|
6493
|
+
*/
|
|
6494
|
+
var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
6495
|
+
function RemoteLlmExecutionTools(options) {
|
|
6496
|
+
this.options = options;
|
|
6497
|
+
}
|
|
6498
|
+
Object.defineProperty(RemoteLlmExecutionTools.prototype, "title", {
|
|
6499
|
+
get: function () {
|
|
6500
|
+
// TODO: [🧠] Maybe fetch title+description from the remote server (as well as if model methods are defined)
|
|
6501
|
+
return 'Remote server';
|
|
6502
|
+
},
|
|
6503
|
+
enumerable: false,
|
|
6504
|
+
configurable: true
|
|
6505
|
+
});
|
|
6506
|
+
Object.defineProperty(RemoteLlmExecutionTools.prototype, "description", {
|
|
6507
|
+
get: function () {
|
|
6508
|
+
return 'Use all models by your remote server';
|
|
6509
|
+
},
|
|
6510
|
+
enumerable: false,
|
|
6511
|
+
configurable: true
|
|
6512
|
+
});
|
|
6513
|
+
/**
|
|
6514
|
+
* Creates a connection to the remote proxy server.
|
|
6515
|
+
*/
|
|
6516
|
+
RemoteLlmExecutionTools.prototype.makeConnection = function () {
|
|
6517
|
+
var _this = this;
|
|
6518
|
+
return new Promise(function (resolve, reject) {
|
|
6519
|
+
var socket = socket_ioClient.io(_this.options.remoteUrl, {
|
|
6520
|
+
path: _this.options.path,
|
|
6521
|
+
// path: `${this.remoteUrl.pathname}/socket.io`,
|
|
6522
|
+
transports: [/*'websocket', <- TODO: [🌬] Make websocket transport work */ 'polling'],
|
|
6523
|
+
});
|
|
6524
|
+
// console.log('Connecting to', this.options.remoteUrl.href, { socket });
|
|
6525
|
+
socket.on('connect', function () {
|
|
6526
|
+
resolve(socket);
|
|
6527
|
+
});
|
|
6528
|
+
setTimeout(function () {
|
|
6529
|
+
reject(new Error("Timeout while connecting to ".concat(_this.options.remoteUrl)));
|
|
6530
|
+
}, 60000 /* <- TODO: Timeout to config */);
|
|
6531
|
+
});
|
|
6532
|
+
};
|
|
6533
|
+
/**
|
|
6534
|
+
* Calls remote proxy server to use a chat model
|
|
6535
|
+
*/
|
|
6536
|
+
RemoteLlmExecutionTools.prototype.callChatModel = function (prompt) {
|
|
6537
|
+
if (this.options.isVerbose) {
|
|
6538
|
+
console.info("\uD83D\uDD8B Remote callChatModel call");
|
|
6539
|
+
}
|
|
6540
|
+
return /* not await */ this.callCommonModel(prompt);
|
|
6541
|
+
};
|
|
6542
|
+
/**
|
|
6543
|
+
* Calls remote proxy server to use a completion model
|
|
6544
|
+
*/
|
|
6545
|
+
RemoteLlmExecutionTools.prototype.callCompletionModel = function (prompt) {
|
|
6546
|
+
if (this.options.isVerbose) {
|
|
6547
|
+
console.info("\uD83D\uDCAC Remote callCompletionModel call");
|
|
6548
|
+
}
|
|
6549
|
+
return /* not await */ this.callCommonModel(prompt);
|
|
6550
|
+
};
|
|
6551
|
+
/**
|
|
6552
|
+
* Calls remote proxy server to use a embedding model
|
|
6553
|
+
*/
|
|
6554
|
+
RemoteLlmExecutionTools.prototype.callEmbeddingModel = function (prompt) {
|
|
6555
|
+
if (this.options.isVerbose) {
|
|
6556
|
+
console.info("\uD83D\uDCAC Remote callEmbeddingModel call");
|
|
6557
|
+
}
|
|
6558
|
+
return /* not await */ this.callCommonModel(prompt);
|
|
6559
|
+
};
|
|
6560
|
+
// <- Note: [🤖] callXxxModel
|
|
6561
|
+
/**
|
|
6562
|
+
* Calls remote proxy server to use both completion or chat model
|
|
6563
|
+
*/
|
|
6564
|
+
RemoteLlmExecutionTools.prototype.callCommonModel = function (prompt) {
|
|
6565
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6566
|
+
var socket, promptResult;
|
|
6567
|
+
return __generator(this, function (_a) {
|
|
6568
|
+
switch (_a.label) {
|
|
6569
|
+
case 0: return [4 /*yield*/, this.makeConnection()];
|
|
6570
|
+
case 1:
|
|
6571
|
+
socket = _a.sent();
|
|
6572
|
+
if (this.options.isAnonymous) {
|
|
6573
|
+
socket.emit('request', {
|
|
6574
|
+
llmToolsConfiguration: this.options.llmToolsConfiguration,
|
|
6575
|
+
prompt: prompt,
|
|
6576
|
+
// <- TODO: [🛫] `prompt` is NOT fully serializable as JSON, it contains functions which are not serializable
|
|
6577
|
+
});
|
|
6578
|
+
}
|
|
6579
|
+
else {
|
|
6580
|
+
socket.emit('request', {
|
|
6581
|
+
clientId: this.options.clientId,
|
|
6582
|
+
prompt: prompt,
|
|
6583
|
+
// <- TODO: [🛫] `prompt` is NOT fully serializable as JSON, it contains functions which are not serializable
|
|
6584
|
+
});
|
|
6585
|
+
}
|
|
6586
|
+
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
6587
|
+
socket.on('response', function (response) {
|
|
6588
|
+
resolve(response.promptResult);
|
|
6589
|
+
socket.disconnect();
|
|
6590
|
+
});
|
|
6591
|
+
socket.on('error', function (error) {
|
|
6592
|
+
reject(new PipelineExecutionError(error.errorMessage));
|
|
6593
|
+
socket.disconnect();
|
|
6594
|
+
});
|
|
6595
|
+
})];
|
|
6596
|
+
case 2:
|
|
6597
|
+
promptResult = _a.sent();
|
|
6598
|
+
socket.disconnect();
|
|
6599
|
+
return [2 /*return*/, promptResult];
|
|
6600
|
+
}
|
|
6601
|
+
});
|
|
6602
|
+
});
|
|
6603
|
+
};
|
|
6604
|
+
/**
|
|
6605
|
+
* List all available models that can be used
|
|
6606
|
+
*/
|
|
6607
|
+
RemoteLlmExecutionTools.prototype.listModels = function () {
|
|
6608
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6609
|
+
return __generator(this, function (_a) {
|
|
6610
|
+
return [2 /*return*/, [
|
|
6611
|
+
/* !!! */
|
|
6612
|
+
]];
|
|
6613
|
+
});
|
|
6614
|
+
});
|
|
6615
|
+
};
|
|
6616
|
+
return RemoteLlmExecutionTools;
|
|
6617
|
+
}());
|
|
6618
|
+
/**
|
|
6619
|
+
* TODO: [🍜] !!!!!! Default remote remoteUrl and path for anonymous server
|
|
6620
|
+
* TODO: [🍓] Allow to list compatible models with each variant
|
|
6621
|
+
* TODO: [🗯] RemoteLlmExecutionTools should extend Destroyable and implement IDestroyable
|
|
6622
|
+
* TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
|
|
6623
|
+
* TODO: [🧠] Maybe remove `@promptbook/remote-client` and just use `@promptbook/core`
|
|
6624
|
+
*/
|
|
6625
|
+
|
|
6504
6626
|
/**
|
|
6505
6627
|
* Helper of usage compute
|
|
6506
6628
|
*
|
|
@@ -6630,6 +6752,7 @@
|
|
|
6630
6752
|
* Execution Tools for calling Anthropic Claude API.
|
|
6631
6753
|
*
|
|
6632
6754
|
* @public exported from `@promptbook/anthropic-claude`
|
|
6755
|
+
* @deprecated use `createAnthropicClaudeExecutionTools` instead
|
|
6633
6756
|
*/
|
|
6634
6757
|
var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
6635
6758
|
/**
|
|
@@ -6638,11 +6761,12 @@
|
|
|
6638
6761
|
* @param options which are relevant are directly passed to the Anthropic Claude client
|
|
6639
6762
|
*/
|
|
6640
6763
|
function AnthropicClaudeExecutionTools(options) {
|
|
6641
|
-
if (options === void 0) { options = {}; }
|
|
6764
|
+
if (options === void 0) { options = { isProxied: false }; }
|
|
6642
6765
|
this.options = options;
|
|
6643
6766
|
// Note: Passing only Anthropic Claude relevant options to Anthropic constructor
|
|
6644
6767
|
var anthropicOptions = __assign({}, options);
|
|
6645
6768
|
delete anthropicOptions.isVerbose;
|
|
6769
|
+
delete anthropicOptions.isProxied;
|
|
6646
6770
|
this.client = new Anthropic__default["default"](anthropicOptions);
|
|
6647
6771
|
}
|
|
6648
6772
|
Object.defineProperty(AnthropicClaudeExecutionTools.prototype, "title", {
|
|
@@ -6845,8 +6969,32 @@
|
|
|
6845
6969
|
* TODO: Maybe Create some common util for callChatModel and callCompletionModel
|
|
6846
6970
|
* TODO: Maybe make custom OpenaiError
|
|
6847
6971
|
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
6848
|
-
* TODO: [🍜] Auto use anonymous server in browser
|
|
6972
|
+
* TODO: [🍜] !!!!!! Auto use anonymous server in browser
|
|
6849
6973
|
* TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
|
|
6974
|
+
* TODO: [📅] Maybe instead of `RemoteLlmExecutionToolsOptions` use `proxyWithAnonymousRemoteServer` (if implemented)
|
|
6975
|
+
*/
|
|
6976
|
+
|
|
6977
|
+
/**
|
|
6978
|
+
* Execution Tools for calling Anthropic Claude API.
|
|
6979
|
+
*
|
|
6980
|
+
* @public exported from `@promptbook/anthropic-claude`
|
|
6981
|
+
*/
|
|
6982
|
+
function createAnthropicClaudeExecutionTools(options) {
|
|
6983
|
+
if (options.isProxied) {
|
|
6984
|
+
return new RemoteLlmExecutionTools(__assign(__assign({}, options), { isAnonymous: true, llmToolsConfiguration: [
|
|
6985
|
+
{
|
|
6986
|
+
title: 'Anthropic Claude (proxied)',
|
|
6987
|
+
packageName: '@promptbook/anthropic-claude',
|
|
6988
|
+
className: 'AnthropicClaudeExecutionTools',
|
|
6989
|
+
options: __assign(__assign({}, options), { isProxied: false }),
|
|
6990
|
+
},
|
|
6991
|
+
] }));
|
|
6992
|
+
}
|
|
6993
|
+
return new AnthropicClaudeExecutionTools(options);
|
|
6994
|
+
}
|
|
6995
|
+
/**
|
|
6996
|
+
* TODO: !!!!!! Make this with all LLM providers
|
|
6997
|
+
* TODO: !!!!!! Maybe change all `new AnthropicClaudeExecutionTools` -> `createAnthropicClaudeExecutionTools` in manual
|
|
6850
6998
|
*/
|
|
6851
6999
|
|
|
6852
7000
|
/**
|
|
@@ -7788,15 +7936,50 @@
|
|
|
7788
7936
|
* TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
|
|
7789
7937
|
*/
|
|
7790
7938
|
|
|
7939
|
+
/**
|
|
7940
|
+
* @public exported from `@promptbook/core`
|
|
7941
|
+
*/
|
|
7942
|
+
var LLM_CONFIGURATION_BOILERPLATES = [
|
|
7943
|
+
{
|
|
7944
|
+
title: 'Open AI',
|
|
7945
|
+
packageName: '@promptbook/openai',
|
|
7946
|
+
className: 'OpenAiExecutionTools',
|
|
7947
|
+
options: {
|
|
7948
|
+
apiKey: 'sk-',
|
|
7949
|
+
},
|
|
7950
|
+
},
|
|
7951
|
+
{
|
|
7952
|
+
title: 'Anthropic Claude',
|
|
7953
|
+
packageName: '@promptbook/anthropic-claude',
|
|
7954
|
+
className: 'AnthropicClaudeExecutionTools',
|
|
7955
|
+
options: {
|
|
7956
|
+
apiKey: 'sk-ant-api03-',
|
|
7957
|
+
isProxied: true,
|
|
7958
|
+
remoteUrl: 'https://!!!!!!',
|
|
7959
|
+
path: '/socket.io!!!!!!',
|
|
7960
|
+
},
|
|
7961
|
+
},
|
|
7962
|
+
{
|
|
7963
|
+
title: 'Azure Open AI',
|
|
7964
|
+
packageName: '@promptbook/azure-openai',
|
|
7965
|
+
className: 'AzureOpenAiExecutionTools',
|
|
7966
|
+
options: {
|
|
7967
|
+
// TODO: !!!> resourceName
|
|
7968
|
+
// TODO: !!!> deploymentName
|
|
7969
|
+
apiKey: 'sk-',
|
|
7970
|
+
},
|
|
7971
|
+
},
|
|
7972
|
+
// <- Note: [🦑] Add here new LLM provider
|
|
7973
|
+
];
|
|
7791
7974
|
/**
|
|
7792
7975
|
* @private internal type for `createLlmToolsFromConfiguration`
|
|
7793
7976
|
*/
|
|
7794
7977
|
var EXECUTION_TOOLS_CLASSES = {
|
|
7795
|
-
|
|
7978
|
+
createOpenAiExecutionTools: function (options) {
|
|
7796
7979
|
return new OpenAiExecutionTools(__assign(__assign({}, options), { dangerouslyAllowBrowser: true /* <- TODO: [🧠] !!! Some mechanism for auto-detection of browser, maybe hide in `OpenAiExecutionTools` */ }));
|
|
7797
7980
|
},
|
|
7798
|
-
|
|
7799
|
-
|
|
7981
|
+
createAnthropicClaudeExecutionTools: createAnthropicClaudeExecutionTools,
|
|
7982
|
+
createAzureOpenAiExecutionTools: function (options) { return new AzureOpenAiExecutionTools(options); },
|
|
7800
7983
|
// <- Note: [🦑] Add here new LLM provider
|
|
7801
7984
|
};
|
|
7802
7985
|
/**
|
|
@@ -7815,9 +7998,8 @@
|
|
|
7815
7998
|
function createLlmToolsFromConfiguration(configuration, options) {
|
|
7816
7999
|
if (options === void 0) { options = {}; }
|
|
7817
8000
|
var _a = options.isVerbose, isVerbose = _a === void 0 ? false : _a;
|
|
7818
|
-
dotenv__namespace.config();
|
|
7819
8001
|
var llmTools = configuration.map(function (llmConfiguration) {
|
|
7820
|
-
return EXECUTION_TOOLS_CLASSES["
|
|
8002
|
+
return EXECUTION_TOOLS_CLASSES["create".concat(llmConfiguration.className)](__assign({ isVerbose: isVerbose }, llmConfiguration.options));
|
|
7821
8003
|
});
|
|
7822
8004
|
return joinLlmExecutionTools.apply(void 0, __spreadArray([], __read(llmTools), false));
|
|
7823
8005
|
}
|
|
@@ -8411,6 +8593,7 @@
|
|
|
8411
8593
|
exports.EXPECTATION_UNITS = EXPECTATION_UNITS;
|
|
8412
8594
|
exports.EnvironmentMismatchError = EnvironmentMismatchError;
|
|
8413
8595
|
exports.ExecutionReportStringOptionsDefaults = ExecutionReportStringOptionsDefaults;
|
|
8596
|
+
exports.LLM_CONFIGURATION_BOILERPLATES = LLM_CONFIGURATION_BOILERPLATES;
|
|
8414
8597
|
exports.LimitReachedError = LimitReachedError;
|
|
8415
8598
|
exports.MAX_EXECUTION_ATTEMPTS = MAX_EXECUTION_ATTEMPTS;
|
|
8416
8599
|
exports.MAX_FILENAME_LENGTH = MAX_FILENAME_LENGTH;
|