@promptbook/cli 0.81.0 → 0.82.0-2
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/README.md +4 -0
- package/esm/index.es.js +57 -69
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/remote-client.index.d.ts +14 -4
- package/esm/typings/src/_packages/remote-server.index.d.ts +9 -3
- package/esm/typings/src/_packages/types.index.d.ts +20 -30
- package/esm/typings/src/collection/PipelineCollection.d.ts +2 -0
- package/esm/typings/src/conversion/compilePipelineOnRemoteServer.d.ts +21 -0
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +3 -7
- package/esm/typings/src/other/templates/getBookTemplates.d.ts +5 -3
- package/esm/typings/src/prepare/preparePipeline.d.ts +2 -2
- package/esm/typings/src/prepare/preparePipelineOnRemoteServer.d.ts +17 -0
- package/esm/typings/src/remote-server/createRemoteClient.d.ts +10 -0
- package/esm/typings/src/{llm-providers/remote/interfaces → remote-server/socket-types/_common}/PromptbookServer_Error.d.ts +2 -2
- package/esm/typings/src/remote-server/socket-types/_common/PromptbookServer_Progress.d.ts +10 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts +49 -0
- package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +17 -0
- package/esm/typings/src/{llm-providers/remote/interfaces → remote-server/socket-types/listModels}/PromptbookServer_ListModels_Response.d.ts +3 -1
- package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Request.d.ts +17 -0
- package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Response.d.ts +12 -0
- package/esm/typings/src/remote-server/socket-types/prompt/PromptbookServer_Prompt_Request.d.ts +17 -0
- package/esm/typings/src/{llm-providers/remote/interfaces → remote-server/socket-types/prompt}/PromptbookServer_Prompt_Response.d.ts +2 -2
- package/esm/typings/src/{llm-providers/remote → remote-server}/startRemoteServer.d.ts +3 -2
- package/esm/typings/src/remote-server/types/RemoteClientOptions.d.ts +32 -0
- package/esm/typings/src/{llm-providers/remote/interfaces → remote-server/types}/RemoteServerOptions.d.ts +10 -10
- package/esm/typings/src/types/Arrayable.d.ts +1 -0
- package/esm/typings/src/types/NonEmptyArray.d.ts +8 -0
- package/package.json +1 -1
- package/umd/index.umd.js +57 -69
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Request.d.ts +0 -38
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Progress.d.ts +0 -12
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Request.d.ts +0 -45
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteLlmExecutionToolsOptions.d.ts +0 -54
package/README.md
CHANGED
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
+
<blockquote style="color: #ff8811">
|
|
27
|
+
<b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
28
|
+
</blockquote>
|
|
29
|
+
|
|
26
30
|
## 📦 Package `@promptbook/cli`
|
|
27
31
|
|
|
28
32
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
package/esm/index.es.js
CHANGED
|
@@ -39,7 +39,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
39
39
|
* @generated
|
|
40
40
|
* @see https://github.com/webgptorg/promptbook
|
|
41
41
|
*/
|
|
42
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
42
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.82.0-1';
|
|
43
43
|
/**
|
|
44
44
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
45
45
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -6773,7 +6773,7 @@ function prepareTasks(pipeline, tools, options) {
|
|
|
6773
6773
|
*/
|
|
6774
6774
|
|
|
6775
6775
|
/**
|
|
6776
|
-
* Prepare pipeline
|
|
6776
|
+
* Prepare pipeline locally
|
|
6777
6777
|
*
|
|
6778
6778
|
* @see https://github.com/webgptorg/promptbook/discussions/196
|
|
6779
6779
|
*
|
|
@@ -6899,7 +6899,7 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
6899
6899
|
});
|
|
6900
6900
|
}
|
|
6901
6901
|
/**
|
|
6902
|
-
* TODO: Write tests for `preparePipeline`
|
|
6902
|
+
* TODO: Write tests for `preparePipeline` and `preparePipelineOnRemoteServer`
|
|
6903
6903
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
6904
6904
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
6905
6905
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
@@ -13256,6 +13256,39 @@ var _AnthropicClaudeMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
|
13256
13256
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
13257
13257
|
*/
|
|
13258
13258
|
|
|
13259
|
+
/**
|
|
13260
|
+
* Creates a connection to the remote proxy server.
|
|
13261
|
+
*
|
|
13262
|
+
* Note: This function creates a connection to the remote server and returns a socket but responsibility of closing the connection is on the caller
|
|
13263
|
+
*
|
|
13264
|
+
* @private internal utility function
|
|
13265
|
+
*/
|
|
13266
|
+
function createRemoteClient(options) {
|
|
13267
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
13268
|
+
var remoteUrl, path;
|
|
13269
|
+
return __generator(this, function (_a) {
|
|
13270
|
+
remoteUrl = options.remoteUrl, path = options.path;
|
|
13271
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
13272
|
+
var socket = io(remoteUrl, {
|
|
13273
|
+
retries: CONNECTION_RETRIES_LIMIT,
|
|
13274
|
+
timeout: CONNECTION_TIMEOUT_MS,
|
|
13275
|
+
path: path,
|
|
13276
|
+
// path: `${this.remoteUrl.pathname}/socket.io`,
|
|
13277
|
+
transports: [/*'websocket', <- TODO: [🌬] Make websocket transport work */ 'polling'],
|
|
13278
|
+
});
|
|
13279
|
+
// console.log('Connecting to', this.options.remoteUrl.href, { socket });
|
|
13280
|
+
socket.on('connect', function () {
|
|
13281
|
+
resolve(socket);
|
|
13282
|
+
});
|
|
13283
|
+
// TODO: [💩] Better timeout handling
|
|
13284
|
+
setTimeout(function () {
|
|
13285
|
+
reject(new Error("Timeout while connecting to ".concat(remoteUrl)));
|
|
13286
|
+
}, CONNECTION_TIMEOUT_MS);
|
|
13287
|
+
})];
|
|
13288
|
+
});
|
|
13289
|
+
});
|
|
13290
|
+
}
|
|
13291
|
+
|
|
13259
13292
|
/**
|
|
13260
13293
|
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
13261
13294
|
*
|
|
@@ -13293,7 +13326,7 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
13293
13326
|
var socket;
|
|
13294
13327
|
return __generator(this, function (_a) {
|
|
13295
13328
|
switch (_a.label) {
|
|
13296
|
-
case 0: return [4 /*yield*/, this.
|
|
13329
|
+
case 0: return [4 /*yield*/, createRemoteClient(this.options)];
|
|
13297
13330
|
case 1:
|
|
13298
13331
|
socket = _a.sent();
|
|
13299
13332
|
socket.disconnect();
|
|
@@ -13310,24 +13343,12 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
13310
13343
|
var socket, promptResult;
|
|
13311
13344
|
return __generator(this, function (_a) {
|
|
13312
13345
|
switch (_a.label) {
|
|
13313
|
-
case 0: return [4 /*yield*/, this.
|
|
13346
|
+
case 0: return [4 /*yield*/, createRemoteClient(this.options)];
|
|
13314
13347
|
case 1:
|
|
13315
13348
|
socket = _a.sent();
|
|
13316
|
-
|
|
13317
|
-
|
|
13318
|
-
|
|
13319
|
-
userId: this.options.userId,
|
|
13320
|
-
llmToolsConfiguration: this.options.llmToolsConfiguration,
|
|
13321
|
-
} /* <- Note: [🤛] */);
|
|
13322
|
-
}
|
|
13323
|
-
else {
|
|
13324
|
-
socket.emit('listModels-request', {
|
|
13325
|
-
isAnonymous: false,
|
|
13326
|
-
appId: this.options.appId,
|
|
13327
|
-
userId: this.options.userId,
|
|
13328
|
-
customOptions: this.options.customOptions,
|
|
13329
|
-
} /* <- Note: [🤛] */);
|
|
13330
|
-
}
|
|
13349
|
+
socket.emit('listModels-request', {
|
|
13350
|
+
identification: this.options.identification,
|
|
13351
|
+
} /* <- Note: [🤛] */);
|
|
13331
13352
|
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
13332
13353
|
socket.on('listModels-response', function (response) {
|
|
13333
13354
|
resolve(response.models);
|
|
@@ -13346,29 +13367,6 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
13346
13367
|
});
|
|
13347
13368
|
});
|
|
13348
13369
|
};
|
|
13349
|
-
/**
|
|
13350
|
-
* Creates a connection to the remote proxy server.
|
|
13351
|
-
*/
|
|
13352
|
-
RemoteLlmExecutionTools.prototype.makeConnection = function () {
|
|
13353
|
-
var _this = this;
|
|
13354
|
-
return new Promise(function (resolve, reject) {
|
|
13355
|
-
var socket = io(_this.options.remoteUrl, {
|
|
13356
|
-
retries: CONNECTION_RETRIES_LIMIT,
|
|
13357
|
-
timeout: CONNECTION_TIMEOUT_MS,
|
|
13358
|
-
path: _this.options.path,
|
|
13359
|
-
// path: `${this.remoteUrl.pathname}/socket.io`,
|
|
13360
|
-
transports: [/*'websocket', <- TODO: [🌬] Make websocket transport work */ 'polling'],
|
|
13361
|
-
});
|
|
13362
|
-
// console.log('Connecting to', this.options.remoteUrl.href, { socket });
|
|
13363
|
-
socket.on('connect', function () {
|
|
13364
|
-
resolve(socket);
|
|
13365
|
-
});
|
|
13366
|
-
// TODO: [💩] Better timeout handling
|
|
13367
|
-
setTimeout(function () {
|
|
13368
|
-
reject(new Error("Timeout while connecting to ".concat(_this.options.remoteUrl)));
|
|
13369
|
-
}, CONNECTION_TIMEOUT_MS);
|
|
13370
|
-
});
|
|
13371
|
-
};
|
|
13372
13370
|
/**
|
|
13373
13371
|
* Calls remote proxy server to use a chat model
|
|
13374
13372
|
*/
|
|
@@ -13405,26 +13403,13 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
|
|
|
13405
13403
|
var socket, promptResult;
|
|
13406
13404
|
return __generator(this, function (_a) {
|
|
13407
13405
|
switch (_a.label) {
|
|
13408
|
-
case 0: return [4 /*yield*/, this.
|
|
13406
|
+
case 0: return [4 /*yield*/, createRemoteClient(this.options)];
|
|
13409
13407
|
case 1:
|
|
13410
13408
|
socket = _a.sent();
|
|
13411
|
-
|
|
13412
|
-
|
|
13413
|
-
|
|
13414
|
-
|
|
13415
|
-
llmToolsConfiguration: this.options.llmToolsConfiguration,
|
|
13416
|
-
prompt: prompt,
|
|
13417
|
-
} /* <- Note: [🤛] */);
|
|
13418
|
-
}
|
|
13419
|
-
else {
|
|
13420
|
-
socket.emit('prompt-request', {
|
|
13421
|
-
isAnonymous: false,
|
|
13422
|
-
appId: this.options.appId,
|
|
13423
|
-
userId: this.options.userId,
|
|
13424
|
-
customOptions: this.options.customOptions,
|
|
13425
|
-
prompt: prompt,
|
|
13426
|
-
} /* <- Note: [🤛] */);
|
|
13427
|
-
}
|
|
13409
|
+
socket.emit('prompt-request', {
|
|
13410
|
+
identification: this.options.identification,
|
|
13411
|
+
prompt: prompt,
|
|
13412
|
+
} /* <- Note: [🤛] */);
|
|
13428
13413
|
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
13429
13414
|
socket.on('prompt-response', function (response) {
|
|
13430
13415
|
resolve(response.promptResult);
|
|
@@ -13903,14 +13888,17 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
13903
13888
|
*/
|
|
13904
13889
|
var createAnthropicClaudeExecutionTools = Object.assign(function (options) {
|
|
13905
13890
|
if (options.isProxied) {
|
|
13906
|
-
return new RemoteLlmExecutionTools(__assign(__assign({}, options), {
|
|
13907
|
-
|
|
13908
|
-
|
|
13909
|
-
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
13891
|
+
return new RemoteLlmExecutionTools(__assign(__assign({}, options), { identification: {
|
|
13892
|
+
isAnonymous: true,
|
|
13893
|
+
llmToolsConfiguration: [
|
|
13894
|
+
{
|
|
13895
|
+
title: 'Anthropic Claude (proxied)',
|
|
13896
|
+
packageName: '@promptbook/anthropic-claude',
|
|
13897
|
+
className: 'AnthropicClaudeExecutionTools',
|
|
13898
|
+
options: __assign(__assign({}, options), { isProxied: false }),
|
|
13899
|
+
},
|
|
13900
|
+
],
|
|
13901
|
+
} }));
|
|
13914
13902
|
}
|
|
13915
13903
|
return new AnthropicClaudeExecutionTools(options);
|
|
13916
13904
|
}, {
|