@promptbook/core 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 +56 -61
- 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 +1 -1
- package/umd/index.umd.js +56 -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
package/umd/index.umd.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
/**
|
|
17
17
|
* The version of the Promptbook library
|
|
18
18
|
*/
|
|
19
|
-
var PROMPTBOOK_VERSION = '0.69.0-
|
|
19
|
+
var PROMPTBOOK_VERSION = '0.69.0-11';
|
|
20
20
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
21
21
|
|
|
22
22
|
/*! *****************************************************************************
|
|
@@ -753,6 +753,19 @@
|
|
|
753
753
|
*/
|
|
754
754
|
var DEFAULT_REMOTE_URL_PATH = '/promptbook/socket.io';
|
|
755
755
|
// <- TODO: [🧜♂️]
|
|
756
|
+
/**
|
|
757
|
+
* @@@
|
|
758
|
+
*
|
|
759
|
+
* @public exported from `@promptbook/core`
|
|
760
|
+
*/
|
|
761
|
+
var DEFAULT_CSV_SETTINGS = {
|
|
762
|
+
header: true,
|
|
763
|
+
delimiter: ',',
|
|
764
|
+
quoteChar: '"',
|
|
765
|
+
newline: '\n',
|
|
766
|
+
skipEmptyLines: true,
|
|
767
|
+
// encoding: 'utf8'
|
|
768
|
+
};
|
|
756
769
|
/**
|
|
757
770
|
* @@@
|
|
758
771
|
*
|
|
@@ -1824,7 +1837,7 @@
|
|
|
1824
1837
|
});
|
|
1825
1838
|
}
|
|
1826
1839
|
|
|
1827
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.69.0-
|
|
1840
|
+
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"}];
|
|
1828
1841
|
|
|
1829
1842
|
var defaultDiacriticsRemovalMap = [
|
|
1830
1843
|
{
|
|
@@ -2944,41 +2957,36 @@
|
|
|
2944
2957
|
var CsvFormatDefinition = {
|
|
2945
2958
|
formatName: 'CSV',
|
|
2946
2959
|
aliases: ['SPREADSHEET', 'TABLE'],
|
|
2947
|
-
isValid: function (value, schema) {
|
|
2960
|
+
isValid: function (value, settings, schema) {
|
|
2961
|
+
// TODO: !!!!!! Implement CSV validation
|
|
2948
2962
|
TODO_USE(value /* <- TODO: Use value here */);
|
|
2963
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2949
2964
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2950
2965
|
return true;
|
|
2951
2966
|
},
|
|
2952
|
-
canBeValid: function (partialValue, schema) {
|
|
2967
|
+
canBeValid: function (partialValue, settings, schema) {
|
|
2953
2968
|
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
2969
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2954
2970
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2955
2971
|
return true;
|
|
2956
2972
|
},
|
|
2957
|
-
heal: function (value, schema) {
|
|
2973
|
+
heal: function (value, settings, schema) {
|
|
2958
2974
|
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
2975
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2959
2976
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2960
2977
|
throw new Error('Not implemented');
|
|
2961
2978
|
},
|
|
2962
2979
|
subvalueDefinitions: [
|
|
2963
2980
|
{
|
|
2964
2981
|
subvalueName: 'ROW',
|
|
2965
|
-
mapValues: function (value, mapCallback) {
|
|
2982
|
+
mapValues: function (value, settings, mapCallback) {
|
|
2966
2983
|
return __awaiter(this, void 0, void 0, function () {
|
|
2967
2984
|
var csv, mappedData;
|
|
2968
2985
|
var _this = this;
|
|
2969
2986
|
return __generator(this, function (_a) {
|
|
2970
2987
|
switch (_a.label) {
|
|
2971
2988
|
case 0:
|
|
2972
|
-
csv = papaparse.parse(value,
|
|
2973
|
-
header: true,
|
|
2974
|
-
delimiter: ',',
|
|
2975
|
-
quoteChar: '"',
|
|
2976
|
-
newline: '\r\n',
|
|
2977
|
-
skipEmptyLines: true,
|
|
2978
|
-
// encoding: 'utf8',
|
|
2979
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
2980
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
2981
|
-
});
|
|
2989
|
+
csv = papaparse.parse(value, settings);
|
|
2982
2990
|
if (csv.errors.length !== 0) {
|
|
2983
2991
|
throw new ParseError(// <- TODO: !!!!!! Split PipelineParseError and FormatParseError -> CsvParseError
|
|
2984
2992
|
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 "); }));
|
|
@@ -2992,25 +3000,18 @@
|
|
|
2992
3000
|
_a = [__assign({}, row)];
|
|
2993
3001
|
_b = {};
|
|
2994
3002
|
// <- TODO: !!!!!! Dynamic new column name and position
|
|
3003
|
+
// <- TODO: !!!!!! Check name collisions
|
|
2995
3004
|
return [4 /*yield*/, mapCallback(row, index)];
|
|
2996
3005
|
case 1: return [2 /*return*/, (__assign.apply(void 0, _a.concat([(_b.newColumn =
|
|
2997
3006
|
// <- TODO: !!!!!! Dynamic new column name and position
|
|
3007
|
+
// <- TODO: !!!!!! Check name collisions
|
|
2998
3008
|
_c.sent(), _b)])))];
|
|
2999
3009
|
}
|
|
3000
3010
|
});
|
|
3001
3011
|
}); }))];
|
|
3002
3012
|
case 1:
|
|
3003
3013
|
mappedData = _a.sent();
|
|
3004
|
-
return [2 /*return*/, papaparse.unparse(mappedData,
|
|
3005
|
-
header: true,
|
|
3006
|
-
delimiter: ',',
|
|
3007
|
-
quoteChar: '"',
|
|
3008
|
-
newline: '\r\n',
|
|
3009
|
-
skipEmptyLines: true,
|
|
3010
|
-
// encoding: 'utf8',
|
|
3011
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
3012
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
3013
|
-
})];
|
|
3014
|
+
return [2 /*return*/, papaparse.unparse(mappedData, settings)];
|
|
3014
3015
|
}
|
|
3015
3016
|
});
|
|
3016
3017
|
});
|
|
@@ -3018,23 +3019,14 @@
|
|
|
3018
3019
|
},
|
|
3019
3020
|
{
|
|
3020
3021
|
subvalueName: 'CELL',
|
|
3021
|
-
mapValues: function (value, mapCallback) {
|
|
3022
|
+
mapValues: function (value, settings, mapCallback) {
|
|
3022
3023
|
return __awaiter(this, void 0, void 0, function () {
|
|
3023
3024
|
var csv, mappedData;
|
|
3024
3025
|
var _this = this;
|
|
3025
3026
|
return __generator(this, function (_a) {
|
|
3026
3027
|
switch (_a.label) {
|
|
3027
3028
|
case 0:
|
|
3028
|
-
csv = papaparse.parse(value,
|
|
3029
|
-
header: true,
|
|
3030
|
-
delimiter: ',',
|
|
3031
|
-
quoteChar: '"',
|
|
3032
|
-
newline: '\r\n',
|
|
3033
|
-
skipEmptyLines: true,
|
|
3034
|
-
// encoding: 'utf8',
|
|
3035
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
3036
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
3037
|
-
});
|
|
3029
|
+
csv = papaparse.parse(value, settings);
|
|
3038
3030
|
if (csv.errors.length !== 0) {
|
|
3039
3031
|
throw new ParseError(// <- TODO: !!!!!! Split PipelineParseError and FormatParseError -> CsvParseError
|
|
3040
3032
|
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 "); }));
|
|
@@ -3057,16 +3049,7 @@
|
|
|
3057
3049
|
}); }))];
|
|
3058
3050
|
case 1:
|
|
3059
3051
|
mappedData = _a.sent();
|
|
3060
|
-
return [2 /*return*/, papaparse.unparse(mappedData,
|
|
3061
|
-
header: true,
|
|
3062
|
-
delimiter: ',',
|
|
3063
|
-
quoteChar: '"',
|
|
3064
|
-
newline: '\r\n',
|
|
3065
|
-
skipEmptyLines: true,
|
|
3066
|
-
// encoding: 'utf8',
|
|
3067
|
-
// <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
|
|
3068
|
-
// <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
|
|
3069
|
-
})];
|
|
3052
|
+
return [2 /*return*/, papaparse.unparse(mappedData, settings)];
|
|
3070
3053
|
}
|
|
3071
3054
|
});
|
|
3072
3055
|
});
|
|
@@ -3111,17 +3094,20 @@
|
|
|
3111
3094
|
var JsonFormatDefinition = {
|
|
3112
3095
|
formatName: 'JSON',
|
|
3113
3096
|
mimeType: 'application/json',
|
|
3114
|
-
isValid: function (value, schema) {
|
|
3097
|
+
isValid: function (value, settings, schema) {
|
|
3115
3098
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3099
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3116
3100
|
return isValidJsonString(value);
|
|
3117
3101
|
},
|
|
3118
|
-
canBeValid: function (partialValue, schema) {
|
|
3102
|
+
canBeValid: function (partialValue, settings, schema) {
|
|
3119
3103
|
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
3104
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3120
3105
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3121
3106
|
return true;
|
|
3122
3107
|
},
|
|
3123
|
-
heal: function (value, schema) {
|
|
3108
|
+
heal: function (value, settings, schema) {
|
|
3124
3109
|
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
3110
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3125
3111
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3126
3112
|
throw new Error('Not implemented');
|
|
3127
3113
|
},
|
|
@@ -3130,7 +3116,7 @@
|
|
|
3130
3116
|
/**
|
|
3131
3117
|
* TODO: [🧠] Maybe propper instance of object
|
|
3132
3118
|
* TODO: [0] Make string_serialized_json
|
|
3133
|
-
* TODO: [1] Make type for JSON Schema
|
|
3119
|
+
* TODO: [1] Make type for JSON Settings and Schema
|
|
3134
3120
|
* TODO: [🧠] What to use for validating JSONs - JSON Schema, ZoD, typescript types/interfaces,...?
|
|
3135
3121
|
* TODO: [🍓] In `JsonFormatDefinition` implement simple `isValid`
|
|
3136
3122
|
* TODO: [🍓] In `JsonFormatDefinition` implement partial `canBeValid`
|
|
@@ -3160,7 +3146,7 @@
|
|
|
3160
3146
|
subvalueDefinitions: [
|
|
3161
3147
|
{
|
|
3162
3148
|
subvalueName: 'LINE',
|
|
3163
|
-
mapValues: function (value, mapCallback) {
|
|
3149
|
+
mapValues: function (value, settings, mapCallback) {
|
|
3164
3150
|
return __awaiter(this, void 0, void 0, function () {
|
|
3165
3151
|
var lines, mappedLines;
|
|
3166
3152
|
return __generator(this, function (_a) {
|
|
@@ -3186,6 +3172,7 @@
|
|
|
3186
3172
|
],
|
|
3187
3173
|
};
|
|
3188
3174
|
/**
|
|
3175
|
+
* TODO: [1] Make type for XML Text and Schema
|
|
3189
3176
|
* TODO: [🧠][🤠] Here should be all words, characters, lines, paragraphs, pages aviable as subvalues
|
|
3190
3177
|
* TODO: [🍓] In `TextFormatDefinition` implement simple `isValid`
|
|
3191
3178
|
* TODO: [🍓] In `TextFormatDefinition` implement partial `canBeValid`
|
|
@@ -3202,18 +3189,21 @@
|
|
|
3202
3189
|
var XmlFormatDefinition = {
|
|
3203
3190
|
formatName: 'XML',
|
|
3204
3191
|
mimeType: 'application/xml',
|
|
3205
|
-
isValid: function (value, schema) {
|
|
3192
|
+
isValid: function (value, settings, schema) {
|
|
3206
3193
|
TODO_USE(value /* <- TODO: Use value here */);
|
|
3194
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3207
3195
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3208
3196
|
return true;
|
|
3209
3197
|
},
|
|
3210
|
-
canBeValid: function (partialValue, schema) {
|
|
3198
|
+
canBeValid: function (partialValue, settings, schema) {
|
|
3211
3199
|
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
3200
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3212
3201
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3213
3202
|
return true;
|
|
3214
3203
|
},
|
|
3215
|
-
heal: function (value, schema) {
|
|
3204
|
+
heal: function (value, settings, schema) {
|
|
3216
3205
|
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
3206
|
+
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3217
3207
|
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3218
3208
|
throw new Error('Not implemented');
|
|
3219
3209
|
},
|
|
@@ -3222,7 +3212,7 @@
|
|
|
3222
3212
|
/**
|
|
3223
3213
|
* TODO: [🧠] Maybe propper instance of object
|
|
3224
3214
|
* TODO: [0] Make string_serialized_xml
|
|
3225
|
-
* TODO: [1] Make type for XML Schema
|
|
3215
|
+
* TODO: [1] Make type for XML Settings and Schema
|
|
3226
3216
|
* TODO: [🧠] What to use for validating XMLs - XSD,...
|
|
3227
3217
|
* TODO: [🍓] In `XmlFormatDefinition` implement simple `isValid`
|
|
3228
3218
|
* TODO: [🍓] In `XmlFormatDefinition` implement partial `canBeValid`
|
|
@@ -4062,12 +4052,12 @@
|
|
|
4062
4052
|
*/
|
|
4063
4053
|
function executeFormatCells(options) {
|
|
4064
4054
|
return __awaiter(this, void 0, void 0, function () {
|
|
4065
|
-
var template, jokerParameterNames, parameters, priority, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, resultString;
|
|
4055
|
+
var template, jokerParameterNames, parameters, priority, pipelineIdentification, settings, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
|
|
4066
4056
|
var _this = this;
|
|
4067
4057
|
return __generator(this, function (_a) {
|
|
4068
4058
|
switch (_a.label) {
|
|
4069
4059
|
case 0:
|
|
4070
|
-
template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, pipelineIdentification = options.pipelineIdentification;
|
|
4060
|
+
template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, pipelineIdentification = options.pipelineIdentification, settings = options.settings;
|
|
4071
4061
|
if (template.foreach === undefined) {
|
|
4072
4062
|
return [2 /*return*/, /* not await */ executeAttempts(options)];
|
|
4073
4063
|
}
|
|
@@ -4096,7 +4086,11 @@
|
|
|
4096
4086
|
.map(function (subvalueName) { return "- ".concat(subvalueName); })
|
|
4097
4087
|
.join('\n')), "\n\n [\u26F7] This should never happen because cell name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
4098
4088
|
}
|
|
4099
|
-
|
|
4089
|
+
if (formatDefinition.formatName === 'CSV') {
|
|
4090
|
+
formatSettings = settings.csvSettings;
|
|
4091
|
+
// <- TODO: !!!!!! More universal, make simmilar pattern for other formats for example \n vs \r\n in text
|
|
4092
|
+
}
|
|
4093
|
+
return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
4100
4094
|
var mappedParameters, allSubparameters, subresultString;
|
|
4101
4095
|
return __generator(this, function (_a) {
|
|
4102
4096
|
switch (_a.label) {
|
|
@@ -4731,7 +4725,7 @@
|
|
|
4731
4725
|
function createPipelineExecutor(options) {
|
|
4732
4726
|
var _this = this;
|
|
4733
4727
|
var pipeline = options.pipeline, tools = options.tools, _a = options.settings, settings = _a === void 0 ? {} : _a;
|
|
4734
|
-
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.
|
|
4728
|
+
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;
|
|
4735
4729
|
validatePipeline(pipeline);
|
|
4736
4730
|
var pipelineIdentification = (function () {
|
|
4737
4731
|
// Note: This is a 😐 implementation of [🚞]
|
|
@@ -4766,6 +4760,7 @@
|
|
|
4766
4760
|
settings: {
|
|
4767
4761
|
maxExecutionAttempts: maxExecutionAttempts,
|
|
4768
4762
|
maxParallelCount: maxParallelCount,
|
|
4763
|
+
csvSettings: csvSettings,
|
|
4769
4764
|
isVerbose: isVerbose,
|
|
4770
4765
|
isNotPreparedWarningSupressed: isNotPreparedWarningSupressed,
|
|
4771
4766
|
},
|
|
@@ -9234,6 +9229,7 @@
|
|
|
9234
9229
|
exports.CallbackInterfaceTools = CallbackInterfaceTools;
|
|
9235
9230
|
exports.CollectionError = CollectionError;
|
|
9236
9231
|
exports.CsvFormatDefinition = CsvFormatDefinition;
|
|
9232
|
+
exports.DEFAULT_CSV_SETTINGS = DEFAULT_CSV_SETTINGS;
|
|
9237
9233
|
exports.DEFAULT_REMOTE_URL = DEFAULT_REMOTE_URL;
|
|
9238
9234
|
exports.DEFAULT_REMOTE_URL_PATH = DEFAULT_REMOTE_URL_PATH;
|
|
9239
9235
|
exports.ERRORS = ERRORS;
|