@promptbook/node 0.69.0-11 → 0.69.0-12
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/esm/index.es.js +55 -60
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +4 -0
- package/esm/typings/src/config.d.ts +7 -0
- package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorSettings.d.ts +7 -0
- package/esm/typings/src/formats/_common/FormatDefinition.d.ts +9 -6
- package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +4 -3
- package/esm/typings/src/formats/csv/CsvFormatDefinition.d.ts +3 -1
- package/esm/typings/src/formats/csv/CsvSettings.d.ts +5 -0
- package/esm/typings/src/formats/index.d.ts +1 -1
- package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +3 -2
- package/esm/typings/src/formats/text/TextFormatDefinition.d.ts +3 -1
- package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +3 -2
- package/esm/typings/src/utils/organization/{f.d.ts → empty_object.d.ts} +5 -1
- package/esm/typings/src/utils/organization/just_empty_object.d.ts +12 -0
- package/package.json +2 -2
- package/umd/index.umd.js +55 -60
- package/umd/index.umd.js.map +1 -1
|
@@ -17,6 +17,7 @@ import { PIPELINE_COLLECTION_BASE_FILENAME } from '../config';
|
|
|
17
17
|
import { RESERVED_PARAMETER_NAMES } from '../config';
|
|
18
18
|
import { DEFAULT_REMOTE_URL } from '../config';
|
|
19
19
|
import { DEFAULT_REMOTE_URL_PATH } from '../config';
|
|
20
|
+
import { DEFAULT_CSV_SETTINGS } from '../config';
|
|
20
21
|
import { IS_VERBOSE } from '../config';
|
|
21
22
|
import { pipelineJsonToString } from '../conversion/pipelineJsonToString';
|
|
22
23
|
import type { PipelineStringToJsonOptions } from '../conversion/pipelineStringToJson';
|
|
@@ -92,6 +93,7 @@ export { PIPELINE_COLLECTION_BASE_FILENAME };
|
|
|
92
93
|
export { RESERVED_PARAMETER_NAMES };
|
|
93
94
|
export { DEFAULT_REMOTE_URL };
|
|
94
95
|
export { DEFAULT_REMOTE_URL_PATH };
|
|
96
|
+
export { DEFAULT_CSV_SETTINGS };
|
|
95
97
|
export { IS_VERBOSE };
|
|
96
98
|
export { pipelineJsonToString };
|
|
97
99
|
export type { PipelineStringToJsonOptions };
|
|
@@ -36,6 +36,7 @@ import type { UncertainNumber } from '../execution/UncertainNumber';
|
|
|
36
36
|
import type { UserInterfaceTools } from '../execution/UserInterfaceTools';
|
|
37
37
|
import type { UserInterfaceToolsPromptDialogOptions } from '../execution/UserInterfaceTools';
|
|
38
38
|
import type { FormatSubvalueDefinition } from '../formats/_common/FormatSubvalueDefinition';
|
|
39
|
+
import type { CsvSettings } from '../formats/csv/CsvSettings';
|
|
39
40
|
import type { CallbackInterfaceToolsOptions } from '../knowledge/dialogs/callback/CallbackInterfaceToolsOptions';
|
|
40
41
|
import type { LlmToolsConfiguration } from '../llm-providers/_common/LlmToolsConfiguration';
|
|
41
42
|
import type { LlmToolsMetadata } from '../llm-providers/_common/LlmToolsMetadata';
|
|
@@ -224,6 +225,7 @@ import type { string_camelCase } from '../utils/normalization/normalizeTo_camelC
|
|
|
224
225
|
import type { string_PascalCase } from '../utils/normalization/normalizeTo_PascalCase';
|
|
225
226
|
import type { string_SCREAMING_CASE } from '../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
226
227
|
import type { string_snake_case } from '../utils/normalization/normalizeTo_snake_case';
|
|
228
|
+
import type { empty_object } from '../utils/organization/empty_object';
|
|
227
229
|
import type { really_any } from '../utils/organization/really_any';
|
|
228
230
|
import type { TODO_any } from '../utils/organization/TODO_any';
|
|
229
231
|
import type { string_promptbook_version } from '../version';
|
|
@@ -265,6 +267,7 @@ export type { UncertainNumber };
|
|
|
265
267
|
export type { UserInterfaceTools };
|
|
266
268
|
export type { UserInterfaceToolsPromptDialogOptions };
|
|
267
269
|
export type { FormatSubvalueDefinition };
|
|
270
|
+
export type { CsvSettings };
|
|
268
271
|
export type { CallbackInterfaceToolsOptions };
|
|
269
272
|
export type { LlmToolsConfiguration };
|
|
270
273
|
export type { LlmToolsMetadata };
|
|
@@ -453,6 +456,7 @@ export type { string_camelCase };
|
|
|
453
456
|
export type { string_PascalCase };
|
|
454
457
|
export type { string_SCREAMING_CASE };
|
|
455
458
|
export type { string_snake_case };
|
|
459
|
+
export type { empty_object };
|
|
456
460
|
export type { really_any };
|
|
457
461
|
export type { TODO_any };
|
|
458
462
|
export type { string_promptbook_version };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CsvSettings } from './formats/csv/CsvSettings';
|
|
1
2
|
/**
|
|
2
3
|
* Warning message for the generated sections and files files
|
|
3
4
|
*
|
|
@@ -137,6 +138,12 @@ export declare const DEFAULT_REMOTE_URL = "https://api.pavolhejny.com/";
|
|
|
137
138
|
* @public exported from `@promptbook/core`
|
|
138
139
|
*/
|
|
139
140
|
export declare const DEFAULT_REMOTE_URL_PATH = "/promptbook/socket.io";
|
|
141
|
+
/**
|
|
142
|
+
* @@@
|
|
143
|
+
*
|
|
144
|
+
* @public exported from `@promptbook/core`
|
|
145
|
+
*/
|
|
146
|
+
export declare const DEFAULT_CSV_SETTINGS: CsvSettings;
|
|
140
147
|
/**
|
|
141
148
|
* @@@
|
|
142
149
|
*
|
package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorSettings.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CsvSettings } from '../../formats/csv/CsvSettings';
|
|
1
2
|
export type CreatePipelineExecutorSettings = {
|
|
2
3
|
/**
|
|
3
4
|
* When executor does not satisfy expectations it will be retried this amount of times
|
|
@@ -17,6 +18,12 @@ export type CreatePipelineExecutorSettings = {
|
|
|
17
18
|
* @default false
|
|
18
19
|
*/
|
|
19
20
|
readonly isVerbose: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Settings for CSV format
|
|
23
|
+
*
|
|
24
|
+
* @default DEFAULT_CSV_SETTINGS
|
|
25
|
+
*/
|
|
26
|
+
readonly csvSettings: CsvSettings;
|
|
20
27
|
/**
|
|
21
28
|
* If you pass fully prepared pipeline, this does not matter
|
|
22
29
|
*
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import type { string_SCREAMING_CASE } from '../../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
2
1
|
import type { string_mime_type } from '../../types/typeAliases';
|
|
3
2
|
import type { string_name } from '../../types/typeAliases';
|
|
3
|
+
import type { string_SCREAMING_CASE } from '../../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
4
|
+
import type { empty_object } from '../../utils/organization/empty_object';
|
|
4
5
|
import type { FormatSubvalueDefinition } from './FormatSubvalueDefinition';
|
|
5
6
|
/**
|
|
6
7
|
* A format definition is a set of functions that define how to validate, heal and convert response from LLM
|
|
7
8
|
*
|
|
9
|
+
* @@@ Describe setting vs schema
|
|
10
|
+
*
|
|
8
11
|
* @see https://github.com/webgptorg/promptbook/discussions/36
|
|
9
12
|
* @private still in development [🏢]
|
|
10
13
|
*/
|
|
11
|
-
export type FormatDefinition<TValue extends TPartialValue, TPartialValue extends string, TSchema> = {
|
|
14
|
+
export type FormatDefinition<TValue extends TPartialValue, TPartialValue extends string, TSettings extends empty_object, TSchema extends empty_object> = {
|
|
12
15
|
/**
|
|
13
16
|
* The name of the format used in .ptbk.md files
|
|
14
17
|
*
|
|
@@ -31,7 +34,7 @@ export type FormatDefinition<TValue extends TPartialValue, TPartialValue extends
|
|
|
31
34
|
* @param value The value to check, for example "{\"foo\": true}"
|
|
32
35
|
* @param schema Optional schema to do extra validation
|
|
33
36
|
*/
|
|
34
|
-
isValid(value: string, schema?: TSchema): value is TValue;
|
|
37
|
+
isValid(value: string, settings?: TSettings, schema?: TSchema): value is TValue;
|
|
35
38
|
/**
|
|
36
39
|
* Check if a first part of a value is valid
|
|
37
40
|
*
|
|
@@ -40,7 +43,7 @@ export type FormatDefinition<TValue extends TPartialValue, TPartialValue extends
|
|
|
40
43
|
* @param partialValue Partial value to check, for example "{\"foo\": t"
|
|
41
44
|
* @param schema Optional schema to do extra validation
|
|
42
45
|
*/
|
|
43
|
-
canBeValid(partialValue: string, schema?: TSchema): partialValue is TPartialValue;
|
|
46
|
+
canBeValid(partialValue: string, settings?: TSettings, schema?: TSchema): partialValue is TPartialValue;
|
|
44
47
|
/**
|
|
45
48
|
* Heal a value to make it valid if possible
|
|
46
49
|
*
|
|
@@ -51,11 +54,11 @@ export type FormatDefinition<TValue extends TPartialValue, TPartialValue extends
|
|
|
51
54
|
* @param scheme
|
|
52
55
|
* @throws {Error} If the value cannot be healed
|
|
53
56
|
*/
|
|
54
|
-
heal(value: string, scheme?: TSchema): TValue;
|
|
57
|
+
heal(value: string, settings?: TSettings, scheme?: TSchema): TValue;
|
|
55
58
|
/**
|
|
56
59
|
* @@@
|
|
57
60
|
*/
|
|
58
|
-
readonly subvalueDefinitions: Array<FormatSubvalueDefinition<TValue>>;
|
|
61
|
+
readonly subvalueDefinitions: Array<FormatSubvalueDefinition<TValue, TSettings>>;
|
|
59
62
|
};
|
|
60
63
|
/**
|
|
61
64
|
* TODO: [🧠][🦥] Better (less confusing) name for "cell" / "subvalue" / "subparameter"
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { Promisable } from 'type-fest';
|
|
2
|
-
import type { string_SCREAMING_CASE } from '../../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
3
2
|
import type { Parameters } from '../../types/typeAliases';
|
|
4
3
|
import type { string_name } from '../../types/typeAliases';
|
|
4
|
+
import type { string_SCREAMING_CASE } from '../../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
5
|
+
import type { empty_object } from '../../utils/organization/empty_object';
|
|
5
6
|
/**
|
|
6
7
|
* @@@
|
|
7
8
|
*/
|
|
8
|
-
export type FormatSubvalueDefinition<TValue extends string> = {
|
|
9
|
+
export type FormatSubvalueDefinition<TValue extends string, TSettings extends empty_object> = {
|
|
9
10
|
/**
|
|
10
11
|
* The name of the format used in .ptbk.md files
|
|
11
12
|
*
|
|
@@ -22,7 +23,7 @@ export type FormatSubvalueDefinition<TValue extends string> = {
|
|
|
22
23
|
* For example, if you have a JSON object and you want to map all values to uppercase
|
|
23
24
|
* Or iterate over all CSV cells @@@
|
|
24
25
|
*/
|
|
25
|
-
mapValues(value: TValue, mapCallback: (subvalues: Parameters, index: number) => Promisable<string>): Promise<string>;
|
|
26
|
+
mapValues(value: TValue, settings: TSettings, mapCallback: (subvalues: Parameters, index: number) => Promisable<string>): Promise<string>;
|
|
26
27
|
};
|
|
27
28
|
/**
|
|
28
29
|
* TODO: [🧠][🦥] Better (less confusing) name for "cell" / "subvalue" / "subparameter"
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import type { TODO_any } from '../../utils/organization/TODO_any';
|
|
1
2
|
import type { FormatDefinition } from '../_common/FormatDefinition';
|
|
3
|
+
import type { CsvSettings } from './CsvSettings';
|
|
2
4
|
/**
|
|
3
5
|
* Definition for CSV spreadsheet
|
|
4
6
|
*
|
|
5
7
|
* @public exported from `@promptbook/core`
|
|
6
8
|
* <- TODO: [🏢] Export from package `@promptbook/csv`
|
|
7
9
|
*/
|
|
8
|
-
export declare const CsvFormatDefinition: FormatDefinition<string, string,
|
|
10
|
+
export declare const CsvFormatDefinition: FormatDefinition<string, string, CsvSettings, TODO_any>;
|
|
9
11
|
/**
|
|
10
12
|
* TODO: [🍓] In `CsvFormatDefinition` implement simple `isValid`
|
|
11
13
|
* TODO: [🍓] In `CsvFormatDefinition` implement partial `canBeValid`
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @private internal index of `...` <- TODO [🏢]
|
|
5
5
|
*/
|
|
6
|
-
export declare const FORMAT_DEFINITIONS: readonly [import("./_common/FormatDefinition").FormatDefinition<string, string,
|
|
6
|
+
export declare const FORMAT_DEFINITIONS: readonly [import("./_common/FormatDefinition").FormatDefinition<string, string, any, any>, import("./_common/FormatDefinition").FormatDefinition<string, string, any, any>, import("./_common/FormatDefinition").FormatDefinition<string, string, any, any>, import("./_common/FormatDefinition").FormatDefinition<string, string, import("./csv/CsvSettings").CsvSettings, any>];
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import type { TODO_any } from '../../utils/organization/TODO_any';
|
|
1
2
|
import type { FormatDefinition } from '../_common/FormatDefinition';
|
|
2
3
|
/**
|
|
3
4
|
* Definition for JSON format
|
|
4
5
|
*
|
|
5
6
|
* @private still in development [🏢]
|
|
6
7
|
*/
|
|
7
|
-
export declare const JsonFormatDefinition: FormatDefinition<string, string,
|
|
8
|
+
export declare const JsonFormatDefinition: FormatDefinition<string, string, TODO_any, TODO_any>;
|
|
8
9
|
/**
|
|
9
10
|
* TODO: [🧠] Maybe propper instance of object
|
|
10
11
|
* TODO: [0] Make string_serialized_json
|
|
11
|
-
* TODO: [1] Make type for JSON Schema
|
|
12
|
+
* TODO: [1] Make type for JSON Settings and Schema
|
|
12
13
|
* TODO: [🧠] What to use for validating JSONs - JSON Schema, ZoD, typescript types/interfaces,...?
|
|
13
14
|
* TODO: [🍓] In `JsonFormatDefinition` implement simple `isValid`
|
|
14
15
|
* TODO: [🍓] In `JsonFormatDefinition` implement partial `canBeValid`
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TODO_any } from '../../utils/organization/TODO_any';
|
|
1
2
|
import type { FormatDefinition } from '../_common/FormatDefinition';
|
|
2
3
|
/**
|
|
3
4
|
* Definition for any text - this will be always valid
|
|
@@ -6,8 +7,9 @@ import type { FormatDefinition } from '../_common/FormatDefinition';
|
|
|
6
7
|
*
|
|
7
8
|
* @public exported from `@promptbook/core`
|
|
8
9
|
*/
|
|
9
|
-
export declare const TextFormatDefinition: FormatDefinition<string, string,
|
|
10
|
+
export declare const TextFormatDefinition: FormatDefinition<string, string, TODO_any, TODO_any>;
|
|
10
11
|
/**
|
|
12
|
+
* TODO: [1] Make type for XML Text and Schema
|
|
11
13
|
* TODO: [🧠][🤠] Here should be all words, characters, lines, paragraphs, pages aviable as subvalues
|
|
12
14
|
* TODO: [🍓] In `TextFormatDefinition` implement simple `isValid`
|
|
13
15
|
* TODO: [🍓] In `TextFormatDefinition` implement partial `canBeValid`
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import type { TODO_any } from '../../utils/organization/TODO_any';
|
|
1
2
|
import type { FormatDefinition } from '../_common/FormatDefinition';
|
|
2
3
|
/**
|
|
3
4
|
* Definition for XML format
|
|
4
5
|
*
|
|
5
6
|
* @private still in development [🏢]
|
|
6
7
|
*/
|
|
7
|
-
export declare const XmlFormatDefinition: FormatDefinition<string, string,
|
|
8
|
+
export declare const XmlFormatDefinition: FormatDefinition<string, string, TODO_any, TODO_any>;
|
|
8
9
|
/**
|
|
9
10
|
* TODO: [🧠] Maybe propper instance of object
|
|
10
11
|
* TODO: [0] Make string_serialized_xml
|
|
11
|
-
* TODO: [1] Make type for XML Schema
|
|
12
|
+
* TODO: [1] Make type for XML Settings and Schema
|
|
12
13
|
* TODO: [🧠] What to use for validating XMLs - XSD,...
|
|
13
14
|
* TODO: [🍓] In `XmlFormatDefinition` implement simple `isValid`
|
|
14
15
|
* TODO: [🍓] In `XmlFormatDefinition` implement partial `canBeValid`
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Organizational helper to better mark the place where to really use empty object `{}`
|
|
3
3
|
*
|
|
4
|
+
* Note: There are 2 similar types>
|
|
5
|
+
* - `empty_object` @@@
|
|
6
|
+
* - `just_empty_object` @@@
|
|
7
|
+
*
|
|
4
8
|
* @private within the repository
|
|
5
9
|
*/
|
|
6
|
-
export type
|
|
10
|
+
export type empty_object = {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Organizational helper to better @@@@
|
|
3
|
+
*
|
|
4
|
+
* Note: There are 2 similar types>
|
|
5
|
+
* - `empty_object` @@@
|
|
6
|
+
* - `just_empty_object` @@@
|
|
7
|
+
*
|
|
8
|
+
* Note: In most cases, you should use `empty_object`
|
|
9
|
+
*
|
|
10
|
+
* @private within the repository
|
|
11
|
+
*/
|
|
12
|
+
export type just_empty_object = Record<string, never>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/node",
|
|
3
|
-
"version": "0.69.0-
|
|
3
|
+
"version": "0.69.0-12",
|
|
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/node.index.d.ts",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@promptbook/core": "0.69.0-
|
|
50
|
+
"@promptbook/core": "0.69.0-12"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
/**
|
|
36
36
|
* The version of the Promptbook library
|
|
37
37
|
*/
|
|
38
|
-
var PROMPTBOOK_VERSION = '0.69.0-
|
|
38
|
+
var PROMPTBOOK_VERSION = '0.69.0-11';
|
|
39
39
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
40
40
|
|
|
41
41
|
/*! *****************************************************************************
|
|
@@ -442,6 +442,19 @@
|
|
|
442
442
|
*/
|
|
443
443
|
var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
|
|
444
444
|
// <- TODO: [🧜♂️]
|
|
445
|
+
/**
|
|
446
|
+
* @@@
|
|
447
|
+
*
|
|
448
|
+
* @public exported from `@promptbook/core`
|
|
449
|
+
*/
|
|
450
|
+
var DEFAULT_CSV_SETTINGS = {
|
|
451
|
+
header: true,
|
|
452
|
+
delimiter: ',',
|
|
453
|
+
quoteChar: '"',
|
|
454
|
+
newline: '\n',
|
|
455
|
+
skipEmptyLines: true,
|
|
456
|
+
// encoding: 'utf8'
|
|
457
|
+
};
|
|
445
458
|
/**
|
|
446
459
|
* @@@
|
|
447
460
|
*
|
|
@@ -905,7 +918,7 @@
|
|
|
905
918
|
});
|
|
906
919
|
}
|
|
907
920
|
|
|
908
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.69.0-
|
|
921
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.69.0-11",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.69.0-11",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.69.0-11",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.69.0-11",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
|
|
909
922
|
|
|
910
923
|
/**
|
|
911
924
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -2661,41 +2674,36 @@
|
|
|
2661
2674
|
var CsvFormatDefinition = {
|
|
2662
2675
|
formatName: 'CSV',
|
|
2663
2676
|
aliases: ['SPREADSHEET', 'TABLE'],
|
|
2664
|
-
isValid: function (value, schema) {
|
|
2677
|
+
isValid: function (value, settings, schema) {
|
|
2678
|
+
// TODO: !!!!!! Implement CSV validation
|
|
2665
2679
|
TODO_USE(value /* <- TODO: Use value here */);
|
|
2680
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2666
2681
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2667
2682
|
return true;
|
|
2668
2683
|
},
|
|
2669
|
-
canBeValid: function (partialValue, schema) {
|
|
2684
|
+
canBeValid: function (partialValue, settings, schema) {
|
|
2670
2685
|
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
2686
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2671
2687
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2672
2688
|
return true;
|
|
2673
2689
|
},
|
|
2674
|
-
heal: function (value, schema) {
|
|
2690
|
+
heal: function (value, settings, schema) {
|
|
2675
2691
|
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
2692
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2676
2693
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2677
2694
|
throw new Error('Not implemented');
|
|
2678
2695
|
},
|
|
2679
2696
|
subvalueDefinitions: [
|
|
2680
2697
|
{
|
|
2681
2698
|
subvalueName: 'ROW',
|
|
2682
|
-
mapValues: function (value, mapCallback) {
|
|
2699
|
+
mapValues: function (value, settings, mapCallback) {
|
|
2683
2700
|
return __awaiter(this, void 0, void 0, function () {
|
|
2684
2701
|
var csv, mappedData;
|
|
2685
2702
|
var _this = this;
|
|
2686
2703
|
return __generator(this, function (_a) {
|
|
2687
2704
|
switch (_a.label) {
|
|
2688
2705
|
case 0:
|
|
2689
|
-
csv = papaparse.parse(value,
|
|
2690
|
-
header: true,
|
|
2691
|
-
delimiter: ',',
|
|
2692
|
-
quoteChar: '"',
|
|
2693
|
-
newline: '\r\n',
|
|
2694
|
-
skipEmptyLines: true,
|
|
2695
|
-
// encoding: 'utf8',
|
|
2696
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
2697
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
2698
|
-
});
|
|
2706
|
+
csv = papaparse.parse(value, settings);
|
|
2699
2707
|
if (csv.errors.length !== 0) {
|
|
2700
2708
|
throw new ParseError(// <- TODO: !!!!!! Split PipelineParseError and FormatParseError -> CsvParseError
|
|
2701
2709
|
spaceTrim__default["default"](function (block) { return "\n CSV parsing error\n\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n "); }));
|
|
@@ -2709,25 +2717,18 @@
|
|
|
2709
2717
|
_a = [__assign({}, row)];
|
|
2710
2718
|
_b = {};
|
|
2711
2719
|
// <- TODO: !!!!!! Dynamic new column name and position
|
|
2720
|
+
// <- TODO: !!!!!! Check name collisions
|
|
2712
2721
|
return [4 /*yield*/, mapCallback(row, index)];
|
|
2713
2722
|
case 1: return [2 /*return*/, (__assign.apply(void 0, _a.concat([(_b.newColumn =
|
|
2714
2723
|
// <- TODO: !!!!!! Dynamic new column name and position
|
|
2724
|
+
// <- TODO: !!!!!! Check name collisions
|
|
2715
2725
|
_c.sent(), _b)])))];
|
|
2716
2726
|
}
|
|
2717
2727
|
});
|
|
2718
2728
|
}); }))];
|
|
2719
2729
|
case 1:
|
|
2720
2730
|
mappedData = _a.sent();
|
|
2721
|
-
return [2 /*return*/, papaparse.unparse(mappedData,
|
|
2722
|
-
header: true,
|
|
2723
|
-
delimiter: ',',
|
|
2724
|
-
quoteChar: '"',
|
|
2725
|
-
newline: '\r\n',
|
|
2726
|
-
skipEmptyLines: true,
|
|
2727
|
-
// encoding: 'utf8',
|
|
2728
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
2729
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
2730
|
-
})];
|
|
2731
|
+
return [2 /*return*/, papaparse.unparse(mappedData, settings)];
|
|
2731
2732
|
}
|
|
2732
2733
|
});
|
|
2733
2734
|
});
|
|
@@ -2735,23 +2736,14 @@
|
|
|
2735
2736
|
},
|
|
2736
2737
|
{
|
|
2737
2738
|
subvalueName: 'CELL',
|
|
2738
|
-
mapValues: function (value, mapCallback) {
|
|
2739
|
+
mapValues: function (value, settings, mapCallback) {
|
|
2739
2740
|
return __awaiter(this, void 0, void 0, function () {
|
|
2740
2741
|
var csv, mappedData;
|
|
2741
2742
|
var _this = this;
|
|
2742
2743
|
return __generator(this, function (_a) {
|
|
2743
2744
|
switch (_a.label) {
|
|
2744
2745
|
case 0:
|
|
2745
|
-
csv = papaparse.parse(value,
|
|
2746
|
-
header: true,
|
|
2747
|
-
delimiter: ',',
|
|
2748
|
-
quoteChar: '"',
|
|
2749
|
-
newline: '\r\n',
|
|
2750
|
-
skipEmptyLines: true,
|
|
2751
|
-
// encoding: 'utf8',
|
|
2752
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
2753
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
2754
|
-
});
|
|
2746
|
+
csv = papaparse.parse(value, settings);
|
|
2755
2747
|
if (csv.errors.length !== 0) {
|
|
2756
2748
|
throw new ParseError(// <- TODO: !!!!!! Split PipelineParseError and FormatParseError -> CsvParseError
|
|
2757
2749
|
spaceTrim__default["default"](function (block) { return "\n CSV parsing error\n\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n "); }));
|
|
@@ -2774,16 +2766,7 @@
|
|
|
2774
2766
|
}); }))];
|
|
2775
2767
|
case 1:
|
|
2776
2768
|
mappedData = _a.sent();
|
|
2777
|
-
return [2 /*return*/, papaparse.unparse(mappedData,
|
|
2778
|
-
header: true,
|
|
2779
|
-
delimiter: ',',
|
|
2780
|
-
quoteChar: '"',
|
|
2781
|
-
newline: '\r\n',
|
|
2782
|
-
skipEmptyLines: true,
|
|
2783
|
-
// encoding: 'utf8',
|
|
2784
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
2785
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
2786
|
-
})];
|
|
2769
|
+
return [2 /*return*/, papaparse.unparse(mappedData, settings)];
|
|
2787
2770
|
}
|
|
2788
2771
|
});
|
|
2789
2772
|
});
|
|
@@ -2828,17 +2811,20 @@
|
|
|
2828
2811
|
var JsonFormatDefinition = {
|
|
2829
2812
|
formatName: 'JSON',
|
|
2830
2813
|
mimeType: 'application/json',
|
|
2831
|
-
isValid: function (value, schema) {
|
|
2814
|
+
isValid: function (value, settings, schema) {
|
|
2832
2815
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2816
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2833
2817
|
return isValidJsonString(value);
|
|
2834
2818
|
},
|
|
2835
|
-
canBeValid: function (partialValue, schema) {
|
|
2819
|
+
canBeValid: function (partialValue, settings, schema) {
|
|
2836
2820
|
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
2821
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2837
2822
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2838
2823
|
return true;
|
|
2839
2824
|
},
|
|
2840
|
-
heal: function (value, schema) {
|
|
2825
|
+
heal: function (value, settings, schema) {
|
|
2841
2826
|
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
2827
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2842
2828
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2843
2829
|
throw new Error('Not implemented');
|
|
2844
2830
|
},
|
|
@@ -2847,7 +2833,7 @@
|
|
|
2847
2833
|
/**
|
|
2848
2834
|
* TODO: [🧠] Maybe propper instance of object
|
|
2849
2835
|
* TODO: [0] Make string_serialized_json
|
|
2850
|
-
* TODO: [1] Make type for JSON Schema
|
|
2836
|
+
* TODO: [1] Make type for JSON Settings and Schema
|
|
2851
2837
|
* TODO: [🧠] What to use for validating JSONs - JSON Schema, ZoD, typescript types/interfaces,...?
|
|
2852
2838
|
* TODO: [🍓] In `JsonFormatDefinition` implement simple `isValid`
|
|
2853
2839
|
* TODO: [🍓] In `JsonFormatDefinition` implement partial `canBeValid`
|
|
@@ -2877,7 +2863,7 @@
|
|
|
2877
2863
|
subvalueDefinitions: [
|
|
2878
2864
|
{
|
|
2879
2865
|
subvalueName: 'LINE',
|
|
2880
|
-
mapValues: function (value, mapCallback) {
|
|
2866
|
+
mapValues: function (value, settings, mapCallback) {
|
|
2881
2867
|
return __awaiter(this, void 0, void 0, function () {
|
|
2882
2868
|
var lines, mappedLines;
|
|
2883
2869
|
return __generator(this, function (_a) {
|
|
@@ -2903,6 +2889,7 @@
|
|
|
2903
2889
|
],
|
|
2904
2890
|
};
|
|
2905
2891
|
/**
|
|
2892
|
+
* TODO: [1] Make type for XML Text and Schema
|
|
2906
2893
|
* TODO: [🧠][🤠] Here should be all words, characters, lines, paragraphs, pages aviable as subvalues
|
|
2907
2894
|
* TODO: [🍓] In `TextFormatDefinition` implement simple `isValid`
|
|
2908
2895
|
* TODO: [🍓] In `TextFormatDefinition` implement partial `canBeValid`
|
|
@@ -2919,18 +2906,21 @@
|
|
|
2919
2906
|
var XmlFormatDefinition = {
|
|
2920
2907
|
formatName: 'XML',
|
|
2921
2908
|
mimeType: 'application/xml',
|
|
2922
|
-
isValid: function (value, schema) {
|
|
2909
|
+
isValid: function (value, settings, schema) {
|
|
2923
2910
|
TODO_USE(value /* <- TODO: Use value here */);
|
|
2911
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2924
2912
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2925
2913
|
return true;
|
|
2926
2914
|
},
|
|
2927
|
-
canBeValid: function (partialValue, schema) {
|
|
2915
|
+
canBeValid: function (partialValue, settings, schema) {
|
|
2928
2916
|
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
2917
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2929
2918
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2930
2919
|
return true;
|
|
2931
2920
|
},
|
|
2932
|
-
heal: function (value, schema) {
|
|
2921
|
+
heal: function (value, settings, schema) {
|
|
2933
2922
|
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
2923
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2934
2924
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2935
2925
|
throw new Error('Not implemented');
|
|
2936
2926
|
},
|
|
@@ -2939,7 +2929,7 @@
|
|
|
2939
2929
|
/**
|
|
2940
2930
|
* TODO: [🧠] Maybe propper instance of object
|
|
2941
2931
|
* TODO: [0] Make string_serialized_xml
|
|
2942
|
-
* TODO: [1] Make type for XML Schema
|
|
2932
|
+
* TODO: [1] Make type for XML Settings and Schema
|
|
2943
2933
|
* TODO: [🧠] What to use for validating XMLs - XSD,...
|
|
2944
2934
|
* TODO: [🍓] In `XmlFormatDefinition` implement simple `isValid`
|
|
2945
2935
|
* TODO: [🍓] In `XmlFormatDefinition` implement partial `canBeValid`
|
|
@@ -3757,12 +3747,12 @@
|
|
|
3757
3747
|
*/
|
|
3758
3748
|
function executeFormatCells(options) {
|
|
3759
3749
|
return __awaiter(this, void 0, void 0, function () {
|
|
3760
|
-
var template, jokerParameterNames, parameters, priority, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, resultString;
|
|
3750
|
+
var template, jokerParameterNames, parameters, priority, pipelineIdentification, settings, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
|
|
3761
3751
|
var _this = this;
|
|
3762
3752
|
return __generator(this, function (_a) {
|
|
3763
3753
|
switch (_a.label) {
|
|
3764
3754
|
case 0:
|
|
3765
|
-
template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, pipelineIdentification = options.pipelineIdentification;
|
|
3755
|
+
template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, pipelineIdentification = options.pipelineIdentification, settings = options.settings;
|
|
3766
3756
|
if (template.foreach === undefined) {
|
|
3767
3757
|
return [2 /*return*/, /* not await */ executeAttempts(options)];
|
|
3768
3758
|
}
|
|
@@ -3791,7 +3781,11 @@
|
|
|
3791
3781
|
.map(function (subvalueName) { return "- ".concat(subvalueName); })
|
|
3792
3782
|
.join('\n')), "\n\n [\u26F7] This should never happen because cell name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
3793
3783
|
}
|
|
3794
|
-
|
|
3784
|
+
if (formatDefinition.formatName === 'CSV') {
|
|
3785
|
+
formatSettings = settings.csvSettings;
|
|
3786
|
+
// <- TODO: !!!!!! More universal, make simmilar pattern for other formats for example \n vs \r\n in text
|
|
3787
|
+
}
|
|
3788
|
+
return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
3795
3789
|
var mappedParameters, allSubparameters, subresultString;
|
|
3796
3790
|
return __generator(this, function (_a) {
|
|
3797
3791
|
switch (_a.label) {
|
|
@@ -4426,7 +4420,7 @@
|
|
|
4426
4420
|
function createPipelineExecutor(options) {
|
|
4427
4421
|
var _this = this;
|
|
4428
4422
|
var pipeline = options.pipeline, tools = options.tools, _a = options.settings, settings = _a === void 0 ? {} : _a;
|
|
4429
|
-
var _b = settings.maxExecutionAttempts, maxExecutionAttempts = _b === void 0 ? MAX_EXECUTION_ATTEMPTS : _b, _c = settings.maxParallelCount, maxParallelCount = _c === void 0 ? MAX_PARALLEL_COUNT : _c, _d = settings.
|
|
4423
|
+
var _b = settings.maxExecutionAttempts, maxExecutionAttempts = _b === void 0 ? MAX_EXECUTION_ATTEMPTS : _b, _c = settings.maxParallelCount, maxParallelCount = _c === void 0 ? MAX_PARALLEL_COUNT : _c, _d = settings.csvSettings, csvSettings = _d === void 0 ? DEFAULT_CSV_SETTINGS : _d, _e = settings.isVerbose, isVerbose = _e === void 0 ? IS_VERBOSE : _e, _f = settings.isNotPreparedWarningSupressed, isNotPreparedWarningSupressed = _f === void 0 ? false : _f;
|
|
4430
4424
|
validatePipeline(pipeline);
|
|
4431
4425
|
var pipelineIdentification = (function () {
|
|
4432
4426
|
// Note: This is a 😐 implementation of [🚞]
|
|
@@ -4461,6 +4455,7 @@
|
|
|
4461
4455
|
settings: {
|
|
4462
4456
|
maxExecutionAttempts: maxExecutionAttempts,
|
|
4463
4457
|
maxParallelCount: maxParallelCount,
|
|
4458
|
+
csvSettings: csvSettings,
|
|
4464
4459
|
isVerbose: isVerbose,
|
|
4465
4460
|
isNotPreparedWarningSupressed: isNotPreparedWarningSupressed,
|
|
4466
4461
|
},
|