@promptbook/remote-server 0.65.0-7 → 0.66.0-0
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 +53 -23
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/utils.index.d.ts +10 -8
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +0 -1
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +0 -2
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts +3 -2
- package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/fakeTextToExpectations.d.ts +1 -0
- package/esm/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +2 -1
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +0 -1
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteLlmExecutionToolsOptions.d.ts +0 -3
- package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +0 -1
- package/esm/typings/src/utils/currentDate.d.ts +2 -0
- package/esm/typings/src/utils/deepFreeze.d.ts +2 -1
- package/esm/typings/src/utils/environment/getGlobalScope.d.ts +9 -0
- package/esm/typings/src/utils/environment/isRunningInBrowser.d.ts +8 -0
- package/esm/typings/src/utils/environment/isRunningInNode.d.ts +8 -0
- package/esm/typings/src/utils/environment/isRunningInWebWorker.d.ts +8 -0
- package/esm/typings/src/utils/files/isDirectoryExisting.d.ts +3 -1
- package/esm/typings/src/utils/files/isFileExisting.d.ts +3 -1
- package/esm/typings/src/utils/files/listAllFiles.d.ts +3 -1
- package/esm/typings/src/utils/random/randomSeed.d.ts +1 -0
- package/package.json +4 -4
- package/umd/index.umd.js +53 -23
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/utils/isRunningInWhatever.d.ts +0 -18
package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { AnthropicClaudeExecutionToolsOptions } from './AnthropicClaudeExec
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function createAnthropicClaudeExecutionTools(options: AnthropicClaudeExecutionToolsOptions): AnthropicClaudeExecutionTools | RemoteLlmExecutionTools;
|
|
10
10
|
/**
|
|
11
|
-
* TODO:
|
|
12
|
-
* TODO:
|
|
11
|
+
* TODO: [🧠] !!!! Make anonymous this with all LLM providers
|
|
12
|
+
* TODO: [🧠] !!!! Maybe change all `new AnthropicClaudeExecutionTools` -> `createAnthropicClaudeExecutionTools` in manual
|
|
13
|
+
* TODO: [🧠] Maybe auto-detect usage in browser and determine default value of `isProxied`
|
|
13
14
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env ts-node
|
|
2
2
|
export {};
|
|
3
3
|
/**
|
|
4
|
-
* TODO:
|
|
4
|
+
* TODO: !!! Playground with WebGPT / Promptbook.studio anonymous server
|
|
5
5
|
* TODO: !!! Test here that `systemMessage`, `temperature` and `seed` are working correctly
|
|
6
6
|
*/
|
|
@@ -3,6 +3,7 @@ import type { Expectations } from '../../types/PipelineJson/Expectations';
|
|
|
3
3
|
/**
|
|
4
4
|
* Gets the expectations and creates a fake text that meets the expectations
|
|
5
5
|
*
|
|
6
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
6
7
|
* Note: You can provide postprocessing functions to modify the text before checking the expectations
|
|
7
8
|
* The result will be the text BEFORE the postprocessing
|
|
8
9
|
*
|
|
@@ -18,4 +18,4 @@ import { MultipleLlmExecutionTools } from './MultipleLlmExecutionTools';
|
|
|
18
18
|
export declare function joinLlmExecutionTools(...llmExecutionTools: Array<LlmExecutionTools>): MultipleLlmExecutionTools;
|
|
19
19
|
/**
|
|
20
20
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
21
|
-
*/
|
|
21
|
+
*/
|
|
@@ -18,7 +18,8 @@ export declare const OPENAI_MODELS: Array<AvailableModel & {
|
|
|
18
18
|
/**
|
|
19
19
|
* Note: [🤖] Add models of new variant
|
|
20
20
|
* TODO: [🧠] Some mechanism to propagate unsureness
|
|
21
|
-
* TODO: [
|
|
21
|
+
* TODO: [🎰] Some mechanism to auto-update available models
|
|
22
|
+
* TODO: [🎰][👮♀️] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
|
|
22
23
|
* TODO: [🧠][👮♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
|
|
23
24
|
* @see https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4
|
|
24
25
|
* @see https://openai.com/api/pricing/
|
|
@@ -50,7 +50,6 @@ export declare class RemoteLlmExecutionTools implements LlmExecutionTools {
|
|
|
50
50
|
listModels(): Promise<Array<AvailableModel>>;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
* TODO: [🍜] !!!!!! Default remote remoteUrl and path for anonymous server
|
|
54
53
|
* TODO: [🍓] Allow to list compatible models with each variant
|
|
55
54
|
* TODO: [🗯] RemoteLlmExecutionTools should extend Destroyable and implement IDestroyable
|
|
56
55
|
* TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
|
|
@@ -11,7 +11,6 @@ import type { RemoteServerOptions } from './interfaces/RemoteServerOptions';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function startRemoteServer(options: RemoteServerOptions): IDestroyable;
|
|
13
13
|
/**
|
|
14
|
-
* TODO: [🍜] !!!!!! Add anonymous option
|
|
15
14
|
* TODO: [⚖] Expose the collection to be able to connect to same collection via createCollectionFromUrl
|
|
16
15
|
* TODO: Handle progress - support streaming
|
|
17
16
|
* TODO: [🗯] Do not hang up immediately but wait until client closes OR timeout
|
|
@@ -2,6 +2,8 @@ import type { string_date_iso8601 } from '../types/typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Simple wrapper `new Date().toISOString()`
|
|
4
4
|
*
|
|
5
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic because it depends on the current time
|
|
6
|
+
*
|
|
5
7
|
* @returns string_date branded type
|
|
6
8
|
* @public exported from `@promptbook/utils`
|
|
7
9
|
*/
|
|
@@ -2,12 +2,13 @@ import type { ReadonlyDeep } from 'type-fest';
|
|
|
2
2
|
/**
|
|
3
3
|
* @@@
|
|
4
4
|
*
|
|
5
|
+
* Note: `$` is used to indicate that this function is not a pure function - it mutates given object
|
|
5
6
|
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
6
7
|
*
|
|
7
8
|
* @returns The same object as the input, but deeply frozen
|
|
8
9
|
* @public exported from `@promptbook/utils`
|
|
9
10
|
*/
|
|
10
|
-
export declare function deepFreeze<TObject>(objectValue: TObject): ReadonlyDeep<TObject>;
|
|
11
|
+
export declare function $deepFreeze<TObject>(objectValue: TObject): ReadonlyDeep<TObject>;
|
|
11
12
|
/**
|
|
12
13
|
* @@@
|
|
13
14
|
* @@@
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { really_any } from '../organization/really_any';
|
|
2
|
+
/**
|
|
3
|
+
* @@@
|
|
4
|
+
*
|
|
5
|
+
* Note: `$` is used to indicate that this function is not a pure function - it access global
|
|
6
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/utils`
|
|
8
|
+
*/
|
|
9
|
+
export declare function $getGlobalScope(): really_any;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects if the code is running in a browser environment in main thread (Not in a web worker)
|
|
3
|
+
*
|
|
4
|
+
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/utils`
|
|
7
|
+
*/
|
|
8
|
+
export declare const $isRunningInBrowser: Function;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects if the code is running in a Node.js environment
|
|
3
|
+
*
|
|
4
|
+
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/utils`
|
|
7
|
+
*/
|
|
8
|
+
export declare const $isRunningInNode: Function;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects if the code is running in a web worker
|
|
3
|
+
*
|
|
4
|
+
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/utils`
|
|
7
|
+
*/
|
|
8
|
+
export declare const $isRunningInWebWorker: Function;
|
|
@@ -2,9 +2,11 @@ import type { string_folder_path } from '../../types/typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Checks if the directory exists
|
|
4
4
|
*
|
|
5
|
+
* Note: `$` is used to indicate that this function is not a pure function - it looks at the filesystem
|
|
6
|
+
*
|
|
5
7
|
* @private within the repository
|
|
6
8
|
*/
|
|
7
|
-
export declare function isDirectoryExisting(directoryPath: string_folder_path): Promise<boolean>;
|
|
9
|
+
export declare function $isDirectoryExisting(directoryPath: string_folder_path): Promise<boolean>;
|
|
8
10
|
/**
|
|
9
11
|
* Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
|
|
10
12
|
* TODO: [🐠] This can be a validator - with variants that return true/false and variants that throw errors with meaningless messages
|
|
@@ -2,9 +2,11 @@ import type { string_file_path } from '../../types/typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Checks if the file exists
|
|
4
4
|
*
|
|
5
|
+
* Note: `$` is used to indicate that this function is not a pure function - it looks at the filesystem
|
|
6
|
+
*
|
|
5
7
|
* @private within the repository
|
|
6
8
|
*/
|
|
7
|
-
export declare function isFileExisting(filePath: string_file_path): Promise<boolean>;
|
|
9
|
+
export declare function $isFileExisting(filePath: string_file_path): Promise<boolean>;
|
|
8
10
|
/**
|
|
9
11
|
* Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
|
|
10
12
|
* TODO: [🐠] This can be a validator - with variants that return true/false and variants that throw errors with meaningless messages
|
|
@@ -3,12 +3,14 @@ import type { string_folder_path } from '../../types/typeAliases';
|
|
|
3
3
|
/**
|
|
4
4
|
* Reads all files in the directory
|
|
5
5
|
*
|
|
6
|
+
* Note: `$` is used to indicate that this function is not a pure function - it looks at the filesystem
|
|
7
|
+
*
|
|
6
8
|
* @param path
|
|
7
9
|
* @param isRecursive
|
|
8
10
|
* @returns List of all files in the directory
|
|
9
11
|
* @private internal function of `createCollectionFromDirectory`
|
|
10
12
|
*/
|
|
11
|
-
export declare function listAllFiles(path: string_folder_path, isRecursive: boolean): Promise<Array<string_file_path>>;
|
|
13
|
+
export declare function $listAllFiles(path: string_folder_path, isRecursive: boolean): Promise<Array<string_file_path>>;
|
|
12
14
|
/**
|
|
13
15
|
* Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
|
|
14
16
|
* TODO: [🖇] What about symlinks?
|
|
@@ -2,6 +2,7 @@ import type { number_seed } from '../../types/typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Generates random seed
|
|
4
4
|
*
|
|
5
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
5
6
|
* Warning: This function is not cryptographically secure (it uses Math.random internally)
|
|
6
7
|
* @public exported from `@promptbook/utils`
|
|
7
8
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.66.0-0",
|
|
4
4
|
"description": "Supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"module": "./esm/index.es.js",
|
|
48
48
|
"typings": "./esm/typings/src/_packages/remote-server.index.d.ts",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@promptbook/core": "0.
|
|
50
|
+
"@promptbook/core": "0.66.0-0"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@anthropic-ai/sdk": "0.
|
|
53
|
+
"@anthropic-ai/sdk": "0.26.1",
|
|
54
54
|
"@azure/openai": "1.0.0-beta.12",
|
|
55
55
|
"colors": "1.4.0",
|
|
56
|
-
"openai": "4.
|
|
56
|
+
"openai": "4.55.9",
|
|
57
57
|
"socket.io": "4.7.2",
|
|
58
58
|
"socket.io-client": "4.7.2",
|
|
59
59
|
"spacetrim": "0.11.39"
|
package/umd/index.umd.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
/**
|
|
17
17
|
* The version of the Promptbook library
|
|
18
18
|
*/
|
|
19
|
-
var PROMPTBOOK_VERSION = '0.65.0
|
|
19
|
+
var PROMPTBOOK_VERSION = '0.65.0';
|
|
20
20
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
21
21
|
|
|
22
22
|
/*! *****************************************************************************
|
|
@@ -457,7 +457,9 @@
|
|
|
457
457
|
*/
|
|
458
458
|
RemoteLlmExecutionTools.prototype.makeConnection = function () {
|
|
459
459
|
var _this = this;
|
|
460
|
-
return new Promise(
|
|
460
|
+
return new Promise(
|
|
461
|
+
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
462
|
+
function (resolve, reject) {
|
|
461
463
|
var socket = socket_ioClient.io(_this.options.remoteUrl, {
|
|
462
464
|
path: _this.options.path,
|
|
463
465
|
// path: `${this.remoteUrl.pathname}/socket.io`,
|
|
@@ -560,7 +562,6 @@
|
|
|
560
562
|
return RemoteLlmExecutionTools;
|
|
561
563
|
}());
|
|
562
564
|
/**
|
|
563
|
-
* TODO: [🍜] !!!!!! Default remote remoteUrl and path for anonymous server
|
|
564
565
|
* TODO: [🍓] Allow to list compatible models with each variant
|
|
565
566
|
* TODO: [🗯] RemoteLlmExecutionTools should extend Destroyable and implement IDestroyable
|
|
566
567
|
* TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
|
|
@@ -580,12 +581,21 @@
|
|
|
580
581
|
/**
|
|
581
582
|
* List of available Anthropic Claude models with pricing
|
|
582
583
|
*
|
|
583
|
-
* Note: Done at 2024-
|
|
584
|
+
* Note: Done at 2024-08-16
|
|
584
585
|
*
|
|
585
586
|
* @see https://docs.anthropic.com/en/docs/models-overview
|
|
586
587
|
* @public exported from `@promptbook/anthropic-claude`
|
|
587
588
|
*/
|
|
588
589
|
var ANTHROPIC_CLAUDE_MODELS = [
|
|
590
|
+
{
|
|
591
|
+
modelVariant: 'CHAT',
|
|
592
|
+
modelTitle: 'Claude 3.5 Sonnet',
|
|
593
|
+
modelName: 'claude-3-5-sonnet-20240620',
|
|
594
|
+
pricing: {
|
|
595
|
+
prompt: computeUsage("$3.00 / 1M tokens"),
|
|
596
|
+
output: computeUsage("$15.00 / 1M tokens"),
|
|
597
|
+
},
|
|
598
|
+
},
|
|
589
599
|
{
|
|
590
600
|
modelVariant: 'CHAT',
|
|
591
601
|
modelTitle: 'Claude 3 Opus',
|
|
@@ -647,7 +657,7 @@
|
|
|
647
657
|
* TODO: [🧠] !!! Add embedding models OR Anthropic has only chat+completion models?
|
|
648
658
|
* TODO: [🧠] Some mechanism to propagate unsureness
|
|
649
659
|
* TODO: [🧠][👮♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
|
|
650
|
-
* TODO: [
|
|
660
|
+
* TODO: [🎰] Some mechanism to auto-update available models
|
|
651
661
|
*/
|
|
652
662
|
|
|
653
663
|
/**
|
|
@@ -1032,12 +1042,13 @@
|
|
|
1032
1042
|
/**
|
|
1033
1043
|
* @@@
|
|
1034
1044
|
*
|
|
1045
|
+
* Note: `$` is used to indicate that this function is not a pure function - it mutates given object
|
|
1035
1046
|
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
1036
1047
|
*
|
|
1037
1048
|
* @returns The same object as the input, but deeply frozen
|
|
1038
1049
|
* @public exported from `@promptbook/utils`
|
|
1039
1050
|
*/
|
|
1040
|
-
function deepFreeze(objectValue) {
|
|
1051
|
+
function $deepFreeze(objectValue) {
|
|
1041
1052
|
var e_1, _a;
|
|
1042
1053
|
var propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1043
1054
|
try {
|
|
@@ -1045,7 +1056,7 @@
|
|
|
1045
1056
|
var propertyName = propertyNames_1_1.value;
|
|
1046
1057
|
var value = objectValue[propertyName];
|
|
1047
1058
|
if (value && typeof value === 'object') {
|
|
1048
|
-
deepFreeze(value);
|
|
1059
|
+
$deepFreeze(value);
|
|
1049
1060
|
}
|
|
1050
1061
|
}
|
|
1051
1062
|
}
|
|
@@ -1080,7 +1091,7 @@
|
|
|
1080
1091
|
*
|
|
1081
1092
|
* @public exported from `@promptbook/core`
|
|
1082
1093
|
*/
|
|
1083
|
-
deepFreeze([
|
|
1094
|
+
$deepFreeze([
|
|
1084
1095
|
'content',
|
|
1085
1096
|
'context',
|
|
1086
1097
|
'knowledge',
|
|
@@ -1217,7 +1228,9 @@
|
|
|
1217
1228
|
var anthropicOptions = __assign({}, options);
|
|
1218
1229
|
delete anthropicOptions.isVerbose;
|
|
1219
1230
|
delete anthropicOptions.isProxied;
|
|
1220
|
-
this.client = new Anthropic__default["default"](
|
|
1231
|
+
this.client = new Anthropic__default["default"](
|
|
1232
|
+
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
1233
|
+
anthropicOptions);
|
|
1221
1234
|
}
|
|
1222
1235
|
Object.defineProperty(AnthropicClaudeExecutionTools.prototype, "title", {
|
|
1223
1236
|
get: function () {
|
|
@@ -1238,7 +1251,7 @@
|
|
|
1238
1251
|
*/
|
|
1239
1252
|
AnthropicClaudeExecutionTools.prototype.callChatModel = function (prompt) {
|
|
1240
1253
|
return __awaiter(this, void 0, void 0, function () {
|
|
1241
|
-
var content, parameters, modelRequirements, modelName, rawPromptContent, rawRequest, start, complete, rawResponse, resultContent, usage;
|
|
1254
|
+
var content, parameters, modelRequirements, modelName, rawPromptContent, rawRequest, start, complete, rawResponse, contentBlock, resultContent, usage;
|
|
1242
1255
|
return __generator(this, function (_a) {
|
|
1243
1256
|
switch (_a.label) {
|
|
1244
1257
|
case 0:
|
|
@@ -1284,11 +1297,16 @@
|
|
|
1284
1297
|
if (rawResponse.content.length > 1) {
|
|
1285
1298
|
throw new PipelineExecutionError('More than one content blocks from Anthropic Claude');
|
|
1286
1299
|
}
|
|
1287
|
-
|
|
1300
|
+
contentBlock = rawResponse.content[0];
|
|
1301
|
+
if (contentBlock.type !== 'text') {
|
|
1302
|
+
throw new PipelineExecutionError("Returned content is not \"text\" type but \"".concat(contentBlock.type, "\""));
|
|
1303
|
+
}
|
|
1304
|
+
console.log('!!!!!! rawResponse.usage', rawResponse.usage);
|
|
1305
|
+
resultContent = contentBlock.text;
|
|
1288
1306
|
// eslint-disable-next-line prefer-const
|
|
1289
1307
|
complete = getCurrentIsoDate();
|
|
1290
1308
|
usage = {
|
|
1291
|
-
price: { value: 0, isUncertain: true } /* <- TODO: [🐞] Compute usage */,
|
|
1309
|
+
price: { value: 0, isUncertain: true } /* <- TODO: [🐞] !!!!!! Compute usage */,
|
|
1292
1310
|
input: __assign({ tokensCount: uncertainNumber(rawResponse.usage.input_tokens) }, computeUsageCounts(prompt.content)),
|
|
1293
1311
|
output: __assign({ tokensCount: uncertainNumber(rawResponse.usage.output_tokens) }, computeUsageCounts(prompt.content)),
|
|
1294
1312
|
};
|
|
@@ -1419,7 +1437,6 @@
|
|
|
1419
1437
|
* TODO: Maybe Create some common util for callChatModel and callCompletionModel
|
|
1420
1438
|
* TODO: Maybe make custom OpenaiError
|
|
1421
1439
|
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
1422
|
-
* TODO: [🍜] !!!!!! Auto use anonymous server in browser
|
|
1423
1440
|
* TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
|
|
1424
1441
|
* TODO: [📅] Maybe instead of `RemoteLlmExecutionToolsOptions` use `proxyWithAnonymousRemoteServer` (if implemented)
|
|
1425
1442
|
*/
|
|
@@ -1440,11 +1457,14 @@
|
|
|
1440
1457
|
},
|
|
1441
1458
|
], models: ANTHROPIC_CLAUDE_MODELS }));
|
|
1442
1459
|
}
|
|
1443
|
-
return new AnthropicClaudeExecutionTools(
|
|
1460
|
+
return new AnthropicClaudeExecutionTools(
|
|
1461
|
+
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
1462
|
+
options);
|
|
1444
1463
|
}
|
|
1445
1464
|
/**
|
|
1446
|
-
* TODO:
|
|
1447
|
-
* TODO:
|
|
1465
|
+
* TODO: [🧠] !!!! Make anonymous this with all LLM providers
|
|
1466
|
+
* TODO: [🧠] !!!! Maybe change all `new AnthropicClaudeExecutionTools` -> `createAnthropicClaudeExecutionTools` in manual
|
|
1467
|
+
* TODO: [🧠] Maybe auto-detect usage in browser and determine default value of `isProxied`
|
|
1448
1468
|
*/
|
|
1449
1469
|
|
|
1450
1470
|
/**
|
|
@@ -1788,7 +1808,8 @@
|
|
|
1788
1808
|
/**
|
|
1789
1809
|
* Note: [🤖] Add models of new variant
|
|
1790
1810
|
* TODO: [🧠] Some mechanism to propagate unsureness
|
|
1791
|
-
* TODO: [
|
|
1811
|
+
* TODO: [🎰] Some mechanism to auto-update available models
|
|
1812
|
+
* TODO: [🎰][👮♀️] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
|
|
1792
1813
|
* TODO: [🧠][👮♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
|
|
1793
1814
|
* @see https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4
|
|
1794
1815
|
* @see https://openai.com/api/pricing/
|
|
@@ -1811,7 +1832,11 @@
|
|
|
1811
1832
|
*/
|
|
1812
1833
|
function AzureOpenAiExecutionTools(options) {
|
|
1813
1834
|
this.options = options;
|
|
1814
|
-
this.client = new openai.OpenAIClient(
|
|
1835
|
+
this.client = new openai.OpenAIClient(
|
|
1836
|
+
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
1837
|
+
"https://".concat(options.resourceName, ".openai.azure.com/"), new openai.AzureKeyCredential(
|
|
1838
|
+
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
1839
|
+
options.apiKey));
|
|
1815
1840
|
}
|
|
1816
1841
|
Object.defineProperty(AzureOpenAiExecutionTools.prototype, "title", {
|
|
1817
1842
|
get: function () {
|
|
@@ -2394,7 +2419,11 @@
|
|
|
2394
2419
|
return new OpenAiExecutionTools(__assign(__assign({}, options), { dangerouslyAllowBrowser: true /* <- TODO: [🧠] !!! Some mechanism for auto-detection of browser, maybe hide in `OpenAiExecutionTools` */ }));
|
|
2395
2420
|
},
|
|
2396
2421
|
createAnthropicClaudeExecutionTools: createAnthropicClaudeExecutionTools,
|
|
2397
|
-
createAzureOpenAiExecutionTools: function (options) {
|
|
2422
|
+
createAzureOpenAiExecutionTools: function (options) {
|
|
2423
|
+
return new AzureOpenAiExecutionTools(
|
|
2424
|
+
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
2425
|
+
options);
|
|
2426
|
+
},
|
|
2398
2427
|
// <- Note: [🦑] Add here new LLM provider
|
|
2399
2428
|
};
|
|
2400
2429
|
/**
|
|
@@ -2483,7 +2512,9 @@
|
|
|
2483
2512
|
}
|
|
2484
2513
|
});
|
|
2485
2514
|
}); });
|
|
2486
|
-
var server = new socket_io.Server(
|
|
2515
|
+
var server = new socket_io.Server(
|
|
2516
|
+
// <- TODO: [🧱] Implement in a functional (not new Class) way
|
|
2517
|
+
httpServer, {
|
|
2487
2518
|
path: path,
|
|
2488
2519
|
transports: [/*'websocket', <- TODO: [🌬] Make websocket transport work */ 'polling'],
|
|
2489
2520
|
cors: {
|
|
@@ -2507,10 +2538,10 @@
|
|
|
2507
2538
|
case 1:
|
|
2508
2539
|
_c.trys.push([1, 14, 15, 16]);
|
|
2509
2540
|
if (llmToolsConfiguration !== null && !isAnonymousModeAllowed) {
|
|
2510
|
-
throw new PipelineExecutionError("Anonymous mode is not allowed"); // <- TODO:
|
|
2541
|
+
throw new PipelineExecutionError("Anonymous mode is not allowed"); // <- TODO: !!! Test
|
|
2511
2542
|
}
|
|
2512
2543
|
if (clientId !== null && !isCollectionModeAllowed) {
|
|
2513
|
-
throw new PipelineExecutionError("Collection mode is not allowed"); // <- TODO:
|
|
2544
|
+
throw new PipelineExecutionError("Collection mode is not allowed"); // <- TODO: !!! Test
|
|
2514
2545
|
}
|
|
2515
2546
|
llmExecutionTools = void 0;
|
|
2516
2547
|
if (!(llmToolsConfiguration !== null)) return [3 /*break*/, 2];
|
|
@@ -2615,7 +2646,6 @@
|
|
|
2615
2646
|
};
|
|
2616
2647
|
}
|
|
2617
2648
|
/**
|
|
2618
|
-
* TODO: [🍜] !!!!!! Add anonymous option
|
|
2619
2649
|
* TODO: [⚖] Expose the collection to be able to connect to same collection via createCollectionFromUrl
|
|
2620
2650
|
* TODO: Handle progress - support streaming
|
|
2621
2651
|
* TODO: [🗯] Do not hang up immediately but wait until client closes OR timeout
|