@promptbook/remote-server 0.37.0 → 0.39.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.
Files changed (69) hide show
  1. package/esm/index.es.js +1 -1
  2. package/esm/typings/_packages/core.index.d.ts +2 -2
  3. package/esm/typings/_packages/types.index.d.ts +2 -1
  4. package/esm/typings/execution/CommonExecutionToolsOptions.d.ts +2 -2
  5. package/esm/typings/execution/ExecutionTools.d.ts +2 -2
  6. package/esm/typings/execution/NaturalExecutionTools.d.ts +2 -2
  7. package/esm/typings/execution/PromptResult.d.ts +3 -4
  8. package/esm/typings/execution/PromptbookExecutor.d.ts +2 -2
  9. package/esm/typings/execution/ScriptExecutionTools.d.ts +5 -5
  10. package/esm/typings/execution/UserInterfaceTools.d.ts +4 -4
  11. package/esm/typings/execution/createPromptbookExecutor.d.ts +2 -2
  12. package/esm/typings/execution/plugins/natural-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +2 -2
  13. package/esm/typings/execution/plugins/natural-execution-tools/remote/RemoteNaturalExecutionToolsOptions.d.ts +2 -2
  14. package/esm/typings/execution/plugins/natural-execution-tools/remote/interfaces/RemoteServerOptions.d.ts +3 -3
  15. package/esm/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions.d.ts +2 -2
  16. package/{umd/typings/execution/translation/automatic-translate/automatic-translators/IAutomaticTranslator.d.ts → esm/typings/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts} +2 -2
  17. package/esm/typings/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +3 -3
  18. package/esm/typings/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +2 -2
  19. package/esm/typings/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +5 -5
  20. package/esm/typings/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +4 -0
  21. package/esm/typings/execution/translation/automatic-translate/translateMessages.d.ts +4 -4
  22. package/esm/typings/library/PromptbookLibrary.d.ts +24 -0
  23. package/esm/typings/library/SimplePromptbookLibrary.d.ts +41 -0
  24. package/esm/typings/types/Command.d.ts +18 -18
  25. package/esm/typings/types/ModelRequirements.d.ts +3 -3
  26. package/esm/typings/types/Prompt.d.ts +2 -2
  27. package/esm/typings/types/PromptbookJson/PromptTemplateJson.d.ts +2 -2
  28. package/esm/typings/types/PromptbookJson/PromptTemplateParameterJson.d.ts +2 -2
  29. package/esm/typings/types/PromptbookJson/PromptbookJson.d.ts +2 -2
  30. package/esm/typings/types/TaskProgress.d.ts +2 -2
  31. package/esm/typings/types/typeAliases.d.ts +0 -26
  32. package/esm/typings/utils/markdown-json/MarkdownStructure.d.ts +2 -2
  33. package/package.json +2 -2
  34. package/umd/index.umd.js +1 -1
  35. package/umd/typings/_packages/core.index.d.ts +2 -2
  36. package/umd/typings/_packages/types.index.d.ts +2 -1
  37. package/umd/typings/execution/CommonExecutionToolsOptions.d.ts +2 -2
  38. package/umd/typings/execution/ExecutionTools.d.ts +2 -2
  39. package/umd/typings/execution/NaturalExecutionTools.d.ts +2 -2
  40. package/umd/typings/execution/PromptResult.d.ts +3 -4
  41. package/umd/typings/execution/PromptbookExecutor.d.ts +2 -2
  42. package/umd/typings/execution/ScriptExecutionTools.d.ts +5 -5
  43. package/umd/typings/execution/UserInterfaceTools.d.ts +4 -4
  44. package/umd/typings/execution/createPromptbookExecutor.d.ts +2 -2
  45. package/umd/typings/execution/plugins/natural-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +2 -2
  46. package/umd/typings/execution/plugins/natural-execution-tools/remote/RemoteNaturalExecutionToolsOptions.d.ts +2 -2
  47. package/umd/typings/execution/plugins/natural-execution-tools/remote/interfaces/RemoteServerOptions.d.ts +3 -3
  48. package/umd/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions.d.ts +2 -2
  49. package/{esm/typings/execution/translation/automatic-translate/automatic-translators/IAutomaticTranslator.d.ts → umd/typings/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts} +2 -2
  50. package/umd/typings/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +3 -3
  51. package/umd/typings/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +2 -2
  52. package/umd/typings/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +5 -5
  53. package/umd/typings/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +4 -0
  54. package/umd/typings/execution/translation/automatic-translate/translateMessages.d.ts +4 -4
  55. package/umd/typings/library/PromptbookLibrary.d.ts +24 -0
  56. package/umd/typings/library/SimplePromptbookLibrary.d.ts +41 -0
  57. package/umd/typings/types/Command.d.ts +18 -18
  58. package/umd/typings/types/ModelRequirements.d.ts +3 -3
  59. package/umd/typings/types/Prompt.d.ts +2 -2
  60. package/umd/typings/types/PromptbookJson/PromptTemplateJson.d.ts +2 -2
  61. package/umd/typings/types/PromptbookJson/PromptTemplateParameterJson.d.ts +2 -2
  62. package/umd/typings/types/PromptbookJson/PromptbookJson.d.ts +2 -2
  63. package/umd/typings/types/TaskProgress.d.ts +2 -2
  64. package/umd/typings/types/typeAliases.d.ts +0 -26
  65. package/umd/typings/utils/markdown-json/MarkdownStructure.d.ts +2 -2
  66. package/esm/typings/classes/PromptbookLibrary.d.ts +0 -75
  67. package/esm/typings/execution/translation/automatic-translate/automatic-translators/ITranslatorOptions.d.ts +0 -4
  68. package/umd/typings/classes/PromptbookLibrary.d.ts +0 -75
  69. package/umd/typings/execution/translation/automatic-translate/automatic-translators/ITranslatorOptions.d.ts +0 -4
@@ -10,14 +10,14 @@ export type PromptTemplateJson = NaturalTemplateJson | SimpleTemplateJson | Scri
10
10
  /**
11
11
  * Template for prompt to LLM
12
12
  */
13
- export interface NaturalTemplateJson extends PromptTemplateJsonCommon {
13
+ export type NaturalTemplateJson = PromptTemplateJsonCommon & {
14
14
  readonly executionType: 'PROMPT_TEMPLATE';
15
15
  /**
16
16
  * Requirements for the model
17
17
  * - This is required only for executionType PROMPT_TEMPLATE
18
18
  */
19
19
  readonly modelRequirements: ModelRequirements;
20
- }
20
+ };
21
21
  /**
22
22
  * Units of text measurement
23
23
  */
@@ -2,7 +2,7 @@ import { string_name } from '../typeAliases';
2
2
  /**
3
3
  * Describes one parameter of the promptbook
4
4
  */
5
- export interface PromptTemplateParameterJson {
5
+ export type PromptTemplateParameterJson = {
6
6
  /**
7
7
  * Name of the parameter
8
8
  * - It must be unique across the pipeline
@@ -22,4 +22,4 @@ export interface PromptTemplateParameterJson {
22
22
  * - It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
23
23
  */
24
24
  readonly description?: string;
25
- }
25
+ };
@@ -7,7 +7,7 @@ import { PromptTemplateParameterJson } from './PromptTemplateParameterJson';
7
7
  *
8
8
  * @see https://github.com/webgptorg/promptbook#promptbook
9
9
  */
10
- export interface PromptbookJson {
10
+ export type PromptbookJson = {
11
11
  /**
12
12
  * Unique identifier of the promptbook
13
13
  *
@@ -40,7 +40,7 @@ export interface PromptbookJson {
40
40
  * Sequence of prompt templates that are chained together to form a pipeline
41
41
  */
42
42
  readonly promptTemplates: Array<PromptTemplateJson>;
43
- }
43
+ };
44
44
  /**
45
45
  * TODO: [🧠] Best format of this code?
46
46
  * There must be possible to make
@@ -3,7 +3,7 @@ import { string_markdown_text, string_name } from './typeAliases';
3
3
  /**
4
4
  * TaskProgress represents the progress of a Promptbook execution.
5
5
  */
6
- export interface TaskProgress {
6
+ export type TaskProgress = {
7
7
  /**
8
8
  * The unique name of the task.
9
9
  *
@@ -39,4 +39,4 @@ export interface TaskProgress {
39
39
  * The parameter value or null if the parameter is not yet processed.
40
40
  */
41
41
  readonly parameterValue: string | null;
42
- }
42
+ };
@@ -325,37 +325,12 @@ export type string_person_fullname = string;
325
325
  * For example `"Pavol Hejný <pavol@hejny.org> (https://pavolhejny.com)"`
326
326
  */
327
327
  export type string_person_profile = string;
328
- /**
329
- * Full profile of the person with his email and web (like in package.json)
330
- */
331
- export interface IPersonProfile {
332
- readonly name?: string_person_fullname;
333
- /**
334
- * Note: Photos are taken from Gravatar by email
335
- */
336
- readonly email?: string_email;
337
- readonly url?: string_url;
338
- }
339
328
  /**
340
329
  * Semantic helper
341
330
  *
342
331
  * For example `"MIT"`
343
332
  */
344
333
  export type string_license = string;
345
- /**
346
- * License with its type and url like in package.json
347
- */
348
- export interface ILicense {
349
- readonly type?: string_license;
350
- readonly url?: string;
351
- }
352
- /**
353
- * Repository with its type and url like in package.json
354
- */
355
- export interface IRepository {
356
- readonly type?: string | 'git';
357
- readonly url?: string;
358
- }
359
334
  /**
360
335
  * Semantic helper for attributes
361
336
  *
@@ -392,7 +367,6 @@ export type string_translate_name_not_normalized = string;
392
367
  * Implementing ISO 639-1
393
368
  *
394
369
  * TODO: Probably use enum
395
- * TODO: Rename - remove string_ prefix like ITranslateLanguageCode
396
370
  */
397
371
  export type string_translate_language = 'en' | 'cs';
398
372
  /**
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @private within the library
5
5
  */
6
- export interface MarkdownStructure {
6
+ export type MarkdownStructure = {
7
7
  /**
8
8
  * The section level of the markdown file.
9
9
  * h1 is level 1, h2 is level 2, etc.
@@ -22,4 +22,4 @@ export interface MarkdownStructure {
22
22
  * The sub-sections of current section which are recursively structured.
23
23
  */
24
24
  sections: MarkdownStructure[];
25
- }
25
+ };
@@ -1,75 +0,0 @@
1
- import { string_name } from '.././types/typeAliases';
2
- import { CreatePromptbookExecutorSettings } from '../execution/createPromptbookExecutor';
3
- import { ExecutionTools } from '../execution/ExecutionTools';
4
- import { PromptbookExecutor } from '../execution/PromptbookExecutor';
5
- import { Prompt } from '../types/Prompt';
6
- import { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
7
- import { PromptbookString } from '../types/PromptbookString';
8
- /**
9
- * Options for PromptbookLibrary
10
- */
11
- type PromptbookLibraryOptions = {
12
- /**
13
- * The library of promptbooks
14
- */
15
- readonly library: Record<string_name, PromptbookJson>;
16
- /**
17
- * Optional settings for creating a PromptbookExecutor
18
- */
19
- readonly settings?: Partial<CreatePromptbookExecutorSettings>;
20
- };
21
- /**
22
- * Library of promptbooks that groups together promptbooks for an application. This is a very thin wrapper around the Array / Set of promptbooks.
23
- *
24
- * Promptbook library is a useful helper in execution, it can be shared between execution and consumer parts of the app and make common knowledge about promptbooks.
25
- *
26
- * It allows to create executor functions from promptbooks in the library.
27
- *
28
- * @see https://github.com/webgptorg/promptbook#prompt-template-pipeline-library
29
- */
30
- export declare class PromptbookLibrary {
31
- readonly options: PromptbookLibraryOptions;
32
- /**
33
- * Constructs Promptbook from any sources
34
- *
35
- * Note: During the construction syntax and logic of all sources are validated
36
- * Note: You can combine .ptbk.md and .ptbk.json files BUT it is not recommended
37
- *
38
- * @param promptbookSources contents of .ptbk.md or .ptbk.json files
39
- * @param settings settings for creating executor functions
40
- * @returns PromptbookLibrary
41
- */
42
- static fromSources(promptbookSources: Record<string_name, PromptbookJson | PromptbookString>, settings?: Partial<CreatePromptbookExecutorSettings>): PromptbookLibrary;
43
- private constructor();
44
- /**
45
- * Gets all promptbooks in the library
46
- */
47
- get promptbookNames(): Array<string_name>;
48
- /**
49
- * Gets promptbook by name
50
- */
51
- getPromptbookByName(name: string_name): PromptbookJson;
52
- /**
53
- * Checks whether prompt is in the library
54
- */
55
- isPromptInLibrary(prompt: Prompt): boolean;
56
- /**
57
- * Gets executor function for given promptbook
58
- */
59
- createExecutor(name: string_name, tools: ExecutionTools): PromptbookExecutor;
60
- }
61
- export {};
62
- /**
63
- * TODO: [🈴] Identify promptbooks by url `promptbookUrls` + `getPromptbookByUrl`
64
- * TODO: !! [👐][🧠] Split of Promptbook,PromptbookLibrary between interface and class
65
- * TODO: !! [👐] Make promptbooks private WHEN split between interface and class
66
- * TODO: [🧠] Maybe isPromptInLibrary should be separate utility function
67
- * TODO: [🧠] Maybe createExecutor should be separate utility function
68
- * TODO: Static method fromDirectory
69
- * TODO: [🤜] Add generic type for entry and result parameters
70
- * TODO: [🧠] Is it better to promptbookLibrary.executePromptbook('writeXyz',{...}) OR promptbookLibrary.createExecutor('writeXyz')({...}) OR createExecutor(promptbookLibrary.getPromptbook('writeXyz'))
71
- * TODO: [🧠] Formarly (before commit 62229afce7668a5b85077cc18becf798b583bf8d) there were two classes PromptbookLibrary+PromptbookLibraryExecutor (maybe it was better?)
72
- * TODO: [🧠] Is it better to pass tools into getExecutor or into constructor
73
- * Maybe it is not a good idea to cache executors when they are can be created with different tools
74
- * TODO: [👧] Strongly type the executors to avoid need of remove nullables whtn noUncheckedIndexedAccess in tsconfig.json
75
- */
@@ -1,4 +0,0 @@
1
- export interface ITranslatorOptions {
2
- from: string;
3
- to: string;
4
- }
@@ -1,75 +0,0 @@
1
- import { string_name } from '.././types/typeAliases';
2
- import { CreatePromptbookExecutorSettings } from '../execution/createPromptbookExecutor';
3
- import { ExecutionTools } from '../execution/ExecutionTools';
4
- import { PromptbookExecutor } from '../execution/PromptbookExecutor';
5
- import { Prompt } from '../types/Prompt';
6
- import { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
7
- import { PromptbookString } from '../types/PromptbookString';
8
- /**
9
- * Options for PromptbookLibrary
10
- */
11
- type PromptbookLibraryOptions = {
12
- /**
13
- * The library of promptbooks
14
- */
15
- readonly library: Record<string_name, PromptbookJson>;
16
- /**
17
- * Optional settings for creating a PromptbookExecutor
18
- */
19
- readonly settings?: Partial<CreatePromptbookExecutorSettings>;
20
- };
21
- /**
22
- * Library of promptbooks that groups together promptbooks for an application. This is a very thin wrapper around the Array / Set of promptbooks.
23
- *
24
- * Promptbook library is a useful helper in execution, it can be shared between execution and consumer parts of the app and make common knowledge about promptbooks.
25
- *
26
- * It allows to create executor functions from promptbooks in the library.
27
- *
28
- * @see https://github.com/webgptorg/promptbook#prompt-template-pipeline-library
29
- */
30
- export declare class PromptbookLibrary {
31
- readonly options: PromptbookLibraryOptions;
32
- /**
33
- * Constructs Promptbook from any sources
34
- *
35
- * Note: During the construction syntax and logic of all sources are validated
36
- * Note: You can combine .ptbk.md and .ptbk.json files BUT it is not recommended
37
- *
38
- * @param promptbookSources contents of .ptbk.md or .ptbk.json files
39
- * @param settings settings for creating executor functions
40
- * @returns PromptbookLibrary
41
- */
42
- static fromSources(promptbookSources: Record<string_name, PromptbookJson | PromptbookString>, settings?: Partial<CreatePromptbookExecutorSettings>): PromptbookLibrary;
43
- private constructor();
44
- /**
45
- * Gets all promptbooks in the library
46
- */
47
- get promptbookNames(): Array<string_name>;
48
- /**
49
- * Gets promptbook by name
50
- */
51
- getPromptbookByName(name: string_name): PromptbookJson;
52
- /**
53
- * Checks whether prompt is in the library
54
- */
55
- isPromptInLibrary(prompt: Prompt): boolean;
56
- /**
57
- * Gets executor function for given promptbook
58
- */
59
- createExecutor(name: string_name, tools: ExecutionTools): PromptbookExecutor;
60
- }
61
- export {};
62
- /**
63
- * TODO: [🈴] Identify promptbooks by url `promptbookUrls` + `getPromptbookByUrl`
64
- * TODO: !! [👐][🧠] Split of Promptbook,PromptbookLibrary between interface and class
65
- * TODO: !! [👐] Make promptbooks private WHEN split between interface and class
66
- * TODO: [🧠] Maybe isPromptInLibrary should be separate utility function
67
- * TODO: [🧠] Maybe createExecutor should be separate utility function
68
- * TODO: Static method fromDirectory
69
- * TODO: [🤜] Add generic type for entry and result parameters
70
- * TODO: [🧠] Is it better to promptbookLibrary.executePromptbook('writeXyz',{...}) OR promptbookLibrary.createExecutor('writeXyz')({...}) OR createExecutor(promptbookLibrary.getPromptbook('writeXyz'))
71
- * TODO: [🧠] Formarly (before commit 62229afce7668a5b85077cc18becf798b583bf8d) there were two classes PromptbookLibrary+PromptbookLibraryExecutor (maybe it was better?)
72
- * TODO: [🧠] Is it better to pass tools into getExecutor or into constructor
73
- * Maybe it is not a good idea to cache executors when they are can be created with different tools
74
- * TODO: [👧] Strongly type the executors to avoid need of remove nullables whtn noUncheckedIndexedAccess in tsconfig.json
75
- */
@@ -1,4 +0,0 @@
1
- export interface ITranslatorOptions {
2
- from: string;
3
- to: string;
4
- }