@promptbook/cli 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.
@@ -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
  *
@@ -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, object>;
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`
@@ -0,0 +1,5 @@
1
+ import type { ParseConfig, UnparseConfig } from "papaparse";
2
+ /**
3
+ * @@@
4
+ */
5
+ export type CsvSettings = ParseConfig & UnparseConfig;
@@ -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, object>, import("./_common/FormatDefinition").FormatDefinition<string, string, object>, import("./_common/FormatDefinition").FormatDefinition<string, string, never>, import("./_common/FormatDefinition").FormatDefinition<string, string, object>];
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, object>;
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, never>;
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, object>;
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 really_empty_object = Record<string, never>;
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/cli",
3
- "version": "0.69.0-11",
3
+ "version": "0.69.0-12",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
package/umd/index.umd.js CHANGED
@@ -39,7 +39,7 @@
39
39
  /**
40
40
  * The version of the Promptbook library
41
41
  */
42
- var PROMPTBOOK_VERSION = '0.69.0-10';
42
+ var PROMPTBOOK_VERSION = '0.69.0-11';
43
43
  // TODO: !!!! List here all the versions and annotate + put into script
44
44
 
45
45
  /*! *****************************************************************************
@@ -521,6 +521,19 @@
521
521
  */
522
522
  var DEFAULT_REMOTE_URL_PATH = '/promptbook/socket.io';
523
523
  // <- TODO: [🧜‍♂️]
524
+ /**
525
+ * @@@
526
+ *
527
+ * @public exported from `@promptbook/core`
528
+ */
529
+ var DEFAULT_CSV_SETTINGS = {
530
+ header: true,
531
+ delimiter: ',',
532
+ quoteChar: '"',
533
+ newline: '\n',
534
+ skipEmptyLines: true,
535
+ // encoding: 'utf8'
536
+ };
524
537
  /**
525
538
  * @@@
526
539
  *
@@ -1069,7 +1082,7 @@
1069
1082
  });
1070
1083
  }
1071
1084
 
1072
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.69.0-10",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-10",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-10",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-10",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"}];
1085
+ 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"}];
1073
1086
 
1074
1087
  /**
1075
1088
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -2809,41 +2822,36 @@
2809
2822
  var CsvFormatDefinition = {
2810
2823
  formatName: 'CSV',
2811
2824
  aliases: ['SPREADSHEET', 'TABLE'],
2812
- isValid: function (value, schema) {
2825
+ isValid: function (value, settings, schema) {
2826
+ // TODO: !!!!!! Implement CSV validation
2813
2827
  TODO_USE(value /* <- TODO: Use value here */);
2828
+ TODO_USE(settings /* <- TODO: Use settings here */);
2814
2829
  TODO_USE(schema /* <- TODO: Use schema here */);
2815
2830
  return true;
2816
2831
  },
2817
- canBeValid: function (partialValue, schema) {
2832
+ canBeValid: function (partialValue, settings, schema) {
2818
2833
  TODO_USE(partialValue /* <- TODO: Use partialValue here */);
2834
+ TODO_USE(settings /* <- TODO: Use settings here */);
2819
2835
  TODO_USE(schema /* <- TODO: Use schema here */);
2820
2836
  return true;
2821
2837
  },
2822
- heal: function (value, schema) {
2838
+ heal: function (value, settings, schema) {
2823
2839
  TODO_USE(value /* <- TODO: Use partialValue here */);
2840
+ TODO_USE(settings /* <- TODO: Use settings here */);
2824
2841
  TODO_USE(schema /* <- TODO: Use schema here */);
2825
2842
  throw new Error('Not implemented');
2826
2843
  },
2827
2844
  subvalueDefinitions: [
2828
2845
  {
2829
2846
  subvalueName: 'ROW',
2830
- mapValues: function (value, mapCallback) {
2847
+ mapValues: function (value, settings, mapCallback) {
2831
2848
  return __awaiter(this, void 0, void 0, function () {
2832
2849
  var csv, mappedData;
2833
2850
  var _this = this;
2834
2851
  return __generator(this, function (_a) {
2835
2852
  switch (_a.label) {
2836
2853
  case 0:
2837
- csv = papaparse.parse(value, {
2838
- header: true,
2839
- delimiter: ',',
2840
- quoteChar: '"',
2841
- newline: '\r\n',
2842
- skipEmptyLines: true,
2843
- // encoding: 'utf8',
2844
- // <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
2845
- // <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
2846
- });
2854
+ csv = papaparse.parse(value, settings);
2847
2855
  if (csv.errors.length !== 0) {
2848
2856
  throw new ParseError(// <- TODO: !!!!!! Split PipelineParseError and FormatParseError -> CsvParseError
2849
2857
  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 "); }));
@@ -2857,25 +2865,18 @@
2857
2865
  _a = [__assign({}, row)];
2858
2866
  _b = {};
2859
2867
  // <- TODO: !!!!!! Dynamic new column name and position
2868
+ // <- TODO: !!!!!! Check name collisions
2860
2869
  return [4 /*yield*/, mapCallback(row, index)];
2861
2870
  case 1: return [2 /*return*/, (__assign.apply(void 0, _a.concat([(_b.newColumn =
2862
2871
  // <- TODO: !!!!!! Dynamic new column name and position
2872
+ // <- TODO: !!!!!! Check name collisions
2863
2873
  _c.sent(), _b)])))];
2864
2874
  }
2865
2875
  });
2866
2876
  }); }))];
2867
2877
  case 1:
2868
2878
  mappedData = _a.sent();
2869
- return [2 /*return*/, papaparse.unparse(mappedData, {
2870
- header: true,
2871
- delimiter: ',',
2872
- quoteChar: '"',
2873
- newline: '\r\n',
2874
- skipEmptyLines: true,
2875
- // encoding: 'utf8',
2876
- // <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
2877
- // <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
2878
- })];
2879
+ return [2 /*return*/, papaparse.unparse(mappedData, settings)];
2879
2880
  }
2880
2881
  });
2881
2882
  });
@@ -2883,23 +2884,14 @@
2883
2884
  },
2884
2885
  {
2885
2886
  subvalueName: 'CELL',
2886
- mapValues: function (value, mapCallback) {
2887
+ mapValues: function (value, settings, mapCallback) {
2887
2888
  return __awaiter(this, void 0, void 0, function () {
2888
2889
  var csv, mappedData;
2889
2890
  var _this = this;
2890
2891
  return __generator(this, function (_a) {
2891
2892
  switch (_a.label) {
2892
2893
  case 0:
2893
- csv = papaparse.parse(value, {
2894
- header: true,
2895
- delimiter: ',',
2896
- quoteChar: '"',
2897
- newline: '\r\n',
2898
- skipEmptyLines: true,
2899
- // encoding: 'utf8',
2900
- // <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
2901
- // <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
2902
- });
2894
+ csv = papaparse.parse(value, settings);
2903
2895
  if (csv.errors.length !== 0) {
2904
2896
  throw new ParseError(// <- TODO: !!!!!! Split PipelineParseError and FormatParseError -> CsvParseError
2905
2897
  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 "); }));
@@ -2922,16 +2914,7 @@
2922
2914
  }); }))];
2923
2915
  case 1:
2924
2916
  mappedData = _a.sent();
2925
- return [2 /*return*/, papaparse.unparse(mappedData, {
2926
- header: true,
2927
- delimiter: ',',
2928
- quoteChar: '"',
2929
- newline: '\r\n',
2930
- skipEmptyLines: true,
2931
- // encoding: 'utf8',
2932
- // <- TODO: !!!!!! DEFAULT_CSV_OPTIONS
2933
- // <- TODO: [🧠] How to define parsing options for formats, its different concept than schema
2934
- })];
2917
+ return [2 /*return*/, papaparse.unparse(mappedData, settings)];
2935
2918
  }
2936
2919
  });
2937
2920
  });
@@ -2976,17 +2959,20 @@
2976
2959
  var JsonFormatDefinition = {
2977
2960
  formatName: 'JSON',
2978
2961
  mimeType: 'application/json',
2979
- isValid: function (value, schema) {
2962
+ isValid: function (value, settings, schema) {
2980
2963
  TODO_USE(schema /* <- TODO: Use schema here */);
2964
+ TODO_USE(settings /* <- TODO: Use settings here */);
2981
2965
  return isValidJsonString(value);
2982
2966
  },
2983
- canBeValid: function (partialValue, schema) {
2967
+ canBeValid: function (partialValue, settings, schema) {
2984
2968
  TODO_USE(partialValue /* <- TODO: Use partialValue here */);
2969
+ TODO_USE(settings /* <- TODO: Use settings here */);
2985
2970
  TODO_USE(schema /* <- TODO: Use schema here */);
2986
2971
  return true;
2987
2972
  },
2988
- heal: function (value, schema) {
2973
+ heal: function (value, settings, schema) {
2989
2974
  TODO_USE(value /* <- TODO: Use partialValue here */);
2975
+ TODO_USE(settings /* <- TODO: Use settings here */);
2990
2976
  TODO_USE(schema /* <- TODO: Use schema here */);
2991
2977
  throw new Error('Not implemented');
2992
2978
  },
@@ -2995,7 +2981,7 @@
2995
2981
  /**
2996
2982
  * TODO: [🧠] Maybe propper instance of object
2997
2983
  * TODO: [0] Make string_serialized_json
2998
- * TODO: [1] Make type for JSON Schema
2984
+ * TODO: [1] Make type for JSON Settings and Schema
2999
2985
  * TODO: [🧠] What to use for validating JSONs - JSON Schema, ZoD, typescript types/interfaces,...?
3000
2986
  * TODO: [🍓] In `JsonFormatDefinition` implement simple `isValid`
3001
2987
  * TODO: [🍓] In `JsonFormatDefinition` implement partial `canBeValid`
@@ -3025,7 +3011,7 @@
3025
3011
  subvalueDefinitions: [
3026
3012
  {
3027
3013
  subvalueName: 'LINE',
3028
- mapValues: function (value, mapCallback) {
3014
+ mapValues: function (value, settings, mapCallback) {
3029
3015
  return __awaiter(this, void 0, void 0, function () {
3030
3016
  var lines, mappedLines;
3031
3017
  return __generator(this, function (_a) {
@@ -3051,6 +3037,7 @@
3051
3037
  ],
3052
3038
  };
3053
3039
  /**
3040
+ * TODO: [1] Make type for XML Text and Schema
3054
3041
  * TODO: [🧠][🤠] Here should be all words, characters, lines, paragraphs, pages aviable as subvalues
3055
3042
  * TODO: [🍓] In `TextFormatDefinition` implement simple `isValid`
3056
3043
  * TODO: [🍓] In `TextFormatDefinition` implement partial `canBeValid`
@@ -3067,18 +3054,21 @@
3067
3054
  var XmlFormatDefinition = {
3068
3055
  formatName: 'XML',
3069
3056
  mimeType: 'application/xml',
3070
- isValid: function (value, schema) {
3057
+ isValid: function (value, settings, schema) {
3071
3058
  TODO_USE(value /* <- TODO: Use value here */);
3059
+ TODO_USE(settings /* <- TODO: Use settings here */);
3072
3060
  TODO_USE(schema /* <- TODO: Use schema here */);
3073
3061
  return true;
3074
3062
  },
3075
- canBeValid: function (partialValue, schema) {
3063
+ canBeValid: function (partialValue, settings, schema) {
3076
3064
  TODO_USE(partialValue /* <- TODO: Use partialValue here */);
3065
+ TODO_USE(settings /* <- TODO: Use settings here */);
3077
3066
  TODO_USE(schema /* <- TODO: Use schema here */);
3078
3067
  return true;
3079
3068
  },
3080
- heal: function (value, schema) {
3069
+ heal: function (value, settings, schema) {
3081
3070
  TODO_USE(value /* <- TODO: Use partialValue here */);
3071
+ TODO_USE(settings /* <- TODO: Use settings here */);
3082
3072
  TODO_USE(schema /* <- TODO: Use schema here */);
3083
3073
  throw new Error('Not implemented');
3084
3074
  },
@@ -3087,7 +3077,7 @@
3087
3077
  /**
3088
3078
  * TODO: [🧠] Maybe propper instance of object
3089
3079
  * TODO: [0] Make string_serialized_xml
3090
- * TODO: [1] Make type for XML Schema
3080
+ * TODO: [1] Make type for XML Settings and Schema
3091
3081
  * TODO: [🧠] What to use for validating XMLs - XSD,...
3092
3082
  * TODO: [🍓] In `XmlFormatDefinition` implement simple `isValid`
3093
3083
  * TODO: [🍓] In `XmlFormatDefinition` implement partial `canBeValid`
@@ -3905,12 +3895,12 @@
3905
3895
  */
3906
3896
  function executeFormatCells(options) {
3907
3897
  return __awaiter(this, void 0, void 0, function () {
3908
- var template, jokerParameterNames, parameters, priority, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, resultString;
3898
+ var template, jokerParameterNames, parameters, priority, pipelineIdentification, settings, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
3909
3899
  var _this = this;
3910
3900
  return __generator(this, function (_a) {
3911
3901
  switch (_a.label) {
3912
3902
  case 0:
3913
- template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, pipelineIdentification = options.pipelineIdentification;
3903
+ template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, pipelineIdentification = options.pipelineIdentification, settings = options.settings;
3914
3904
  if (template.foreach === undefined) {
3915
3905
  return [2 /*return*/, /* not await */ executeAttempts(options)];
3916
3906
  }
@@ -3939,7 +3929,11 @@
3939
3929
  .map(function (subvalueName) { return "- ".concat(subvalueName); })
3940
3930
  .join('\n')), "\n\n [\u26F7] This should never happen because cell name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
3941
3931
  }
3942
- return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
3932
+ if (formatDefinition.formatName === 'CSV') {
3933
+ formatSettings = settings.csvSettings;
3934
+ // <- TODO: !!!!!! More universal, make simmilar pattern for other formats for example \n vs \r\n in text
3935
+ }
3936
+ return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
3943
3937
  var mappedParameters, allSubparameters, subresultString;
3944
3938
  return __generator(this, function (_a) {
3945
3939
  switch (_a.label) {
@@ -4574,7 +4568,7 @@
4574
4568
  function createPipelineExecutor(options) {
4575
4569
  var _this = this;
4576
4570
  var pipeline = options.pipeline, tools = options.tools, _a = options.settings, settings = _a === void 0 ? {} : _a;
4577
- 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.isVerbose, isVerbose = _d === void 0 ? IS_VERBOSE : _d, _e = settings.isNotPreparedWarningSupressed, isNotPreparedWarningSupressed = _e === void 0 ? false : _e;
4571
+ 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;
4578
4572
  validatePipeline(pipeline);
4579
4573
  var pipelineIdentification = (function () {
4580
4574
  // Note: This is a 😐 implementation of [🚞]
@@ -4609,6 +4603,7 @@
4609
4603
  settings: {
4610
4604
  maxExecutionAttempts: maxExecutionAttempts,
4611
4605
  maxParallelCount: maxParallelCount,
4606
+ csvSettings: csvSettings,
4612
4607
  isVerbose: isVerbose,
4613
4608
  isNotPreparedWarningSupressed: isNotPreparedWarningSupressed,
4614
4609
  },