@promptbook/remote-server 0.65.0-1 → 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.
Files changed (26) hide show
  1. package/esm/index.es.js +2464 -82
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/anthropic-claude.index.d.ts +6 -0
  4. package/esm/typings/src/_packages/core.index.d.ts +4 -0
  5. package/esm/typings/src/_packages/node.index.d.ts +0 -4
  6. package/esm/typings/src/_packages/remote-client.index.d.ts +2 -2
  7. package/esm/typings/src/_packages/types.index.d.ts +16 -2
  8. package/esm/typings/src/llm-providers/_common/config.d.ts +3 -3
  9. package/esm/typings/src/llm-providers/_common/createLlmToolsFromConfiguration.d.ts +2 -2
  10. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +5 -3
  11. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +23 -2
  12. package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts +13 -0
  13. package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +1 -1
  14. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +3 -2
  15. package/esm/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Error.d.ts +2 -2
  16. package/esm/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Progress.d.ts +2 -2
  17. package/esm/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Request.d.ts +14 -2
  18. package/esm/typings/src/llm-providers/remote/interfaces/RemoteLlmExecutionToolsOptions.d.ts +49 -0
  19. package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +23 -2
  20. package/esm/typings/src/llm-providers/remote/playground/playground.d.ts +2 -0
  21. package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +2 -1
  22. package/esm/typings/src/types/typeAliases.d.ts +6 -0
  23. package/package.json +6 -2
  24. package/umd/index.umd.js +2484 -85
  25. package/umd/index.umd.js.map +1 -1
  26. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +0 -26
@@ -6,6 +6,14 @@ import type { string_uri } from '../../../types/typeAliases';
6
6
  /**
7
7
  * @@@
8
8
  *
9
+ * There are two modes of remote server:
10
+ *
11
+ * 1) **Collection mode** Server will recieve `collection` and execute prompts only from this collection
12
+ * 2) **Anonymous mode** Server will recieve full `LlmToolsConfiguration` (with api keys) and just acts as a proxy
13
+ * In anonymous mode, `collection` will be ignored and any prompt will be executed
14
+ *
15
+ * You can enable both modes at the same time.
16
+ *
9
17
  * @public exported from `@promptbook/remote-client`
10
18
  * @public exported from `@promptbook/remote-server`
11
19
  */
@@ -21,10 +29,22 @@ export type RemoteServerOptions = CommonExecutionToolsOptions & {
21
29
  * @example '/promptbook/socket.io'
22
30
  */
23
31
  readonly path: string_uri;
32
+ } & (AnonymousRemoteServerOptions | CollectionRemoteServerOptions | (AnonymousRemoteServerOptions & CollectionRemoteServerOptions));
33
+ export type AnonymousRemoteServerOptions = {
34
+ /**
35
+ * Enable anonymous mode
36
+ */
37
+ readonly isAnonymousModeAllowed: true;
38
+ };
39
+ export type CollectionRemoteServerOptions = {
40
+ /**
41
+ * Enable collection mode
42
+ */
43
+ readonly isCollectionModeAllowed: true;
24
44
  /**
25
45
  * Promptbook collection to use
26
46
  *
27
- * This is used to check validity of the prompt to prevent DDoS
47
+ * This is used to check validity of the prompt to prevent misuse
28
48
  */
29
49
  readonly collection: PipelineCollection;
30
50
  /**
@@ -33,5 +53,6 @@ export type RemoteServerOptions = CommonExecutionToolsOptions & {
33
53
  createLlmExecutionTools(clientId: client_id): LlmExecutionTools;
34
54
  };
35
55
  /**
36
- * TODO: [🍜] Add anonymous option
56
+ * TODO: Constrain anonymous mode for specific models / providers
57
+ * TODO: [🧠][ðŸĪš] Remove `createLlmExecutionTools`, pass just `llmExecutionTools`
37
58
  */
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env ts-node
2
+ export {};
@@ -11,11 +11,12 @@ import type { RemoteServerOptions } from './interfaces/RemoteServerOptions';
11
11
  */
12
12
  export declare function startRemoteServer(options: RemoteServerOptions): IDestroyable;
13
13
  /**
14
- * TODO: [🍜] Add anonymous option
14
+ * TODO: [🍜] !!!!!! Add anonymous option
15
15
  * TODO: [⚖] Expose the collection to be able to connect to same collection via createCollectionFromUrl
16
16
  * TODO: Handle progress - support streaming
17
17
  * TODO: [ðŸ—Ŋ] Do not hang up immediately but wait until client closes OR timeout
18
18
  * TODO: [ðŸ—Ŋ] Timeout on chat to free up resources
19
19
  * TODO: [🃏] Pass here some security token to prevent malitious usage and/or DDoS
20
20
  * TODO: [0] Set unavailable models as undefined in `RemoteLlmExecutionTools` NOT throw error here
21
+ * TODO: Constrain anonymous mode for specific models / providers
21
22
  */
@@ -286,6 +286,12 @@ export type string_css_selector = string;
286
286
  * For example `"https://collboard.com/9SeSQTupmQHwuSrLi"`
287
287
  */
288
288
  export type string_url = string;
289
+ /**
290
+ * Semantic helper
291
+ *
292
+ * For example `"https://collboard.com"`
293
+ */
294
+ export type string_base_url = string;
289
295
  /**
290
296
  * Semantic helper
291
297
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/remote-server",
3
- "version": "0.65.0-1",
3
+ "version": "0.65.0-3",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -47,11 +47,15 @@
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.65.0-1"
50
+ "@promptbook/core": "0.65.0-3"
51
51
  },
52
52
  "dependencies": {
53
+ "@anthropic-ai/sdk": "0.21.1",
54
+ "@azure/openai": "1.0.0-beta.12",
53
55
  "colors": "1.4.0",
56
+ "openai": "4.46.1",
54
57
  "socket.io": "4.7.2",
58
+ "socket.io-client": "4.7.2",
55
59
  "spacetrim": "0.11.39"
56
60
  }
57
61
  }