@promptbook/core 0.65.0-2 → 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 +213 -10
- 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 +216 -13
- 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,8 +1,8 @@
|
|
|
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('dotenv'), 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', 'dotenv', '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.dotenv, global.moment));
|
|
5
|
+
})(this, (function (exports, spaceTrim, prettier, parserHtml, hexEncoder, sha256, socket_ioClient, Anthropic, colors, openai, OpenAI, dotenv, moment) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
var parserHtml__default = /*#__PURE__*/_interopDefaultLegacy(parserHtml);
|
|
29
29
|
var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
|
|
30
30
|
var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
|
|
31
|
-
var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
|
|
32
31
|
var Anthropic__default = /*#__PURE__*/_interopDefaultLegacy(Anthropic);
|
|
33
32
|
var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
|
|
34
33
|
var OpenAI__default = /*#__PURE__*/_interopDefaultLegacy(OpenAI);
|
|
34
|
+
var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
|
|
35
35
|
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
36
36
|
|
|
37
37
|
// ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
|
|
38
38
|
/**
|
|
39
39
|
* The version of the Promptbook library
|
|
40
40
|
*/
|
|
41
|
-
var PROMPTBOOK_VERSION = '0.65.0-
|
|
41
|
+
var PROMPTBOOK_VERSION = '0.65.0-2';
|
|
42
42
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
43
43
|
|
|
44
44
|
/*! *****************************************************************************
|
|
@@ -1653,7 +1653,7 @@
|
|
|
1653
1653
|
});
|
|
1654
1654
|
}
|
|
1655
1655
|
|
|
1656
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.65.0-
|
|
1656
|
+
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"}];
|
|
1657
1657
|
|
|
1658
1658
|
var defaultDiacriticsRemovalMap = [
|
|
1659
1659
|
{
|
|
@@ -6501,6 +6501,147 @@
|
|
|
6501
6501
|
return CallbackInterfaceTools;
|
|
6502
6502
|
}());
|
|
6503
6503
|
|
|
6504
|
+
/**
|
|
6505
|
+
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
6506
|
+
*
|
|
6507
|
+
* You can simply use `RemoteExecutionTools` on client-side javascript and connect to your remote server.
|
|
6508
|
+
* This is useful to make all logic on browser side but not expose your API keys or no need to use customer's GPU.
|
|
6509
|
+
*
|
|
6510
|
+
* @see https://github.com/webgptorg/promptbook#remote-server
|
|
6511
|
+
* @public exported from `@promptbook/remote-client`
|
|
6512
|
+
*/
|
|
6513
|
+
var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
6514
|
+
function RemoteLlmExecutionTools(options) {
|
|
6515
|
+
this.options = options;
|
|
6516
|
+
}
|
|
6517
|
+
Object.defineProperty(RemoteLlmExecutionTools.prototype, "title", {
|
|
6518
|
+
get: function () {
|
|
6519
|
+
// TODO: [🧠] Maybe fetch title+description from the remote server (as well as if model methods are defined)
|
|
6520
|
+
return 'Remote server';
|
|
6521
|
+
},
|
|
6522
|
+
enumerable: false,
|
|
6523
|
+
configurable: true
|
|
6524
|
+
});
|
|
6525
|
+
Object.defineProperty(RemoteLlmExecutionTools.prototype, "description", {
|
|
6526
|
+
get: function () {
|
|
6527
|
+
return 'Use all models by your remote server';
|
|
6528
|
+
},
|
|
6529
|
+
enumerable: false,
|
|
6530
|
+
configurable: true
|
|
6531
|
+
});
|
|
6532
|
+
/**
|
|
6533
|
+
* Creates a connection to the remote proxy server.
|
|
6534
|
+
*/
|
|
6535
|
+
RemoteLlmExecutionTools.prototype.makeConnection = function () {
|
|
6536
|
+
var _this = this;
|
|
6537
|
+
return new Promise(function (resolve, reject) {
|
|
6538
|
+
var socket = socket_ioClient.io(_this.options.remoteUrl, {
|
|
6539
|
+
path: _this.options.path,
|
|
6540
|
+
// path: `${this.remoteUrl.pathname}/socket.io`,
|
|
6541
|
+
transports: [/*'websocket', <- TODO: [🌬] Make websocket transport work */ 'polling'],
|
|
6542
|
+
});
|
|
6543
|
+
// console.log('Connecting to', this.options.remoteUrl.href, { socket });
|
|
6544
|
+
socket.on('connect', function () {
|
|
6545
|
+
resolve(socket);
|
|
6546
|
+
});
|
|
6547
|
+
setTimeout(function () {
|
|
6548
|
+
reject(new Error("Timeout while connecting to ".concat(_this.options.remoteUrl)));
|
|
6549
|
+
}, 60000 /* <- TODO: Timeout to config */);
|
|
6550
|
+
});
|
|
6551
|
+
};
|
|
6552
|
+
/**
|
|
6553
|
+
* Calls remote proxy server to use a chat model
|
|
6554
|
+
*/
|
|
6555
|
+
RemoteLlmExecutionTools.prototype.callChatModel = function (prompt) {
|
|
6556
|
+
if (this.options.isVerbose) {
|
|
6557
|
+
console.info("\uD83D\uDD8B Remote callChatModel call");
|
|
6558
|
+
}
|
|
6559
|
+
return /* not await */ this.callCommonModel(prompt);
|
|
6560
|
+
};
|
|
6561
|
+
/**
|
|
6562
|
+
* Calls remote proxy server to use a completion model
|
|
6563
|
+
*/
|
|
6564
|
+
RemoteLlmExecutionTools.prototype.callCompletionModel = function (prompt) {
|
|
6565
|
+
if (this.options.isVerbose) {
|
|
6566
|
+
console.info("\uD83D\uDCAC Remote callCompletionModel call");
|
|
6567
|
+
}
|
|
6568
|
+
return /* not await */ this.callCommonModel(prompt);
|
|
6569
|
+
};
|
|
6570
|
+
/**
|
|
6571
|
+
* Calls remote proxy server to use a embedding model
|
|
6572
|
+
*/
|
|
6573
|
+
RemoteLlmExecutionTools.prototype.callEmbeddingModel = function (prompt) {
|
|
6574
|
+
if (this.options.isVerbose) {
|
|
6575
|
+
console.info("\uD83D\uDCAC Remote callEmbeddingModel call");
|
|
6576
|
+
}
|
|
6577
|
+
return /* not await */ this.callCommonModel(prompt);
|
|
6578
|
+
};
|
|
6579
|
+
// <- Note: [🤖] callXxxModel
|
|
6580
|
+
/**
|
|
6581
|
+
* Calls remote proxy server to use both completion or chat model
|
|
6582
|
+
*/
|
|
6583
|
+
RemoteLlmExecutionTools.prototype.callCommonModel = function (prompt) {
|
|
6584
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6585
|
+
var socket, promptResult;
|
|
6586
|
+
return __generator(this, function (_a) {
|
|
6587
|
+
switch (_a.label) {
|
|
6588
|
+
case 0: return [4 /*yield*/, this.makeConnection()];
|
|
6589
|
+
case 1:
|
|
6590
|
+
socket = _a.sent();
|
|
6591
|
+
if (this.options.isAnonymous) {
|
|
6592
|
+
socket.emit('request', {
|
|
6593
|
+
llmToolsConfiguration: this.options.llmToolsConfiguration,
|
|
6594
|
+
prompt: prompt,
|
|
6595
|
+
// <- TODO: [🛫] `prompt` is NOT fully serializable as JSON, it contains functions which are not serializable
|
|
6596
|
+
});
|
|
6597
|
+
}
|
|
6598
|
+
else {
|
|
6599
|
+
socket.emit('request', {
|
|
6600
|
+
clientId: this.options.clientId,
|
|
6601
|
+
prompt: prompt,
|
|
6602
|
+
// <- TODO: [🛫] `prompt` is NOT fully serializable as JSON, it contains functions which are not serializable
|
|
6603
|
+
});
|
|
6604
|
+
}
|
|
6605
|
+
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
6606
|
+
socket.on('response', function (response) {
|
|
6607
|
+
resolve(response.promptResult);
|
|
6608
|
+
socket.disconnect();
|
|
6609
|
+
});
|
|
6610
|
+
socket.on('error', function (error) {
|
|
6611
|
+
reject(new PipelineExecutionError(error.errorMessage));
|
|
6612
|
+
socket.disconnect();
|
|
6613
|
+
});
|
|
6614
|
+
})];
|
|
6615
|
+
case 2:
|
|
6616
|
+
promptResult = _a.sent();
|
|
6617
|
+
socket.disconnect();
|
|
6618
|
+
return [2 /*return*/, promptResult];
|
|
6619
|
+
}
|
|
6620
|
+
});
|
|
6621
|
+
});
|
|
6622
|
+
};
|
|
6623
|
+
/**
|
|
6624
|
+
* List all available models that can be used
|
|
6625
|
+
*/
|
|
6626
|
+
RemoteLlmExecutionTools.prototype.listModels = function () {
|
|
6627
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6628
|
+
return __generator(this, function (_a) {
|
|
6629
|
+
return [2 /*return*/, [
|
|
6630
|
+
/* !!! */
|
|
6631
|
+
]];
|
|
6632
|
+
});
|
|
6633
|
+
});
|
|
6634
|
+
};
|
|
6635
|
+
return RemoteLlmExecutionTools;
|
|
6636
|
+
}());
|
|
6637
|
+
/**
|
|
6638
|
+
* TODO: [🍜] !!!!!! Default remote remoteUrl and path for anonymous server
|
|
6639
|
+
* TODO: [🍓] Allow to list compatible models with each variant
|
|
6640
|
+
* TODO: [🗯] RemoteLlmExecutionTools should extend Destroyable and implement IDestroyable
|
|
6641
|
+
* TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
|
|
6642
|
+
* TODO: [🧠] Maybe remove `@promptbook/remote-client` and just use `@promptbook/core`
|
|
6643
|
+
*/
|
|
6644
|
+
|
|
6504
6645
|
/**
|
|
6505
6646
|
* Helper of usage compute
|
|
6506
6647
|
*
|
|
@@ -6630,6 +6771,7 @@
|
|
|
6630
6771
|
* Execution Tools for calling Anthropic Claude API.
|
|
6631
6772
|
*
|
|
6632
6773
|
* @public exported from `@promptbook/anthropic-claude`
|
|
6774
|
+
* @deprecated use `createAnthropicClaudeExecutionTools` instead
|
|
6633
6775
|
*/
|
|
6634
6776
|
var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
6635
6777
|
/**
|
|
@@ -6638,11 +6780,12 @@
|
|
|
6638
6780
|
* @param options which are relevant are directly passed to the Anthropic Claude client
|
|
6639
6781
|
*/
|
|
6640
6782
|
function AnthropicClaudeExecutionTools(options) {
|
|
6641
|
-
if (options === void 0) { options = {}; }
|
|
6783
|
+
if (options === void 0) { options = { isProxied: false }; }
|
|
6642
6784
|
this.options = options;
|
|
6643
6785
|
// Note: Passing only Anthropic Claude relevant options to Anthropic constructor
|
|
6644
6786
|
var anthropicOptions = __assign({}, options);
|
|
6645
6787
|
delete anthropicOptions.isVerbose;
|
|
6788
|
+
delete anthropicOptions.isProxied;
|
|
6646
6789
|
this.client = new Anthropic__default["default"](anthropicOptions);
|
|
6647
6790
|
}
|
|
6648
6791
|
Object.defineProperty(AnthropicClaudeExecutionTools.prototype, "title", {
|
|
@@ -6845,8 +6988,32 @@
|
|
|
6845
6988
|
* TODO: Maybe Create some common util for callChatModel and callCompletionModel
|
|
6846
6989
|
* TODO: Maybe make custom OpenaiError
|
|
6847
6990
|
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
6848
|
-
* TODO: [🍜] Auto use anonymous server in browser
|
|
6991
|
+
* TODO: [🍜] !!!!!! Auto use anonymous server in browser
|
|
6849
6992
|
* TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
|
|
6993
|
+
* TODO: [📅] Maybe instead of `RemoteLlmExecutionToolsOptions` use `proxyWithAnonymousRemoteServer` (if implemented)
|
|
6994
|
+
*/
|
|
6995
|
+
|
|
6996
|
+
/**
|
|
6997
|
+
* Execution Tools for calling Anthropic Claude API.
|
|
6998
|
+
*
|
|
6999
|
+
* @public exported from `@promptbook/anthropic-claude`
|
|
7000
|
+
*/
|
|
7001
|
+
function createAnthropicClaudeExecutionTools(options) {
|
|
7002
|
+
if (options.isProxied) {
|
|
7003
|
+
return new RemoteLlmExecutionTools(__assign(__assign({}, options), { isAnonymous: true, llmToolsConfiguration: [
|
|
7004
|
+
{
|
|
7005
|
+
title: 'Anthropic Claude (proxied)',
|
|
7006
|
+
packageName: '@promptbook/anthropic-claude',
|
|
7007
|
+
className: 'AnthropicClaudeExecutionTools',
|
|
7008
|
+
options: __assign(__assign({}, options), { isProxied: false }),
|
|
7009
|
+
},
|
|
7010
|
+
] }));
|
|
7011
|
+
}
|
|
7012
|
+
return new AnthropicClaudeExecutionTools(options);
|
|
7013
|
+
}
|
|
7014
|
+
/**
|
|
7015
|
+
* TODO: !!!!!! Make this with all LLM providers
|
|
7016
|
+
* TODO: !!!!!! Maybe change all `new AnthropicClaudeExecutionTools` -> `createAnthropicClaudeExecutionTools` in manual
|
|
6850
7017
|
*/
|
|
6851
7018
|
|
|
6852
7019
|
/**
|
|
@@ -7788,15 +7955,50 @@
|
|
|
7788
7955
|
* TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
|
|
7789
7956
|
*/
|
|
7790
7957
|
|
|
7958
|
+
/**
|
|
7959
|
+
* @public exported from `@promptbook/core`
|
|
7960
|
+
*/
|
|
7961
|
+
var LLM_CONFIGURATION_BOILERPLATES = [
|
|
7962
|
+
{
|
|
7963
|
+
title: 'Open AI',
|
|
7964
|
+
packageName: '@promptbook/openai',
|
|
7965
|
+
className: 'OpenAiExecutionTools',
|
|
7966
|
+
options: {
|
|
7967
|
+
apiKey: 'sk-',
|
|
7968
|
+
},
|
|
7969
|
+
},
|
|
7970
|
+
{
|
|
7971
|
+
title: 'Anthropic Claude',
|
|
7972
|
+
packageName: '@promptbook/anthropic-claude',
|
|
7973
|
+
className: 'AnthropicClaudeExecutionTools',
|
|
7974
|
+
options: {
|
|
7975
|
+
apiKey: 'sk-ant-api03-',
|
|
7976
|
+
isProxied: true,
|
|
7977
|
+
remoteUrl: 'https://!!!!!!',
|
|
7978
|
+
path: '/socket.io!!!!!!',
|
|
7979
|
+
},
|
|
7980
|
+
},
|
|
7981
|
+
{
|
|
7982
|
+
title: 'Azure Open AI',
|
|
7983
|
+
packageName: '@promptbook/azure-openai',
|
|
7984
|
+
className: 'AzureOpenAiExecutionTools',
|
|
7985
|
+
options: {
|
|
7986
|
+
// TODO: !!!> resourceName
|
|
7987
|
+
// TODO: !!!> deploymentName
|
|
7988
|
+
apiKey: 'sk-',
|
|
7989
|
+
},
|
|
7990
|
+
},
|
|
7991
|
+
// <- Note: [🦑] Add here new LLM provider
|
|
7992
|
+
];
|
|
7791
7993
|
/**
|
|
7792
7994
|
* @private internal type for `createLlmToolsFromConfiguration`
|
|
7793
7995
|
*/
|
|
7794
7996
|
var EXECUTION_TOOLS_CLASSES = {
|
|
7795
|
-
|
|
7997
|
+
createOpenAiExecutionTools: function (options) {
|
|
7796
7998
|
return new OpenAiExecutionTools(__assign(__assign({}, options), { dangerouslyAllowBrowser: true /* <- TODO: [🧠] !!! Some mechanism for auto-detection of browser, maybe hide in `OpenAiExecutionTools` */ }));
|
|
7797
7999
|
},
|
|
7798
|
-
|
|
7799
|
-
|
|
8000
|
+
createAnthropicClaudeExecutionTools: createAnthropicClaudeExecutionTools,
|
|
8001
|
+
createAzureOpenAiExecutionTools: function (options) { return new AzureOpenAiExecutionTools(options); },
|
|
7800
8002
|
// <- Note: [🦑] Add here new LLM provider
|
|
7801
8003
|
};
|
|
7802
8004
|
/**
|
|
@@ -7817,7 +8019,7 @@
|
|
|
7817
8019
|
var _a = options.isVerbose, isVerbose = _a === void 0 ? false : _a;
|
|
7818
8020
|
dotenv__namespace.config();
|
|
7819
8021
|
var llmTools = configuration.map(function (llmConfiguration) {
|
|
7820
|
-
return EXECUTION_TOOLS_CLASSES["
|
|
8022
|
+
return EXECUTION_TOOLS_CLASSES["create".concat(llmConfiguration.className)](__assign({ isVerbose: isVerbose }, llmConfiguration.options));
|
|
7821
8023
|
});
|
|
7822
8024
|
return joinLlmExecutionTools.apply(void 0, __spreadArray([], __read(llmTools), false));
|
|
7823
8025
|
}
|
|
@@ -8411,6 +8613,7 @@
|
|
|
8411
8613
|
exports.EXPECTATION_UNITS = EXPECTATION_UNITS;
|
|
8412
8614
|
exports.EnvironmentMismatchError = EnvironmentMismatchError;
|
|
8413
8615
|
exports.ExecutionReportStringOptionsDefaults = ExecutionReportStringOptionsDefaults;
|
|
8616
|
+
exports.LLM_CONFIGURATION_BOILERPLATES = LLM_CONFIGURATION_BOILERPLATES;
|
|
8414
8617
|
exports.LimitReachedError = LimitReachedError;
|
|
8415
8618
|
exports.MAX_EXECUTION_ATTEMPTS = MAX_EXECUTION_ATTEMPTS;
|
|
8416
8619
|
exports.MAX_FILENAME_LENGTH = MAX_FILENAME_LENGTH;
|