@promptbook/cli 0.69.0-10 → 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
  *
@@ -148,13 +155,13 @@ export declare const IS_VERBOSE = false;
148
155
  *
149
156
  * @private within the repository
150
157
  */
151
- export declare const IS_COST_PREVENTED: boolean;
158
+ export declare const IS_PIPELINE_LOGIC_VALIDATED: boolean;
152
159
  /**
153
160
  * @@@
154
161
  *
155
162
  * @private within the repository
156
163
  */
157
- export declare const IS_PIPELINE_LOGIC_VALIDATED: boolean;
164
+ export declare const IS_COST_PREVENTED: boolean;
158
165
  /**
159
166
  * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
160
167
  */
@@ -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-10",
3
+ "version": "0.69.0-12",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,