@promptbook/remote-client 0.61.0-23 → 0.61.0-25
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/README.md +3 -3
- package/esm/index.es.js +1 -1
- package/esm/typings/src/config.d.ts +5 -1
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -0
- package/esm/typings/src/conversion/utils/extractParametersFromPromptTemplate.d.ts +1 -1
- package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -0
- package/esm/typings/src/execution/PromptResultUsage.d.ts +3 -0
- package/esm/typings/src/execution/createPipelineExecutor.d.ts +2 -0
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -1
- package/esm/typings/src/prepare/preparePipeline.d.ts +0 -1
- package/esm/typings/src/prepare/prepareTemplates.d.ts +31 -0
- package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -0
- package/esm/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +3 -0
- package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +3 -0
- package/esm/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +1 -0
- package/esm/typings/src/types/PipelineJson/PersonaJson.d.ts +3 -0
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -0
- package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -0
- package/esm/typings/src/types/PipelineJson/PromptDialogJson.d.ts +4 -3
- package/esm/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +10 -0
- package/esm/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +1 -0
- package/esm/typings/src/types/PipelineJson/ScriptJson.d.ts +5 -2
- package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +5 -2
- package/esm/typings/src/utils/extractParameters.d.ts +3 -0
- package/package.json +2 -2
- package/umd/index.umd.js +1 -1
- package/umd/typings/src/config.d.ts +5 -1
- package/umd/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -0
- package/umd/typings/src/conversion/utils/extractParametersFromPromptTemplate.d.ts +1 -1
- package/umd/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -0
- package/umd/typings/src/execution/PromptResultUsage.d.ts +3 -0
- package/umd/typings/src/execution/createPipelineExecutor.d.ts +2 -0
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -1
- package/umd/typings/src/prepare/preparePipeline.d.ts +0 -1
- package/umd/typings/src/prepare/prepareTemplates.d.ts +31 -0
- package/umd/typings/src/prepare/unpreparePipeline.d.ts +1 -0
- package/umd/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +3 -0
- package/umd/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +3 -0
- package/umd/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +1 -0
- package/umd/typings/src/types/PipelineJson/PersonaJson.d.ts +3 -0
- package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -0
- package/umd/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -0
- package/umd/typings/src/types/PipelineJson/PromptDialogJson.d.ts +4 -3
- package/umd/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +10 -0
- package/umd/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +1 -0
- package/umd/typings/src/types/PipelineJson/ScriptJson.d.ts +5 -2
- package/umd/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +5 -2
- package/umd/typings/src/utils/extractParameters.d.ts +3 -0
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ File `write-website-content.ptbk.md`:
|
|
|
83
83
|
> - PROMPTBOOK VERSION 0.0.1
|
|
84
84
|
> - INPUT PARAM `{rawTitle}` Automatically suggested a site name or empty text
|
|
85
85
|
> - INPUT PARAM `{rawAssigment}` Automatically generated site entry from image recognition
|
|
86
|
-
> - OUTPUT PARAM `{
|
|
86
|
+
> - OUTPUT PARAM `{websiteContent}` Web content
|
|
87
87
|
> - OUTPUT PARAM `{keywords}` Keywords
|
|
88
88
|
>
|
|
89
89
|
> ## 👤 Specifying the assigment
|
|
@@ -242,7 +242,7 @@ File `write-website-content.ptbk.md`:
|
|
|
242
242
|
> {contentBody}
|
|
243
243
|
> ```
|
|
244
244
|
>
|
|
245
|
-
> `-> {
|
|
245
|
+
> `-> {websiteContent}`
|
|
246
246
|
|
|
247
247
|
|
|
248
248
|
|
|
@@ -282,7 +282,7 @@ flowchart LR
|
|
|
282
282
|
templateCombineTheBeginning--"{contentBeginning}"-->templateCombineTheContent
|
|
283
283
|
templateWriteTheContent--"{contentBody}"-->templateCombineTheContent
|
|
284
284
|
|
|
285
|
-
templateCombineTheContent--"{
|
|
285
|
+
templateCombineTheContent--"{websiteContent}"-->output
|
|
286
286
|
output((Output)):::output
|
|
287
287
|
|
|
288
288
|
classDef input color: grey;
|
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-
|
|
217
|
+
var PROMPTBOOK_VERSION = '0.61.0-24';
|
|
218
218
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
219
219
|
|
|
220
220
|
export { PROMPTBOOK_VERSION, RemoteLlmExecutionTools };
|
|
@@ -43,11 +43,15 @@ export declare const REPLACING_NONCE = "u$k42k%!V2zo34w7Fu#@QUHYPW";
|
|
|
43
43
|
/**
|
|
44
44
|
* The names of the parameters that are reserved for special purposes
|
|
45
45
|
*/
|
|
46
|
-
export declare const RESERVED_PARAMETER_NAMES: readonly ["context", "knowledge", "samples", "modelName", "currentDate"];
|
|
46
|
+
export declare const RESERVED_PARAMETER_NAMES: readonly ["content", "context", "knowledge", "samples", "modelName", "currentDate"];
|
|
47
47
|
/**
|
|
48
48
|
* @@@
|
|
49
49
|
*/
|
|
50
50
|
export declare const RESERVED_PARAMETER_MISSING_VALUE: string;
|
|
51
|
+
/**
|
|
52
|
+
* @@@
|
|
53
|
+
*/
|
|
54
|
+
export declare const RESERVED_PARAMETER_RESTRICTED: string;
|
|
51
55
|
/**
|
|
52
56
|
* @@@
|
|
53
57
|
*/
|
|
@@ -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
|
*/
|
|
@@ -7,7 +7,7 @@ import type { string_parameter_name } from '../../types/typeAliases';
|
|
|
7
7
|
* @returns the set of parameter names
|
|
8
8
|
* @throws {ParsingError} if the script is invalid
|
|
9
9
|
*/
|
|
10
|
-
export declare function extractParametersFromPromptTemplate(promptTemplate: Pick<PromptTemplateJson, 'title' | 'description' | 'blockType' | 'content' | 'jokerParameterNames'>): Set<string_parameter_name>;
|
|
10
|
+
export declare function extractParametersFromPromptTemplate(promptTemplate: Pick<PromptTemplateJson, 'title' | 'description' | 'blockType' | 'content' | 'preparedContent' | 'jokerParameterNames'>): Set<string_parameter_name>;
|
|
11
11
|
/**
|
|
12
12
|
* TODO: [🔣] If script require contentLanguage
|
|
13
13
|
*/
|
|
@@ -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
|
+
*/
|
|
@@ -47,6 +47,8 @@ interface CreatePipelineExecutorOptions {
|
|
|
47
47
|
export declare function createPipelineExecutor(options: CreatePipelineExecutorOptions): PipelineExecutor;
|
|
48
48
|
export {};
|
|
49
49
|
/**
|
|
50
|
+
* TODO: !!!! return `preparedPipeline` from execution
|
|
51
|
+
* TODO: !!!! `isNotPreparedWarningSupressed`
|
|
50
52
|
* TODO: Use isVerbose here (not only pass to `preparePipeline`)
|
|
51
53
|
* TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
|
|
52
54
|
* TODO: [♈] Probbably move expectations from templates to parameters
|
package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { string_markdown } from '../../../types/typeAliases';
|
|
|
4
4
|
/**
|
|
5
5
|
* @@@
|
|
6
6
|
*/
|
|
7
|
-
export declare function prepareKnowledgeFromMarkdown(
|
|
7
|
+
export declare function prepareKnowledgeFromMarkdown(knowledgeContent: string_markdown, options: PrepareOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>>>;
|
|
8
8
|
/**
|
|
9
9
|
* TODO: [🐝][🔼] !!! Export via `@promptbook/markdown`
|
|
10
10
|
* TODO: [🪂] Do it in parallel 11:11
|
|
@@ -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
|
*/
|
|
@@ -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
|
*/
|
|
@@ -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
|
|
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
|
*
|
|
@@ -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
|
|
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
|
|
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-
|
|
3
|
+
"version": "0.61.0-25",
|
|
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-
|
|
50
|
+
"@promptbook/core": "0.61.0-25"
|
|
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-
|
|
221
|
+
var PROMPTBOOK_VERSION = '0.61.0-24';
|
|
222
222
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
223
223
|
|
|
224
224
|
exports.PROMPTBOOK_VERSION = PROMPTBOOK_VERSION;
|
|
@@ -43,11 +43,15 @@ export declare const REPLACING_NONCE = "u$k42k%!V2zo34w7Fu#@QUHYPW";
|
|
|
43
43
|
/**
|
|
44
44
|
* The names of the parameters that are reserved for special purposes
|
|
45
45
|
*/
|
|
46
|
-
export declare const RESERVED_PARAMETER_NAMES: readonly ["context", "knowledge", "samples", "modelName", "currentDate"];
|
|
46
|
+
export declare const RESERVED_PARAMETER_NAMES: readonly ["content", "context", "knowledge", "samples", "modelName", "currentDate"];
|
|
47
47
|
/**
|
|
48
48
|
* @@@
|
|
49
49
|
*/
|
|
50
50
|
export declare const RESERVED_PARAMETER_MISSING_VALUE: string;
|
|
51
|
+
/**
|
|
52
|
+
* @@@
|
|
53
|
+
*/
|
|
54
|
+
export declare const RESERVED_PARAMETER_RESTRICTED: string;
|
|
51
55
|
/**
|
|
52
56
|
* @@@
|
|
53
57
|
*/
|
|
@@ -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
|
*/
|
|
@@ -7,7 +7,7 @@ import type { string_parameter_name } from '../../types/typeAliases';
|
|
|
7
7
|
* @returns the set of parameter names
|
|
8
8
|
* @throws {ParsingError} if the script is invalid
|
|
9
9
|
*/
|
|
10
|
-
export declare function extractParametersFromPromptTemplate(promptTemplate: Pick<PromptTemplateJson, 'title' | 'description' | 'blockType' | 'content' | 'jokerParameterNames'>): Set<string_parameter_name>;
|
|
10
|
+
export declare function extractParametersFromPromptTemplate(promptTemplate: Pick<PromptTemplateJson, 'title' | 'description' | 'blockType' | 'content' | 'preparedContent' | 'jokerParameterNames'>): Set<string_parameter_name>;
|
|
11
11
|
/**
|
|
12
12
|
* TODO: [🔣] If script require contentLanguage
|
|
13
13
|
*/
|
|
@@ -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
|
+
*/
|
|
@@ -47,6 +47,8 @@ interface CreatePipelineExecutorOptions {
|
|
|
47
47
|
export declare function createPipelineExecutor(options: CreatePipelineExecutorOptions): PipelineExecutor;
|
|
48
48
|
export {};
|
|
49
49
|
/**
|
|
50
|
+
* TODO: !!!! return `preparedPipeline` from execution
|
|
51
|
+
* TODO: !!!! `isNotPreparedWarningSupressed`
|
|
50
52
|
* TODO: Use isVerbose here (not only pass to `preparePipeline`)
|
|
51
53
|
* TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
|
|
52
54
|
* TODO: [♈] Probbably move expectations from templates to parameters
|
package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { string_markdown } from '../../../types/typeAliases';
|
|
|
4
4
|
/**
|
|
5
5
|
* @@@
|
|
6
6
|
*/
|
|
7
|
-
export declare function prepareKnowledgeFromMarkdown(
|
|
7
|
+
export declare function prepareKnowledgeFromMarkdown(knowledgeContent: string_markdown, options: PrepareOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>>>;
|
|
8
8
|
/**
|
|
9
9
|
* TODO: [🐝][🔼] !!! Export via `@promptbook/markdown`
|
|
10
10
|
* TODO: [🪂] Do it in parallel 11:11
|
|
@@ -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
|
*/
|
|
@@ -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
|
*/
|
|
@@ -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
|
|
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
|
*
|
|
@@ -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
|
|
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
|
|
7
|
+
export type SimpleTemplateJson = PromptTemplateJsonCommon & {
|
|
8
8
|
readonly blockType: 'SIMPLE_TEMPLATE';
|
|
9
|
-
}
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* TODO: [🍙] Make some standart order of json properties
|
|
12
|
+
*/
|