@promptbook/remote-client 0.61.0-23 → 0.61.0-24

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 (37) hide show
  1. package/esm/index.es.js +1 -1
  2. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -0
  3. package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -0
  4. package/esm/typings/src/execution/PromptResultUsage.d.ts +3 -0
  5. package/esm/typings/src/prepare/preparePipeline.d.ts +0 -1
  6. package/esm/typings/src/prepare/prepareTemplates.d.ts +31 -0
  7. package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -0
  8. package/esm/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +3 -0
  9. package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +3 -0
  10. package/esm/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +1 -0
  11. package/esm/typings/src/types/PipelineJson/PersonaJson.d.ts +3 -0
  12. package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -0
  13. package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -0
  14. package/esm/typings/src/types/PipelineJson/PromptDialogJson.d.ts +4 -3
  15. package/esm/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +10 -0
  16. package/esm/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +1 -0
  17. package/esm/typings/src/types/PipelineJson/ScriptJson.d.ts +5 -2
  18. package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +5 -2
  19. package/package.json +2 -2
  20. package/umd/index.umd.js +1 -1
  21. package/umd/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -0
  22. package/umd/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -0
  23. package/umd/typings/src/execution/PromptResultUsage.d.ts +3 -0
  24. package/umd/typings/src/prepare/preparePipeline.d.ts +0 -1
  25. package/umd/typings/src/prepare/prepareTemplates.d.ts +31 -0
  26. package/umd/typings/src/prepare/unpreparePipeline.d.ts +1 -0
  27. package/umd/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +3 -0
  28. package/umd/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +3 -0
  29. package/umd/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +1 -0
  30. package/umd/typings/src/types/PipelineJson/PersonaJson.d.ts +3 -0
  31. package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -0
  32. package/umd/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -0
  33. package/umd/typings/src/types/PipelineJson/PromptDialogJson.d.ts +4 -3
  34. package/umd/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +10 -0
  35. package/umd/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +1 -0
  36. package/umd/typings/src/types/PipelineJson/ScriptJson.d.ts +5 -2
  37. package/umd/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +5 -2
package/esm/index.es.js CHANGED
@@ -214,7 +214,7 @@ var RemoteLlmExecutionTools = /** @class */ (function () {
214
214
  /**
215
215
  * The version of the Promptbook library
216
216
  */
217
- var PROMPTBOOK_VERSION = '0.61.0-22';
217
+ var PROMPTBOOK_VERSION = '0.61.0-23';
218
218
  // TODO: !!!! List here all the versions and annotate + put into script
219
219
 
220
220
  export { PROMPTBOOK_VERSION, RemoteLlmExecutionTools };
@@ -24,4 +24,5 @@ export declare function pipelineStringToJsonSync(pipelineString: PipelineString)
24
24
  * TODO: [🥞] Not optimal parsing because `splitMarkdownIntoSections` is executed twice with same string, once through `flattenMarkdown` and second directly here
25
25
  * TODO: [♈] Probbably move expectations from templates to parameters
26
26
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
27
+ * TODO: [🍙] Make some standart order of json properties
27
28
  */
@@ -10,4 +10,5 @@ export declare function stringifyPipelineJson<TType>(pipeline: TType): string_js
10
10
  * TODO: !!!! Not Working propperly @see https://promptbook.studio/samples/mixed-knowledge.ptbk.md
11
11
  * TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
12
12
  * TODO: [🧠] Maybe more elegant solution than replacing via regex
13
+ * TODO: [🍙] Make some standart order of json properties
13
14
  */
@@ -24,3 +24,6 @@ export type PromptResultUsage = {
24
24
  * Record of all possible measurable units
25
25
  */
26
26
  export type PromptResultUsageCounts = Record<`${KebabCase<'TOKENS' | ExpectationUnit>}Count`, UncertainNumber>;
27
+ /**
28
+ * TODO: [🍙] Make some standart order of json properties
29
+ */
@@ -8,7 +8,6 @@ import type { PrepareOptions } from './PrepareOptions';
8
8
  */
9
9
  export declare function preparePipeline(pipeline: PipelineJson, options: PrepareOptions): Promise<PipelineJson>;
10
10
  /**
11
- * TODO: !!!!! Index the samples and maybe templates
12
11
  * TODO: [🔼] !!! Export via `@promptbook/core`
13
12
  * TODO: Write tests for `preparePipeline`
14
13
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
@@ -0,0 +1,31 @@
1
+ import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
2
+ import type { PromptTemplateJson } from '../types/PipelineJson/PromptTemplateJson';
3
+ import type { PrepareOptions } from './PrepareOptions';
4
+ type PrepareTemplateInput = Pick<PipelineJson, 'promptTemplates' | 'parameters'> & {
5
+ /**
6
+ * @@@
7
+ */
8
+ readonly knowledgePiecesCount: number;
9
+ };
10
+ type PreparedTemplates = {
11
+ /**
12
+ * @@@ Sequence of prompt templates that are chained together to form a pipeline
13
+ */
14
+ readonly promptTemplatesPrepared: Array<PromptTemplateJson>;
15
+ };
16
+ /**
17
+ * @@@
18
+ */
19
+ export declare function prepareTemplates(pipeline: PrepareTemplateInput, options: PrepareOptions): Promise<PreparedTemplates>;
20
+ export {};
21
+ /**
22
+ * TODO: [🧠] Add context to each template (if missing)
23
+ * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
24
+ * TODO: !!!!! Index the samples and maybe templates
25
+ * TODO: [🔼] !!! Export via `@promptbook/core`
26
+ * TODO: Write tests for `preparePipeline`
27
+ * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
28
+ * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
29
+ * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
30
+ * TODO: [🧠][🥜]
31
+ */
@@ -7,4 +7,5 @@ export declare function unpreparePipeline(pipeline: PipelineJson): PipelineJson;
7
7
  * TODO: [🔼] !!! Export via `@promptbook/core`
8
8
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
9
9
  * TODO: Write tests for `preparePipeline`
10
+ * TODO: [🍙] Make some standart order of json properties
10
11
  */
@@ -65,3 +65,6 @@ export type KnowledgePiecePreparedJson = {
65
65
  */
66
66
  readonly preparationIds: Array<number_id>;
67
67
  };
68
+ /**
69
+ * TODO: [🍙] Make some standart order of json properties
70
+ */
@@ -22,3 +22,6 @@ export type KnowledgeSourcePreparedJson = KnowledgeSourceJson & {
22
22
  */
23
23
  readonly preparationIds: Array<number_id>;
24
24
  };
25
+ /**
26
+ * TODO: [🍙] Make some standart order of json properties
27
+ */
@@ -21,4 +21,5 @@ export type LlmTemplateJson = PromptTemplateJsonCommon & {
21
21
  * TODO: [👙][🧠] Maybe add `knowledge`, `actions` and `instruments` to be available granularly for each template
22
22
  * @see https://github.com/webgptorg/promptbook/discussions/79
23
23
  * TODO: [💕][🧠] Just selecting gpt3 or gpt4 level of model
24
+ * TODO: [🍙] Make some standart order of json properties
24
25
  */
@@ -36,3 +36,6 @@ export type PersonaPreparedJson = PersonaJson & {
36
36
  */
37
37
  readonly preparationIds: Array<number_id>;
38
38
  };
39
+ /**
40
+ * TODO: [🍙] Make some standart order of json properties
41
+ */
@@ -79,6 +79,7 @@ export type PipelineJson = {
79
79
  readonly preparations: Array<PreparationJson>;
80
80
  };
81
81
  /**
82
+ * TODO: [🍙] Make some standart order of json properties
82
83
  * TODO: [🧠] Maybe wrap all {parameterNames} in brackets for example { "resultingParameterName": "{foo}" }
83
84
  * Note: There was a proposal for multiple types of promptbook objects 78816ff33e2705ee1a187aa2eb8affd976d4ea1a
84
85
  * But then immediately reverted back to the single type
@@ -16,6 +16,7 @@ export type PreparationJson = {
16
16
  readonly modelUsage: PromptResultUsage;
17
17
  };
18
18
  /**
19
+ * TODO: [🍙] Make some standart order of json properties
19
20
  * TODO: Maybe put here used `modelName`
20
21
  * TODO: [🍥] When using `date` it changes all samples .ptbk.json files each time so until some more elegant solution omit the time from prepared pipeline
21
22
  */
@@ -4,9 +4,10 @@ import type { PromptTemplateJsonCommon } from './PromptTemplateJsonCommon';
4
4
  *
5
5
  * @see https://github.com/webgptorg/promptbook/discussions/76
6
6
  */
7
- export interface PromptDialogJson extends PromptTemplateJsonCommon {
7
+ export type PromptDialogJson = PromptTemplateJsonCommon & {
8
8
  readonly blockType: 'PROMPT_DIALOG';
9
- }
9
+ };
10
10
  /**
11
11
  * TODO: [🧠][🥜]
12
- */
12
+ * TODO: [🍙] Make some standart order of json properties
13
+ */
@@ -49,8 +49,18 @@ export interface PromptTemplateJsonCommon {
49
49
  readonly blockType: BlockType;
50
50
  /**
51
51
  * Content of the template with {placeholders} for parameters
52
+ *
53
+ * @@@ content vs preparedContent
52
54
  */
53
55
  readonly content: (string_prompt | string_javascript | string_markdown) & string_template;
56
+ /**
57
+ * @@@ Content of the template with {placeholders} for parameters
58
+ *
59
+ * @@@ content vs preparedContent
60
+ *
61
+ * @default "{content}"
62
+ */
63
+ readonly preparedContent?: (string_prompt | string_javascript | string_markdown) & string_template;
54
64
  /**
55
65
  * List of postprocessing steps that are executed after the prompt template
56
66
  *
@@ -32,4 +32,5 @@ export type PromptTemplateParameterJson = {
32
32
  };
33
33
  /**
34
34
  * TODO: [♈] Probbably move expectations from templates to parameters
35
+ * TODO: [🍙] Make some standart order of json properties
35
36
  */
@@ -5,7 +5,7 @@ import type { PromptTemplateJsonCommon } from './PromptTemplateJsonCommon';
5
5
  *
6
6
  * @see https://github.com/webgptorg/promptbook/discussions/77
7
7
  */
8
- export interface ScriptJson extends PromptTemplateJsonCommon {
8
+ export type ScriptJson = PromptTemplateJsonCommon & {
9
9
  readonly blockType: 'SCRIPT';
10
10
  /**
11
11
  * Language of the script
@@ -13,4 +13,7 @@ export interface ScriptJson extends PromptTemplateJsonCommon {
13
13
  *
14
14
  */
15
15
  readonly contentLanguage?: ScriptLanguage;
16
- }
16
+ };
17
+ /**
18
+ * TODO: [🍙] Make some standart order of json properties
19
+ */
@@ -4,6 +4,9 @@ import type { PromptTemplateJsonCommon } from './PromptTemplateJsonCommon';
4
4
  *
5
5
  * @see https://github.com/webgptorg/promptbook/discussions/17
6
6
  */
7
- export interface SimpleTemplateJson extends PromptTemplateJsonCommon {
7
+ export type SimpleTemplateJson = PromptTemplateJsonCommon & {
8
8
  readonly blockType: 'SIMPLE_TEMPLATE';
9
- }
9
+ };
10
+ /**
11
+ * TODO: [🍙] Make some standart order of json properties
12
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/remote-client",
3
- "version": "0.61.0-23",
3
+ "version": "0.61.0-24",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -47,7 +47,7 @@
47
47
  }
48
48
  ],
49
49
  "peerDependencies": {
50
- "@promptbook/core": "0.61.0-23"
50
+ "@promptbook/core": "0.61.0-24"
51
51
  },
52
52
  "main": "./umd/index.umd.js",
53
53
  "module": "./esm/index.es.js",
package/umd/index.umd.js CHANGED
@@ -218,7 +218,7 @@
218
218
  /**
219
219
  * The version of the Promptbook library
220
220
  */
221
- var PROMPTBOOK_VERSION = '0.61.0-22';
221
+ var PROMPTBOOK_VERSION = '0.61.0-23';
222
222
  // TODO: !!!! List here all the versions and annotate + put into script
223
223
 
224
224
  exports.PROMPTBOOK_VERSION = PROMPTBOOK_VERSION;
@@ -24,4 +24,5 @@ export declare function pipelineStringToJsonSync(pipelineString: PipelineString)
24
24
  * TODO: [🥞] Not optimal parsing because `splitMarkdownIntoSections` is executed twice with same string, once through `flattenMarkdown` and second directly here
25
25
  * TODO: [♈] Probbably move expectations from templates to parameters
26
26
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
27
+ * TODO: [🍙] Make some standart order of json properties
27
28
  */
@@ -10,4 +10,5 @@ export declare function stringifyPipelineJson<TType>(pipeline: TType): string_js
10
10
  * TODO: !!!! Not Working propperly @see https://promptbook.studio/samples/mixed-knowledge.ptbk.md
11
11
  * TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
12
12
  * TODO: [🧠] Maybe more elegant solution than replacing via regex
13
+ * TODO: [🍙] Make some standart order of json properties
13
14
  */
@@ -24,3 +24,6 @@ export type PromptResultUsage = {
24
24
  * Record of all possible measurable units
25
25
  */
26
26
  export type PromptResultUsageCounts = Record<`${KebabCase<'TOKENS' | ExpectationUnit>}Count`, UncertainNumber>;
27
+ /**
28
+ * TODO: [🍙] Make some standart order of json properties
29
+ */
@@ -8,7 +8,6 @@ import type { PrepareOptions } from './PrepareOptions';
8
8
  */
9
9
  export declare function preparePipeline(pipeline: PipelineJson, options: PrepareOptions): Promise<PipelineJson>;
10
10
  /**
11
- * TODO: !!!!! Index the samples and maybe templates
12
11
  * TODO: [🔼] !!! Export via `@promptbook/core`
13
12
  * TODO: Write tests for `preparePipeline`
14
13
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
@@ -0,0 +1,31 @@
1
+ import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
2
+ import type { PromptTemplateJson } from '../types/PipelineJson/PromptTemplateJson';
3
+ import type { PrepareOptions } from './PrepareOptions';
4
+ type PrepareTemplateInput = Pick<PipelineJson, 'promptTemplates' | 'parameters'> & {
5
+ /**
6
+ * @@@
7
+ */
8
+ readonly knowledgePiecesCount: number;
9
+ };
10
+ type PreparedTemplates = {
11
+ /**
12
+ * @@@ Sequence of prompt templates that are chained together to form a pipeline
13
+ */
14
+ readonly promptTemplatesPrepared: Array<PromptTemplateJson>;
15
+ };
16
+ /**
17
+ * @@@
18
+ */
19
+ export declare function prepareTemplates(pipeline: PrepareTemplateInput, options: PrepareOptions): Promise<PreparedTemplates>;
20
+ export {};
21
+ /**
22
+ * TODO: [🧠] Add context to each template (if missing)
23
+ * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
24
+ * TODO: !!!!! Index the samples and maybe templates
25
+ * TODO: [🔼] !!! Export via `@promptbook/core`
26
+ * TODO: Write tests for `preparePipeline`
27
+ * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
28
+ * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
29
+ * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
30
+ * TODO: [🧠][🥜]
31
+ */
@@ -7,4 +7,5 @@ export declare function unpreparePipeline(pipeline: PipelineJson): PipelineJson;
7
7
  * TODO: [🔼] !!! Export via `@promptbook/core`
8
8
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
9
9
  * TODO: Write tests for `preparePipeline`
10
+ * TODO: [🍙] Make some standart order of json properties
10
11
  */
@@ -65,3 +65,6 @@ export type KnowledgePiecePreparedJson = {
65
65
  */
66
66
  readonly preparationIds: Array<number_id>;
67
67
  };
68
+ /**
69
+ * TODO: [🍙] Make some standart order of json properties
70
+ */
@@ -22,3 +22,6 @@ export type KnowledgeSourcePreparedJson = KnowledgeSourceJson & {
22
22
  */
23
23
  readonly preparationIds: Array<number_id>;
24
24
  };
25
+ /**
26
+ * TODO: [🍙] Make some standart order of json properties
27
+ */
@@ -21,4 +21,5 @@ export type LlmTemplateJson = PromptTemplateJsonCommon & {
21
21
  * TODO: [👙][🧠] Maybe add `knowledge`, `actions` and `instruments` to be available granularly for each template
22
22
  * @see https://github.com/webgptorg/promptbook/discussions/79
23
23
  * TODO: [💕][🧠] Just selecting gpt3 or gpt4 level of model
24
+ * TODO: [🍙] Make some standart order of json properties
24
25
  */
@@ -36,3 +36,6 @@ export type PersonaPreparedJson = PersonaJson & {
36
36
  */
37
37
  readonly preparationIds: Array<number_id>;
38
38
  };
39
+ /**
40
+ * TODO: [🍙] Make some standart order of json properties
41
+ */
@@ -79,6 +79,7 @@ export type PipelineJson = {
79
79
  readonly preparations: Array<PreparationJson>;
80
80
  };
81
81
  /**
82
+ * TODO: [🍙] Make some standart order of json properties
82
83
  * TODO: [🧠] Maybe wrap all {parameterNames} in brackets for example { "resultingParameterName": "{foo}" }
83
84
  * Note: There was a proposal for multiple types of promptbook objects 78816ff33e2705ee1a187aa2eb8affd976d4ea1a
84
85
  * But then immediately reverted back to the single type
@@ -16,6 +16,7 @@ export type PreparationJson = {
16
16
  readonly modelUsage: PromptResultUsage;
17
17
  };
18
18
  /**
19
+ * TODO: [🍙] Make some standart order of json properties
19
20
  * TODO: Maybe put here used `modelName`
20
21
  * TODO: [🍥] When using `date` it changes all samples .ptbk.json files each time so until some more elegant solution omit the time from prepared pipeline
21
22
  */
@@ -4,9 +4,10 @@ import type { PromptTemplateJsonCommon } from './PromptTemplateJsonCommon';
4
4
  *
5
5
  * @see https://github.com/webgptorg/promptbook/discussions/76
6
6
  */
7
- export interface PromptDialogJson extends PromptTemplateJsonCommon {
7
+ export type PromptDialogJson = PromptTemplateJsonCommon & {
8
8
  readonly blockType: 'PROMPT_DIALOG';
9
- }
9
+ };
10
10
  /**
11
11
  * TODO: [🧠][🥜]
12
- */
12
+ * TODO: [🍙] Make some standart order of json properties
13
+ */
@@ -49,8 +49,18 @@ export interface PromptTemplateJsonCommon {
49
49
  readonly blockType: BlockType;
50
50
  /**
51
51
  * Content of the template with {placeholders} for parameters
52
+ *
53
+ * @@@ content vs preparedContent
52
54
  */
53
55
  readonly content: (string_prompt | string_javascript | string_markdown) & string_template;
56
+ /**
57
+ * @@@ Content of the template with {placeholders} for parameters
58
+ *
59
+ * @@@ content vs preparedContent
60
+ *
61
+ * @default "{content}"
62
+ */
63
+ readonly preparedContent?: (string_prompt | string_javascript | string_markdown) & string_template;
54
64
  /**
55
65
  * List of postprocessing steps that are executed after the prompt template
56
66
  *
@@ -32,4 +32,5 @@ export type PromptTemplateParameterJson = {
32
32
  };
33
33
  /**
34
34
  * TODO: [♈] Probbably move expectations from templates to parameters
35
+ * TODO: [🍙] Make some standart order of json properties
35
36
  */
@@ -5,7 +5,7 @@ import type { PromptTemplateJsonCommon } from './PromptTemplateJsonCommon';
5
5
  *
6
6
  * @see https://github.com/webgptorg/promptbook/discussions/77
7
7
  */
8
- export interface ScriptJson extends PromptTemplateJsonCommon {
8
+ export type ScriptJson = PromptTemplateJsonCommon & {
9
9
  readonly blockType: 'SCRIPT';
10
10
  /**
11
11
  * Language of the script
@@ -13,4 +13,7 @@ export interface ScriptJson extends PromptTemplateJsonCommon {
13
13
  *
14
14
  */
15
15
  readonly contentLanguage?: ScriptLanguage;
16
- }
16
+ };
17
+ /**
18
+ * TODO: [🍙] Make some standart order of json properties
19
+ */
@@ -4,6 +4,9 @@ import type { PromptTemplateJsonCommon } from './PromptTemplateJsonCommon';
4
4
  *
5
5
  * @see https://github.com/webgptorg/promptbook/discussions/17
6
6
  */
7
- export interface SimpleTemplateJson extends PromptTemplateJsonCommon {
7
+ export type SimpleTemplateJson = PromptTemplateJsonCommon & {
8
8
  readonly blockType: 'SIMPLE_TEMPLATE';
9
- }
9
+ };
10
+ /**
11
+ * TODO: [🍙] Make some standart order of json properties
12
+ */