@promptbook/browser 0.66.0-8 → 0.66.0-9

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 (44) hide show
  1. package/esm/index.es.js +1 -1
  2. package/esm/typings/src/_packages/anthropic-claude.index.d.ts +0 -2
  3. package/esm/typings/src/_packages/cli.index.d.ts +6 -0
  4. package/esm/typings/src/_packages/types.index.d.ts +22 -14
  5. package/esm/typings/src/_packages/utils.index.d.ts +7 -7
  6. package/esm/typings/src/execution/LlmExecutionToolsConstructor.d.ts +1 -1
  7. package/esm/typings/src/llm-providers/_common/$llmToolsMetadataRegister.d.ts +2 -2
  8. package/esm/typings/src/llm-providers/_common/$llmToolsRegister.d.ts +2 -2
  9. package/esm/typings/src/llm-providers/_common/$registeredLlmToolsMessage.d.ts +9 -0
  10. package/esm/typings/src/llm-providers/_common/LlmToolsConfiguration.d.ts +1 -1
  11. package/esm/typings/src/llm-providers/_common/LlmToolsMetadata.d.ts +1 -1
  12. package/esm/typings/src/llm-providers/_common/createLlmToolsFromConfigurationFromEnv.d.ts +1 -0
  13. package/esm/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
  14. package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +1 -0
  15. package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -0
  16. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +1 -0
  17. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -0
  18. package/esm/typings/src/llm-providers/remote/interfaces/{Promptbook_Server_Error.d.ts → PromptbookServer_Error.d.ts} +1 -1
  19. package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Request.d.ts +34 -0
  20. package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Response.d.ts +15 -0
  21. package/esm/typings/src/llm-providers/remote/interfaces/{Promptbook_Server_Progress.d.ts → PromptbookServer_Prompt_Progress.d.ts} +1 -1
  22. package/esm/typings/src/llm-providers/remote/interfaces/{Promptbook_Server_Request.d.ts → PromptbookServer_Prompt_Request.d.ts} +15 -3
  23. package/esm/typings/src/llm-providers/remote/interfaces/{Promptbook_Server_Response.d.ts → PromptbookServer_Prompt_Response.d.ts} +1 -1
  24. package/esm/typings/src/llm-providers/remote/interfaces/RemoteLlmExecutionToolsOptions.d.ts +1 -7
  25. package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -0
  26. package/esm/typings/src/utils/{Register.d.ts → $Register.d.ts} +6 -2
  27. package/esm/typings/src/utils/environment/{getGlobalScope.d.ts → $getGlobalScope.d.ts} +1 -1
  28. package/esm/typings/src/utils/organization/f.d.ts +6 -0
  29. package/package.json +2 -2
  30. package/umd/index.umd.js +1 -1
  31. package/esm/typings/src/llm-providers/_common/config.d.ts +0 -14
  32. package/esm/typings/src/llm-providers/anthropic-claude/register1.d.ts +0 -4
  33. /package/esm/typings/src/llm-providers/mocked/{fakeTextToExpectations.d.ts → $fakeTextToExpectations.d.ts} +0 -0
  34. /package/esm/typings/src/utils/{currentDate.d.ts → $currentDate.d.ts} +0 -0
  35. /package/esm/typings/src/utils/environment/{isRunningInBrowser.d.ts → $isRunningInBrowser.d.ts} +0 -0
  36. /package/esm/typings/src/utils/environment/{isRunningInNode.d.ts → $isRunningInNode.d.ts} +0 -0
  37. /package/esm/typings/src/utils/environment/{isRunningInWebWorker.d.ts → $isRunningInWebWorker.d.ts} +0 -0
  38. /package/esm/typings/src/utils/files/{isDirectoryExisting.d.ts → $isDirectoryExisting.d.ts} +0 -0
  39. /package/esm/typings/src/utils/files/{isDirectoryExisting.test.d.ts → $isDirectoryExisting.test.d.ts} +0 -0
  40. /package/esm/typings/src/utils/files/{isFileExisting.d.ts → $isFileExisting.d.ts} +0 -0
  41. /package/esm/typings/src/utils/files/{isFileExisting.test.d.ts → $isFileExisting.test.d.ts} +0 -0
  42. /package/esm/typings/src/utils/files/{listAllFiles.d.ts → $listAllFiles.d.ts} +0 -0
  43. /package/esm/typings/src/utils/files/{listAllFiles.test.d.ts → $listAllFiles.test.d.ts} +0 -0
  44. /package/esm/typings/src/utils/random/{randomSeed.d.ts → $randomSeed.d.ts} +0 -0
package/esm/index.es.js CHANGED
@@ -5,7 +5,7 @@ import { isRunningInBrowser } from 'openai/core';
5
5
  /**
6
6
  * The version of the Promptbook library
7
7
  */
8
- var PROMPTBOOK_VERSION = '0.66.0-7';
8
+ var PROMPTBOOK_VERSION = '0.66.0-8';
9
9
  // TODO: !!!! List here all the versions and annotate + put into script
10
10
 
11
11
  /*! *****************************************************************************
@@ -6,7 +6,6 @@ import type { AnthropicClaudeExecutionToolsDirectOptions } from '../llm-provider
6
6
  import type { AnthropicClaudeExecutionToolsProxiedOptions } from '../llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions';
7
7
  import { createAnthropicClaudeExecutionTools } from '../llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools';
8
8
  import { _AnthropicClaudeRegistration } from '../llm-providers/anthropic-claude/register-constructor';
9
- import { _ } from '../llm-providers/anthropic-claude/register1';
10
9
  export { PROMPTBOOK_VERSION };
11
10
  export { ANTHROPIC_CLAUDE_MODELS };
12
11
  export { AnthropicClaudeExecutionTools };
@@ -15,4 +14,3 @@ export type { AnthropicClaudeExecutionToolsDirectOptions };
15
14
  export type { AnthropicClaudeExecutionToolsProxiedOptions };
16
15
  export { createAnthropicClaudeExecutionTools };
17
16
  export { _AnthropicClaudeRegistration };
18
- export { _ };
@@ -1,10 +1,16 @@
1
1
  import { PROMPTBOOK_VERSION } from '../version';
2
2
  import { _CLI } from '../cli/main';
3
3
  import { _AnthropicClaudeMetadataRegistration } from '../llm-providers/anthropic-claude/register-configuration';
4
+ import { _AnthropicClaudeRegistration } from '../llm-providers/anthropic-claude/register-constructor';
4
5
  import { _AzureOpenAiMetadataRegistration } from '../llm-providers/azure-openai/register-configuration';
6
+ import { _AzureOpenAiRegistration } from '../llm-providers/azure-openai/register-constructor';
5
7
  import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
8
+ import { _OpenAiRegistration } from '../llm-providers/openai/register-constructor';
6
9
  export { PROMPTBOOK_VERSION };
7
10
  export { _CLI };
8
11
  export { _AnthropicClaudeMetadataRegistration };
12
+ export { _AnthropicClaudeRegistration };
9
13
  export { _AzureOpenAiMetadataRegistration };
14
+ export { _AzureOpenAiRegistration };
10
15
  export { _OpenAiMetadataRegistration };
16
+ export { _OpenAiRegistration };
@@ -44,12 +44,16 @@ import type { AzureOpenAiExecutionToolsOptions } from '../llm-providers/azure-op
44
44
  import type { LangtailExecutionToolsOptions } from '../llm-providers/langtail/LangtailExecutionToolsOptions';
45
45
  import type { MultipleLlmExecutionTools } from '../llm-providers/multiple/MultipleLlmExecutionTools';
46
46
  import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions';
47
- import type { Promptbook_Server_Error } from '../llm-providers/remote/interfaces/Promptbook_Server_Error';
48
- import type { Promptbook_Server_Progress } from '../llm-providers/remote/interfaces/Promptbook_Server_Progress';
49
- import type { Promptbook_Server_Request } from '../llm-providers/remote/interfaces/Promptbook_Server_Request';
50
- import type { Promptbook_Server_CollectionRequest } from '../llm-providers/remote/interfaces/Promptbook_Server_Request';
51
- import type { Promptbook_Server_AnonymousRequest } from '../llm-providers/remote/interfaces/Promptbook_Server_Request';
52
- import type { Promptbook_Server_Response } from '../llm-providers/remote/interfaces/Promptbook_Server_Response';
47
+ import type { PromptbookServer_Error } from '../llm-providers/remote/interfaces/PromptbookServer_Error';
48
+ import type { PromptbookServer_ListModels_Request } from '../llm-providers/remote/interfaces/PromptbookServer_ListModels_Request';
49
+ import type { PromptbookServer_ListModels_CollectionRequest } from '../llm-providers/remote/interfaces/PromptbookServer_ListModels_Request';
50
+ import type { PromptbookServer_ListModels_AnonymousRequest } from '../llm-providers/remote/interfaces/PromptbookServer_ListModels_Request';
51
+ import type { PromptbookServer_ListModels_Response } from '../llm-providers/remote/interfaces/PromptbookServer_ListModels_Response';
52
+ import type { PromptbookServer_Prompt_Progress } from '../llm-providers/remote/interfaces/PromptbookServer_Prompt_Progress';
53
+ import type { PromptbookServer_Prompt_Request } from '../llm-providers/remote/interfaces/PromptbookServer_Prompt_Request';
54
+ import type { PromptbookServer_Prompt_CollectionRequest } from '../llm-providers/remote/interfaces/PromptbookServer_Prompt_Request';
55
+ import type { PromptbookServer_Prompt_AnonymousRequest } from '../llm-providers/remote/interfaces/PromptbookServer_Prompt_Request';
56
+ import type { PromptbookServer_Prompt_Response } from '../llm-providers/remote/interfaces/PromptbookServer_Prompt_Response';
53
57
  import type { RemoteLlmExecutionToolsOptions } from '../llm-providers/remote/interfaces/RemoteLlmExecutionToolsOptions';
54
58
  import type { RemoteServerOptions } from '../llm-providers/remote/interfaces/RemoteServerOptions';
55
59
  import type { AnonymousRemoteServerOptions } from '../llm-providers/remote/interfaces/RemoteServerOptions';
@@ -203,6 +207,7 @@ import type { number_kilobytes } from '../types/typeAliases';
203
207
  import type { number_megabytes } from '../types/typeAliases';
204
208
  import type { number_gigabytes } from '../types/typeAliases';
205
209
  import type { number_terabytes } from '../types/typeAliases';
210
+ import type { Registered } from '../utils/$Register';
206
211
  import type { FromtoItems } from '../utils/FromtoItems';
207
212
  import type { CodeBlock } from '../utils/markdown/extractAllBlocksFromMarkdown';
208
213
  import type { MarkdownSection } from '../utils/markdown/parseMarkdownSection';
@@ -215,7 +220,6 @@ import type { string_SCREAMING_CASE } from '../utils/normalization/normalizeTo_S
215
220
  import type { string_snake_case } from '../utils/normalization/normalizeTo_snake_case';
216
221
  import type { really_any } from '../utils/organization/really_any';
217
222
  import type { TODO_any } from '../utils/organization/TODO_any';
218
- import type { Registered } from '../utils/Register';
219
223
  import type { string_promptbook_version } from '../version';
220
224
  export type { PipelineCollection };
221
225
  export type { Command };
@@ -263,12 +267,16 @@ export type { AzureOpenAiExecutionToolsOptions };
263
267
  export type { LangtailExecutionToolsOptions };
264
268
  export type { MultipleLlmExecutionTools };
265
269
  export type { OpenAiExecutionToolsOptions };
266
- export type { Promptbook_Server_Error };
267
- export type { Promptbook_Server_Progress };
268
- export type { Promptbook_Server_Request };
269
- export type { Promptbook_Server_CollectionRequest };
270
- export type { Promptbook_Server_AnonymousRequest };
271
- export type { Promptbook_Server_Response };
270
+ export type { PromptbookServer_Error };
271
+ export type { PromptbookServer_ListModels_Request };
272
+ export type { PromptbookServer_ListModels_CollectionRequest };
273
+ export type { PromptbookServer_ListModels_AnonymousRequest };
274
+ export type { PromptbookServer_ListModels_Response };
275
+ export type { PromptbookServer_Prompt_Progress };
276
+ export type { PromptbookServer_Prompt_Request };
277
+ export type { PromptbookServer_Prompt_CollectionRequest };
278
+ export type { PromptbookServer_Prompt_AnonymousRequest };
279
+ export type { PromptbookServer_Prompt_Response };
272
280
  export type { RemoteLlmExecutionToolsOptions };
273
281
  export type { RemoteServerOptions };
274
282
  export type { AnonymousRemoteServerOptions };
@@ -422,6 +430,7 @@ export type { number_kilobytes };
422
430
  export type { number_megabytes };
423
431
  export type { number_gigabytes };
424
432
  export type { number_terabytes };
433
+ export type { Registered };
425
434
  export type { FromtoItems };
426
435
  export type { CodeBlock };
427
436
  export type { MarkdownSection };
@@ -434,5 +443,4 @@ export type { string_SCREAMING_CASE };
434
443
  export type { string_snake_case };
435
444
  export type { really_any };
436
445
  export type { TODO_any };
437
- export type { Registered };
438
446
  export type { string_promptbook_version };
@@ -7,14 +7,14 @@ import { titleToName } from '../conversion/utils/titleToName';
7
7
  import { forEachAsync } from '../execution/utils/forEachAsync';
8
8
  import { isValidJsonString } from '../formats/json/utils/isValidJsonString';
9
9
  import { extractBlock } from '../postprocessing/utils/extractBlock';
10
+ import { $currentDate } from '../utils/$currentDate';
10
11
  import { clonePipeline } from '../utils/clonePipeline';
11
- import { $currentDate } from '../utils/currentDate';
12
12
  import { deepClone } from '../utils/deepClone';
13
13
  import { $deepFreeze } from '../utils/deepFreeze';
14
- import { $getGlobalScope } from '../utils/environment/getGlobalScope';
15
- import { $isRunningInBrowser } from '../utils/environment/isRunningInBrowser';
16
- import { $isRunningInNode } from '../utils/environment/isRunningInNode';
17
- import { $isRunningInWebWorker } from '../utils/environment/isRunningInWebWorker';
14
+ import { $getGlobalScope } from '../utils/environment/$getGlobalScope';
15
+ import { $isRunningInBrowser } from '../utils/environment/$isRunningInBrowser';
16
+ import { $isRunningInNode } from '../utils/environment/$isRunningInNode';
17
+ import { $isRunningInWebWorker } from '../utils/environment/$isRunningInWebWorker';
18
18
  import { countCharacters } from '../utils/expectation-counters/countCharacters';
19
19
  import { countLines } from '../utils/expectation-counters/countLines';
20
20
  import { countPages } from '../utils/expectation-counters/countPages';
@@ -47,7 +47,7 @@ import { parseKeywordsFromString } from '../utils/normalization/parseKeywordsFro
47
47
  import { removeDiacritics } from '../utils/normalization/removeDiacritics';
48
48
  import { searchKeywords } from '../utils/normalization/searchKeywords';
49
49
  import { parseNumber } from '../utils/parseNumber';
50
- import { $randomSeed } from '../utils/random/randomSeed';
50
+ import { $randomSeed } from '../utils/random/$randomSeed';
51
51
  import { removeEmojis } from '../utils/removeEmojis';
52
52
  import { removeQuotes } from '../utils/removeQuotes';
53
53
  import { replaceParameters } from '../utils/replaceParameters';
@@ -76,8 +76,8 @@ export { titleToName };
76
76
  export { forEachAsync };
77
77
  export { isValidJsonString };
78
78
  export { extractBlock };
79
- export { clonePipeline };
80
79
  export { $currentDate };
80
+ export { clonePipeline };
81
81
  export { deepClone };
82
82
  export { $deepFreeze };
83
83
  export { $getGlobalScope };
@@ -1,5 +1,5 @@
1
+ import type { Registered } from '../utils/$Register';
1
2
  import type { TODO_any } from '../utils/organization/TODO_any';
2
- import type { Registered } from '../utils/Register';
3
3
  import type { LlmExecutionTools } from './LlmExecutionTools';
4
4
  /**
5
5
  * @@@
@@ -1,4 +1,4 @@
1
- import { Register } from '../../utils/Register';
1
+ import { $Register } from '../../utils/$Register';
2
2
  import type { LlmToolsMetadata } from './LlmToolsMetadata';
3
3
  /**
4
4
  * @@@
@@ -7,4 +7,4 @@ import type { LlmToolsMetadata } from './LlmToolsMetadata';
7
7
  * @singleton Only one instance of each register is created per build, but thare can be more @@@
8
8
  * @public exported from `@promptbook/core`
9
9
  */
10
- export declare const $llmToolsMetadataRegister: Register<LlmToolsMetadata>;
10
+ export declare const $llmToolsMetadataRegister: $Register<LlmToolsMetadata>;
@@ -1,5 +1,5 @@
1
1
  import type { LlmExecutionToolsConstructor } from '../../execution/LlmExecutionToolsConstructor';
2
- import { Register } from '../../utils/Register';
2
+ import { $Register } from '../../utils/$Register';
3
3
  /**
4
4
  * @@@
5
5
  *
@@ -7,4 +7,4 @@ import { Register } from '../../utils/Register';
7
7
  * @singleton Only one instance of each register is created per build, but thare can be more @@@
8
8
  * @public exported from `@promptbook/core`
9
9
  */
10
- export declare const $llmToolsRegister: Register<LlmExecutionToolsConstructor>;
10
+ export declare const $llmToolsRegister: $Register<LlmExecutionToolsConstructor>;
@@ -0,0 +1,9 @@
1
+ import type { string_markdown } from '../../types/typeAliases';
2
+ /**
3
+ * Creates a message with all registered LLM tools
4
+ *
5
+ * Note: This function is used to create a (error) message when there is no constructor for some LLM provider
6
+ *
7
+ * @private internal function of `createLlmToolsFromConfiguration` and `createLlmToolsFromEnv`
8
+ */
9
+ export declare function $registeredLlmToolsMessage(): string_markdown;
@@ -1,5 +1,5 @@
1
1
  import type { string_title } from '../../types/typeAliases';
2
- import type { Registered } from '../../utils/Register';
2
+ import type { Registered } from '../../utils/$Register';
3
3
  import type { LlmToolsOptions } from './LlmToolsOptions';
4
4
  /**
5
5
  * @@@
@@ -1,6 +1,6 @@
1
1
  import type { string_name } from '../../types/typeAliases';
2
2
  import type { string_title } from '../../types/typeAliases';
3
- import type { Registered } from '../../utils/Register';
3
+ import type { Registered } from '../../utils/$Register';
4
4
  import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
5
5
  /**
6
6
  * @@@
@@ -13,6 +13,7 @@ import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
13
13
  */
14
14
  export declare function createLlmToolsFromConfigurationFromEnv(): LlmToolsConfiguration;
15
15
  /**
16
+ * TODO: [🧠][🪁] Maybe do allow to do auto-install if package not registered and not found
16
17
  * TODO: Add Azure OpenAI
17
18
  * TODO: [🧠][🍛]
18
19
  * TODO: [🧠] Is there some meaningfull way how to test this util
@@ -1,4 +1,4 @@
1
- import '../../_packages/core.index';
1
+ import '../../_packages/cli.index';
2
2
  import type { CreateLlmToolsFromConfigurationOptions } from './createLlmToolsFromConfiguration';
3
3
  import type { LlmExecutionToolsWithTotalUsage } from './utils/count-total-usage/LlmExecutionToolsWithTotalUsage';
4
4
  type GetLlmToolsForTestingAndScriptsAndPlaygroundOptions = CreateLlmToolsFromConfigurationOptions & {
@@ -4,6 +4,7 @@
4
4
  * Note: [🏐] Configurations registrations are done in @@@ BUT constructor @@@
5
5
  *
6
6
  * @public exported from `@promptbook/anthropic-claude`
7
+ * @public exported from `@promptbook/cli`
7
8
  */
8
9
  export declare const _AnthropicClaudeRegistration: void;
9
10
  /**
@@ -4,6 +4,7 @@
4
4
  * Note: [🏐] Configurations registrations are done in @@@ BUT constructor @@@
5
5
  *
6
6
  * @public exported from `@promptbook/azure-openai`
7
+ * @public exported from `@promptbook/cli`
7
8
  */
8
9
  export declare const _AzureOpenAiRegistration: void;
9
10
  /**
@@ -4,6 +4,7 @@
4
4
  * Note: [🏐] Configurations registrations are done in @@@ BUT constructor @@@
5
5
  *
6
6
  * @public exported from `@promptbook/openai`
7
+ * @public exported from `@promptbook/cli`
7
8
  */
8
9
  export declare const _OpenAiRegistration: void;
9
10
  /**
@@ -54,6 +54,7 @@ export declare class RemoteLlmExecutionTools implements LlmExecutionTools {
54
54
  private callCommonModel;
55
55
  }
56
56
  /**
57
+ * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
57
58
  * TODO: [🍓] Allow to list compatible models with each variant
58
59
  * TODO: [🗯] RemoteLlmExecutionTools should extend Destroyable and implement IDestroyable
59
60
  * TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * This is sent from server to client when error occurs and stops the process
5
5
  */
6
- export type Promptbook_Server_Error = {
6
+ export type PromptbookServer_Error = {
7
7
  /**
8
8
  * The error message which caused the error
9
9
  */
@@ -0,0 +1,34 @@
1
+ import type { client_id } from '../../../types/typeAliases';
2
+ import type { LlmToolsConfiguration } from '../../_common/LlmToolsConfiguration';
3
+ /**
4
+ * Socket.io progress for remote text generation
5
+ *
6
+ * This is a request from client to server
7
+ */
8
+ export type PromptbookServer_ListModels_Request = PromptbookServer_ListModels_CollectionRequest | PromptbookServer_ListModels_AnonymousRequest;
9
+ export type PromptbookServer_ListModels_CollectionRequest = {
10
+ /**
11
+ * Collection mode
12
+ */
13
+ isAnonymous: false;
14
+ /**
15
+ * Client responsible for the requests
16
+ */
17
+ readonly clientId: client_id;
18
+ };
19
+ export type PromptbookServer_ListModels_AnonymousRequest = {
20
+ /**
21
+ * Anonymous mode
22
+ */
23
+ isAnonymous: true;
24
+ /**
25
+ * Configuration for the LLM tools
26
+ */
27
+ readonly llmToolsConfiguration: LlmToolsConfiguration;
28
+ };
29
+ /**
30
+ * TODO: [👡] DRY `PromptbookServer_Prompt_Request` and `PromptbookServer_ListModels_Request`
31
+ * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
32
+ * TODO: [🧠][🤺] Pass `clientId` in `PromptbookServer_ListModels_Request`
33
+ * TODO: [👒] Listing models (and checking configuration) probbably should go through REST API not Socket.io
34
+ */
@@ -0,0 +1,15 @@
1
+ import type { AvailableModel } from '../../../execution/AvailableModel';
2
+ /**
3
+ * Socket.io error for remote text generation
4
+ *
5
+ * This is sent from server to client when models are listed
6
+ */
7
+ export interface PromptbookServer_ListModels_Response {
8
+ /**
9
+ * Available models that can be used
10
+ */
11
+ models: Array<AvailableModel>;
12
+ }
13
+ /**
14
+ * TODO: [👒] Listing models (and checking configuration) probbably should go through REST API not Socket.io
15
+ */
@@ -4,7 +4,7 @@ import type { TaskProgress } from '../../../types/TaskProgress';
4
4
  *
5
5
  * This is sent from server to client arbitrarily and may be sent multiple times
6
6
  */
7
- export type Promptbook_Server_Progress = {
7
+ export type PromptbookServer_Prompt_Progress = {
8
8
  /**
9
9
  * The progress of text generation
10
10
  */
@@ -6,8 +6,12 @@ import type { LlmToolsConfiguration } from '../../_common/LlmToolsConfiguration'
6
6
  *
7
7
  * This is a request from client to server
8
8
  */
9
- export type Promptbook_Server_Request = Promptbook_Server_CollectionRequest | Promptbook_Server_AnonymousRequest;
10
- export type Promptbook_Server_CollectionRequest = {
9
+ export type PromptbookServer_Prompt_Request = PromptbookServer_Prompt_CollectionRequest | PromptbookServer_Prompt_AnonymousRequest;
10
+ export type PromptbookServer_Prompt_CollectionRequest = {
11
+ /**
12
+ * Collection mode
13
+ */
14
+ isAnonymous: false;
11
15
  /**
12
16
  * Client responsible for the requests
13
17
  */
@@ -17,7 +21,11 @@ export type Promptbook_Server_CollectionRequest = {
17
21
  */
18
22
  readonly prompt: Prompt;
19
23
  };
20
- export type Promptbook_Server_AnonymousRequest = {
24
+ export type PromptbookServer_Prompt_AnonymousRequest = {
25
+ /**
26
+ * Anonymous mode
27
+ */
28
+ isAnonymous: true;
21
29
  /**
22
30
  * Configuration for the LLM tools
23
31
  */
@@ -27,3 +35,7 @@ export type Promptbook_Server_AnonymousRequest = {
27
35
  */
28
36
  readonly prompt: Prompt;
29
37
  };
38
+ /**
39
+ * TODO: [👡] DRY `PromptbookServer_Prompt_Request` and `PromptbookServer_ListModels_Request`
40
+ * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
41
+ */
@@ -4,7 +4,7 @@ import type { PromptResult } from '../../../execution/PromptResult';
4
4
  *
5
5
  * This is sent from server to client when the generated text is completed
6
6
  */
7
- export interface Promptbook_Server_Response {
7
+ export interface PromptbookServer_Prompt_Response {
8
8
  /**
9
9
  * The result of the prompt
10
10
  */
@@ -1,4 +1,3 @@
1
- import type { AvailableModel } from '../../../execution/AvailableModel';
2
1
  import type { CommonExecutionToolsOptions } from '../../../execution/CommonExecutionToolsOptions';
3
2
  import type { client_id } from '../../../types/typeAliases';
4
3
  import type { string_base_url } from '../../../types/typeAliases';
@@ -22,12 +21,6 @@ export type RemoteLlmExecutionToolsOptions = CommonExecutionToolsOptions & {
22
21
  * @example '/promptbook/socket.io'
23
22
  */
24
23
  readonly path: string_uri;
25
- /**
26
- * If set, only these models will be listed as available
27
- *
28
- * TODO: [🧠] !!!!!! Figure out better solution
29
- */
30
- readonly models?: Array<AvailableModel>;
31
24
  /**
32
25
  * Mode of the server to connect to
33
26
  */
@@ -52,5 +45,6 @@ export type RemoteLlmExecutionToolsOptions = CommonExecutionToolsOptions & {
52
45
  readonly clientId: client_id;
53
46
  });
54
47
  /**
48
+ * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
55
49
  * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
56
50
  */
@@ -11,6 +11,7 @@ import type { RemoteServerOptions } from './interfaces/RemoteServerOptions';
11
11
  */
12
12
  export declare function startRemoteServer(options: RemoteServerOptions): IDestroyable;
13
13
  /**
14
+ * TODO: [🧠][🛍] Maybe not `isAnonymous: boolean` BUT `mode: 'ANONYMOUS'|'COLLECTION'`
14
15
  * TODO: [⚖] Expose the collection to be able to connect to same collection via createCollectionFromUrl
15
16
  * TODO: Handle progress - support streaming
16
17
  * TODO: [🗯] Do not hang up immediately but wait until client closes OR timeout
@@ -1,3 +1,4 @@
1
+ import type { string_javascript_name } from '../types/typeAliases';
1
2
  import type { TODO_string } from './organization/TODO_string';
2
3
  export type Registered = {
3
4
  /**
@@ -12,11 +13,14 @@ export type Registered = {
12
13
  /**
13
14
  * Register is @@@
14
15
  *
16
+ * Note: `$` is used to indicate that this function is not a pure function - it accesses and adds variables in global scope.
17
+ *
15
18
  * @private internal utility, exported are only signleton instances of this class
16
19
  */
17
- export declare class Register<TRegistered extends Registered> {
20
+ export declare class $Register<TRegistered extends Registered> {
21
+ private readonly storageName;
18
22
  private readonly storage;
19
- constructor(storage: Array<TRegistered>);
23
+ constructor(storageName: string_javascript_name);
20
24
  list(): Array<TRegistered>;
21
25
  register(registered: TRegistered): void;
22
26
  }
@@ -2,7 +2,7 @@ import type { really_any } from '../organization/really_any';
2
2
  /**
3
3
  * @@@
4
4
  *
5
- * Note: `$` is used to indicate that this function is not a pure function - it access global
5
+ * Note: `$` is used to indicate that this function is not a pure function - it access global scope
6
6
  *
7
7
  * @public exported from `@promptbook/utils`
8
8
  */
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Organizational helper to better mark the place where to really use empty object `{}`
3
+ *
4
+ * @private within the repository
5
+ */
6
+ export type really_empty_object = Record<string, never>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/browser",
3
- "version": "0.66.0-8",
3
+ "version": "0.66.0-9",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -47,7 +47,7 @@
47
47
  "module": "./esm/index.es.js",
48
48
  "typings": "./esm/typings/src/_packages/browser.index.d.ts",
49
49
  "peerDependencies": {
50
- "@promptbook/core": "0.66.0-8"
50
+ "@promptbook/core": "0.66.0-9"
51
51
  },
52
52
  "dependencies": {
53
53
  "spacetrim": "0.11.39"
package/umd/index.umd.js CHANGED
@@ -8,7 +8,7 @@
8
8
  /**
9
9
  * The version of the Promptbook library
10
10
  */
11
- var PROMPTBOOK_VERSION = '0.66.0-7';
11
+ var PROMPTBOOK_VERSION = '0.66.0-8';
12
12
  // TODO: !!!! List here all the versions and annotate + put into script
13
13
 
14
14
  /*! *****************************************************************************
@@ -1,14 +0,0 @@
1
- import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
2
- import type { TODO_any } from '../../utils/organization/TODO_any';
3
- /**
4
- * @@@
5
- *
6
- * TODO: !!!!!! Remove EXECUTION_TOOLS_CLASSES and use $llmToolsRegister instead
7
- *
8
- * @private internal type for `createLlmToolsFromConfiguration`
9
- */
10
- export declare const EXECUTION_TOOLS_CLASSES: Record<`create${string}`, (options: TODO_any) => LlmExecutionTools>;
11
- /**
12
- * TODO: !!!!!!! Make global register for this
13
- * TODO: [🧠][🎌] Adding this should be responsibility of each provider package NOT this one central place
14
- */
@@ -1,4 +0,0 @@
1
- /**
2
- * @public exported from `@promptbook/anthropic-claude`
3
- */
4
- export declare const _: undefined;