@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/umd/index.umd.js
CHANGED
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
* @generated
|
|
52
52
|
* @see https://github.com/webgptorg/promptbook
|
|
53
53
|
*/
|
|
54
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
54
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.82.0-1';
|
|
55
55
|
/**
|
|
56
56
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
57
57
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -6785,7 +6785,7 @@
|
|
|
6785
6785
|
*/
|
|
6786
6786
|
|
|
6787
6787
|
/**
|
|
6788
|
-
* Prepare pipeline
|
|
6788
|
+
* Prepare pipeline locally
|
|
6789
6789
|
*
|
|
6790
6790
|
* @see https://github.com/webgptorg/promptbook/discussions/196
|
|
6791
6791
|
*
|
|
@@ -6911,7 +6911,7 @@
|
|
|
6911
6911
|
});
|
|
6912
6912
|
}
|
|
6913
6913
|
/**
|
|
6914
|
-
* TODO: Write tests for `preparePipeline`
|
|
6914
|
+
* TODO: Write tests for `preparePipeline` and `preparePipelineOnRemoteServer`
|
|
6915
6915
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
6916
6916
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
6917
6917
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
@@ -13268,6 +13268,39 @@
|
|
|
13268
13268
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
13269
13269
|
*/
|
|
13270
13270
|
|
|
13271
|
+
/**
|
|
13272
|
+
* Creates a connection to the remote proxy server.
|
|
13273
|
+
*
|
|
13274
|
+
* Note: This function creates a connection to the remote server and returns a socket but responsibility of closing the connection is on the caller
|
|
13275
|
+
*
|
|
13276
|
+
* @private internal utility function
|
|
13277
|
+
*/
|
|
13278
|
+
function createRemoteClient(options) {
|
|
13279
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
13280
|
+
var remoteUrl, path;
|
|
13281
|
+
return __generator(this, function (_a) {
|
|
13282
|
+
remoteUrl = options.remoteUrl, path = options.path;
|
|
13283
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
13284
|
+
var socket = socket_ioClient.io(remoteUrl, {
|
|
13285
|
+
retries: CONNECTION_RETRIES_LIMIT,
|
|
13286
|
+
timeout: CONNECTION_TIMEOUT_MS,
|
|
13287
|
+
path: path,
|
|
13288
|
+
// path: `${this.remoteUrl.pathname}/socket.io`,
|
|
13289
|
+
transports: [/*'websocket', <- TODO: [🌬] Make websocket transport work */ 'polling'],
|
|
13290
|
+
});
|
|
13291
|
+
// console.log('Connecting to', this.options.remoteUrl.href, { socket });
|
|
13292
|
+
socket.on('connect', function () {
|
|
13293
|
+
resolve(socket);
|
|
13294
|
+
});
|
|
13295
|
+
// TODO: [💩] Better timeout handling
|
|
13296
|
+
setTimeout(function () {
|
|
13297
|
+
reject(new Error("Timeout while connecting to ".concat(remoteUrl)));
|
|
13298
|
+
}, CONNECTION_TIMEOUT_MS);
|
|
13299
|
+
})];
|
|
13300
|
+
});
|
|
13301
|
+
});
|
|
13302
|
+
}
|
|
13303
|
+
|
|
13271
13304
|
/**
|
|
13272
13305
|
* Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
|
|
13273
13306
|
*
|
|
@@ -13305,7 +13338,7 @@
|
|
|
13305
13338
|
var socket;
|
|
13306
13339
|
return __generator(this, function (_a) {
|
|
13307
13340
|
switch (_a.label) {
|
|
13308
|
-
case 0: return [4 /*yield*/, this.
|
|
13341
|
+
case 0: return [4 /*yield*/, createRemoteClient(this.options)];
|
|
13309
13342
|
case 1:
|
|
13310
13343
|
socket = _a.sent();
|
|
13311
13344
|
socket.disconnect();
|
|
@@ -13322,24 +13355,12 @@
|
|
|
13322
13355
|
var socket, promptResult;
|
|
13323
13356
|
return __generator(this, function (_a) {
|
|
13324
13357
|
switch (_a.label) {
|
|
13325
|
-
case 0: return [4 /*yield*/, this.
|
|
13358
|
+
case 0: return [4 /*yield*/, createRemoteClient(this.options)];
|
|
13326
13359
|
case 1:
|
|
13327
13360
|
socket = _a.sent();
|
|
13328
|
-
|
|
13329
|
-
|
|
13330
|
-
|
|
13331
|
-
userId: this.options.userId,
|
|
13332
|
-
llmToolsConfiguration: this.options.llmToolsConfiguration,
|
|
13333
|
-
} /* <- Note: [🤛] */);
|
|
13334
|
-
}
|
|
13335
|
-
else {
|
|
13336
|
-
socket.emit('listModels-request', {
|
|
13337
|
-
isAnonymous: false,
|
|
13338
|
-
appId: this.options.appId,
|
|
13339
|
-
userId: this.options.userId,
|
|
13340
|
-
customOptions: this.options.customOptions,
|
|
13341
|
-
} /* <- Note: [🤛] */);
|
|
13342
|
-
}
|
|
13361
|
+
socket.emit('listModels-request', {
|
|
13362
|
+
identification: this.options.identification,
|
|
13363
|
+
} /* <- Note: [🤛] */);
|
|
13343
13364
|
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
13344
13365
|
socket.on('listModels-response', function (response) {
|
|
13345
13366
|
resolve(response.models);
|
|
@@ -13358,29 +13379,6 @@
|
|
|
13358
13379
|
});
|
|
13359
13380
|
});
|
|
13360
13381
|
};
|
|
13361
|
-
/**
|
|
13362
|
-
* Creates a connection to the remote proxy server.
|
|
13363
|
-
*/
|
|
13364
|
-
RemoteLlmExecutionTools.prototype.makeConnection = function () {
|
|
13365
|
-
var _this = this;
|
|
13366
|
-
return new Promise(function (resolve, reject) {
|
|
13367
|
-
var socket = socket_ioClient.io(_this.options.remoteUrl, {
|
|
13368
|
-
retries: CONNECTION_RETRIES_LIMIT,
|
|
13369
|
-
timeout: CONNECTION_TIMEOUT_MS,
|
|
13370
|
-
path: _this.options.path,
|
|
13371
|
-
// path: `${this.remoteUrl.pathname}/socket.io`,
|
|
13372
|
-
transports: [/*'websocket', <- TODO: [🌬] Make websocket transport work */ 'polling'],
|
|
13373
|
-
});
|
|
13374
|
-
// console.log('Connecting to', this.options.remoteUrl.href, { socket });
|
|
13375
|
-
socket.on('connect', function () {
|
|
13376
|
-
resolve(socket);
|
|
13377
|
-
});
|
|
13378
|
-
// TODO: [💩] Better timeout handling
|
|
13379
|
-
setTimeout(function () {
|
|
13380
|
-
reject(new Error("Timeout while connecting to ".concat(_this.options.remoteUrl)));
|
|
13381
|
-
}, CONNECTION_TIMEOUT_MS);
|
|
13382
|
-
});
|
|
13383
|
-
};
|
|
13384
13382
|
/**
|
|
13385
13383
|
* Calls remote proxy server to use a chat model
|
|
13386
13384
|
*/
|
|
@@ -13417,26 +13415,13 @@
|
|
|
13417
13415
|
var socket, promptResult;
|
|
13418
13416
|
return __generator(this, function (_a) {
|
|
13419
13417
|
switch (_a.label) {
|
|
13420
|
-
case 0: return [4 /*yield*/, this.
|
|
13418
|
+
case 0: return [4 /*yield*/, createRemoteClient(this.options)];
|
|
13421
13419
|
case 1:
|
|
13422
13420
|
socket = _a.sent();
|
|
13423
|
-
|
|
13424
|
-
|
|
13425
|
-
|
|
13426
|
-
|
|
13427
|
-
llmToolsConfiguration: this.options.llmToolsConfiguration,
|
|
13428
|
-
prompt: prompt,
|
|
13429
|
-
} /* <- Note: [🤛] */);
|
|
13430
|
-
}
|
|
13431
|
-
else {
|
|
13432
|
-
socket.emit('prompt-request', {
|
|
13433
|
-
isAnonymous: false,
|
|
13434
|
-
appId: this.options.appId,
|
|
13435
|
-
userId: this.options.userId,
|
|
13436
|
-
customOptions: this.options.customOptions,
|
|
13437
|
-
prompt: prompt,
|
|
13438
|
-
} /* <- Note: [🤛] */);
|
|
13439
|
-
}
|
|
13421
|
+
socket.emit('prompt-request', {
|
|
13422
|
+
identification: this.options.identification,
|
|
13423
|
+
prompt: prompt,
|
|
13424
|
+
} /* <- Note: [🤛] */);
|
|
13440
13425
|
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
13441
13426
|
socket.on('prompt-response', function (response) {
|
|
13442
13427
|
resolve(response.promptResult);
|
|
@@ -13915,14 +13900,17 @@
|
|
|
13915
13900
|
*/
|
|
13916
13901
|
var createAnthropicClaudeExecutionTools = Object.assign(function (options) {
|
|
13917
13902
|
if (options.isProxied) {
|
|
13918
|
-
return new RemoteLlmExecutionTools(__assign(__assign({}, options), {
|
|
13919
|
-
|
|
13920
|
-
|
|
13921
|
-
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
|
|
13925
|
-
|
|
13903
|
+
return new RemoteLlmExecutionTools(__assign(__assign({}, options), { identification: {
|
|
13904
|
+
isAnonymous: true,
|
|
13905
|
+
llmToolsConfiguration: [
|
|
13906
|
+
{
|
|
13907
|
+
title: 'Anthropic Claude (proxied)',
|
|
13908
|
+
packageName: '@promptbook/anthropic-claude',
|
|
13909
|
+
className: 'AnthropicClaudeExecutionTools',
|
|
13910
|
+
options: __assign(__assign({}, options), { isProxied: false }),
|
|
13911
|
+
},
|
|
13912
|
+
],
|
|
13913
|
+
} }));
|
|
13926
13914
|
}
|
|
13927
13915
|
return new AnthropicClaudeExecutionTools(options);
|
|
13928
13916
|
}, {
|