@promptbook/openai 0.71.0-0 → 0.72.0-0

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.
Files changed (76) hide show
  1. package/README.md +6 -5
  2. package/esm/index.es.js +244 -20
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/core.index.d.ts +5 -11
  5. package/esm/typings/src/_packages/openai.index.d.ts +4 -0
  6. package/esm/typings/src/_packages/types.index.d.ts +2 -12
  7. package/esm/typings/src/_packages/utils.index.d.ts +4 -4
  8. package/esm/typings/src/commands/FOREACH/ForeachCommand.d.ts +2 -3
  9. package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +1 -1
  10. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -16
  11. package/esm/typings/src/config.d.ts +1 -14
  12. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +0 -3
  13. package/esm/typings/src/conversion/utils/extractParameterNamesFromTemplate.d.ts +1 -2
  14. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +0 -5
  15. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +8 -9
  16. package/esm/typings/src/execution/createPipelineExecutor.d.ts +72 -0
  17. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +1 -1
  18. package/esm/typings/src/execution/utils/addUsage.d.ts +0 -56
  19. package/esm/typings/src/execution/utils/checkExpectations.d.ts +0 -2
  20. package/esm/typings/src/execution/utils/usage-constants.d.ts +127 -0
  21. package/esm/typings/src/execution/utils/usageToHuman.d.ts +4 -3
  22. package/esm/typings/src/formats/_common/FormatDefinition.d.ts +15 -14
  23. package/esm/typings/src/formats/csv/{CsvFormatDefinition.d.ts → ListFormatDefinition.d.ts} +3 -6
  24. package/esm/typings/src/formats/index.d.ts +1 -1
  25. package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +3 -4
  26. package/esm/typings/src/formats/list/ListFormatDefinition.d.ts +16 -0
  27. package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +3 -4
  28. package/esm/typings/src/knowledge/dialogs/callback/CallbackInterfaceTools.d.ts +1 -1
  29. package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -1
  30. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +3 -2
  31. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +3 -2
  32. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
  33. package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
  34. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +37 -0
  35. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +14 -0
  36. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +3 -2
  37. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
  38. package/esm/typings/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +1 -1
  39. package/esm/typings/src/scripting/python/PythonExecutionTools.d.ts +1 -1
  40. package/esm/typings/src/scripting/typescript/TypescriptExecutionTools.d.ts +1 -1
  41. package/esm/typings/src/storage/files-storage/FilesStorage.d.ts +1 -1
  42. package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +2 -9
  43. package/esm/typings/src/types/PipelineJson/ParameterJson.d.ts +0 -1
  44. package/esm/typings/src/types/PipelineJson/TemplateJsonCommon.d.ts +0 -5
  45. package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +0 -3
  46. package/esm/typings/src/utils/expectation-counters/index.d.ts +0 -3
  47. package/esm/typings/src/utils/{parameters/extractParameterNames.d.ts → extractParameterNames.d.ts} +2 -2
  48. package/esm/typings/src/utils/organization/{empty_object.d.ts → f.d.ts} +1 -5
  49. package/esm/typings/src/utils/{parameters/replaceParameters.d.ts → replaceParameters.d.ts} +2 -2
  50. package/package.json +13 -17
  51. package/umd/index.umd.js +244 -19
  52. package/umd/index.umd.js.map +1 -1
  53. package/esm/typings/src/commands/FOREACH/ForeachJson.d.ts +0 -23
  54. package/esm/typings/src/execution/createPipelineExecutor/$OngoingTemplateResult.d.ts +0 -45
  55. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +0 -20
  56. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorSettings.d.ts +0 -40
  57. package/esm/typings/src/execution/createPipelineExecutor/00-createPipelineExecutor.d.ts +0 -10
  58. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +0 -55
  59. package/esm/typings/src/execution/createPipelineExecutor/20-executeTemplate.d.ts +0 -62
  60. package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatCells.d.ts +0 -19
  61. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +0 -74
  62. package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +0 -34
  63. package/esm/typings/src/execution/createPipelineExecutor/getContextForTemplate.d.ts +0 -10
  64. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTemplate.d.ts +0 -27
  65. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTemplate.d.ts +0 -30
  66. package/esm/typings/src/execution/createPipelineExecutor/getSamplesForTemplate.d.ts +0 -10
  67. package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +0 -30
  68. package/esm/typings/src/formats/csv/CsvSettings.d.ts +0 -13
  69. package/esm/typings/src/formats/text/TextFormatDefinition.d.ts +0 -19
  70. package/esm/typings/src/utils/organization/just_empty_object.d.ts +0 -12
  71. package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +0 -27
  72. package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +0 -10
  73. package/esm/typings/src/utils/validators/parameterName/validateParameterName.test.d.ts +0 -1
  74. /package/esm/typings/src/{utils/parameters/extractParameterNames.test.d.ts → execution/utils/usageToHuman.test.d.ts} +0 -0
  75. /package/esm/typings/src/utils/{parameters/mapAvailableToExpectedParameters.test.d.ts → extractParameterNames.test.d.ts} +0 -0
  76. /package/esm/typings/src/utils/{parameters/replaceParameters.test.d.ts → replaceParameters.test.d.ts} +0 -0
@@ -17,7 +17,6 @@ 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';
21
20
  import { IS_VERBOSE } from '../config';
22
21
  import { pipelineJsonToString } from '../conversion/pipelineJsonToString';
23
22
  import type { PipelineStringToJsonOptions } from '../conversion/pipelineStringToJson';
@@ -39,16 +38,14 @@ import { PipelineLogicError } from '../errors/PipelineLogicError';
39
38
  import { PipelineUrlError } from '../errors/PipelineUrlError';
40
39
  import { UnexpectedError } from '../errors/UnexpectedError';
41
40
  import { assertsExecutionSuccessful } from '../execution/assertsExecutionSuccessful';
42
- import { createPipelineExecutor } from '../execution/createPipelineExecutor/00-createPipelineExecutor';
41
+ import { createPipelineExecutor } from '../execution/createPipelineExecutor';
43
42
  import { embeddingVectorToString } from '../execution/embeddingVectorToString';
44
- import { ZERO_USAGE } from '../execution/utils/addUsage';
45
43
  import { addUsage } from '../execution/utils/addUsage';
46
44
  import { isPassingExpectations } from '../execution/utils/checkExpectations';
45
+ import { ZERO_USAGE } from '../execution/utils/usage-constants';
46
+ import { UNCERTAIN_USAGE } from '../execution/utils/usage-constants';
47
47
  import { usageToHuman } from '../execution/utils/usageToHuman';
48
48
  import { usageToWorktime } from '../execution/utils/usageToWorktime';
49
- import { CsvFormatDefinition } from '../formats/csv/CsvFormatDefinition';
50
- import { MANDATORY_CSV_SETTINGS } from '../formats/csv/CsvSettings';
51
- import { TextFormatDefinition } from '../formats/text/TextFormatDefinition';
52
49
  import { CallbackInterfaceTools } from '../knowledge/dialogs/callback/CallbackInterfaceTools';
53
50
  import type { CallbackInterfaceToolsOptions } from '../knowledge/dialogs/callback/CallbackInterfaceToolsOptions';
54
51
  import { prepareKnowledgePieces } from '../knowledge/prepare-knowledge/_common/prepareKnowledgePieces';
@@ -94,7 +91,6 @@ export { PIPELINE_COLLECTION_BASE_FILENAME };
94
91
  export { RESERVED_PARAMETER_NAMES };
95
92
  export { DEFAULT_REMOTE_URL };
96
93
  export { DEFAULT_REMOTE_URL_PATH };
97
- export { DEFAULT_CSV_SETTINGS };
98
94
  export { IS_VERBOSE };
99
95
  export { pipelineJsonToString };
100
96
  export type { PipelineStringToJsonOptions };
@@ -118,14 +114,12 @@ export { UnexpectedError };
118
114
  export { assertsExecutionSuccessful };
119
115
  export { createPipelineExecutor };
120
116
  export { embeddingVectorToString };
121
- export { ZERO_USAGE };
122
117
  export { addUsage };
123
118
  export { isPassingExpectations };
119
+ export { ZERO_USAGE };
120
+ export { UNCERTAIN_USAGE };
124
121
  export { usageToHuman };
125
122
  export { usageToWorktime };
126
- export { CsvFormatDefinition };
127
- export { MANDATORY_CSV_SETTINGS };
128
- export { TextFormatDefinition };
129
123
  export { CallbackInterfaceTools };
130
124
  export type { CallbackInterfaceToolsOptions };
131
125
  export { prepareKnowledgePieces };
@@ -1,12 +1,16 @@
1
1
  import { PROMPTBOOK_VERSION } from '../version';
2
2
  import { createOpenAiExecutionTools } from '../llm-providers/openai/createOpenAiExecutionTools';
3
3
  import { OPENAI_MODELS } from '../llm-providers/openai/openai-models';
4
+ import { OpenAiAssistantExecutionTools } from '../llm-providers/openai/OpenAiAssistantExecutionTools';
5
+ import type { OpenAiAssistantExecutionToolsOptions } from '../llm-providers/openai/OpenAiAssistantExecutionToolsOptions';
4
6
  import { OpenAiExecutionTools } from '../llm-providers/openai/OpenAiExecutionTools';
5
7
  import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions';
6
8
  import { _OpenAiRegistration } from '../llm-providers/openai/register-constructor';
7
9
  export { PROMPTBOOK_VERSION };
8
10
  export { createOpenAiExecutionTools };
9
11
  export { OPENAI_MODELS };
12
+ export { OpenAiAssistantExecutionTools };
13
+ export type { OpenAiAssistantExecutionToolsOptions };
10
14
  export { OpenAiExecutionTools };
11
15
  export type { OpenAiExecutionToolsOptions };
12
16
  export { _OpenAiRegistration };
@@ -7,7 +7,6 @@ import type { PipelineTemplateCommandParser } from '../commands/_common/types/Co
7
7
  import type { CommandParserInput } from '../commands/_common/types/CommandParser';
8
8
  import type { CommandUsagePlace } from '../commands/_common/types/CommandUsagePlaces';
9
9
  import type { ExpectCommand } from '../commands/EXPECT/ExpectCommand';
10
- import type { ForeachJson } from '../commands/FOREACH/ForeachJson';
11
10
  import type { FormatCommand } from '../commands/FORMAT/FormatCommand';
12
11
  import type { TemplateType } from '../commands/TEMPLATE/TemplateTypes';
13
12
  import type { PipelineStringToJsonOptions } from '../conversion/pipelineStringToJson';
@@ -16,8 +15,6 @@ import type { renderPipelineMermaidOptions } from '../conversion/prettify/render
16
15
  import type { ErrorJson } from '../errors/utils/ErrorJson';
17
16
  import type { AvailableModel } from '../execution/AvailableModel';
18
17
  import type { CommonExecutionToolsOptions } from '../execution/CommonExecutionToolsOptions';
19
- import type { CreatePipelineExecutorOptions } from '../execution/createPipelineExecutor/00-CreatePipelineExecutorOptions';
20
- import type { CreatePipelineExecutorSettings } from '../execution/createPipelineExecutor/00-CreatePipelineExecutorSettings';
21
18
  import type { EmbeddingVector } from '../execution/EmbeddingVector';
22
19
  import type { ExecutionTools } from '../execution/ExecutionTools';
23
20
  import type { LlmExecutionTools } from '../execution/LlmExecutionTools';
@@ -35,8 +32,6 @@ import type { ScriptExecutionToolsExecuteOptions } from '../execution/ScriptExec
35
32
  import type { UncertainNumber } from '../execution/UncertainNumber';
36
33
  import type { UserInterfaceTools } from '../execution/UserInterfaceTools';
37
34
  import type { UserInterfaceToolsPromptDialogOptions } from '../execution/UserInterfaceTools';
38
- import type { FormatSubvalueDefinition } from '../formats/_common/FormatSubvalueDefinition';
39
- import type { CsvSettings } from '../formats/csv/CsvSettings';
40
35
  import type { CallbackInterfaceToolsOptions } from '../knowledge/dialogs/callback/CallbackInterfaceToolsOptions';
41
36
  import type { LlmToolsConfiguration } from '../llm-providers/_common/LlmToolsConfiguration';
42
37
  import type { LlmToolsMetadata } from '../llm-providers/_common/LlmToolsMetadata';
@@ -50,6 +45,7 @@ import type { AnthropicClaudeExecutionToolsProxiedOptions } from '../llm-provide
50
45
  import type { AzureOpenAiExecutionToolsOptions } from '../llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions';
51
46
  import type { LangtailExecutionToolsOptions } from '../llm-providers/langtail/LangtailExecutionToolsOptions';
52
47
  import type { MultipleLlmExecutionTools } from '../llm-providers/multiple/MultipleLlmExecutionTools';
48
+ import type { OpenAiAssistantExecutionToolsOptions } from '../llm-providers/openai/OpenAiAssistantExecutionToolsOptions';
53
49
  import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions';
54
50
  import type { PromptbookServer_Error } from '../llm-providers/remote/interfaces/PromptbookServer_Error';
55
51
  import type { PromptbookServer_ListModels_Request } from '../llm-providers/remote/interfaces/PromptbookServer_ListModels_Request';
@@ -225,7 +221,6 @@ import type { string_camelCase } from '../utils/normalization/normalizeTo_camelC
225
221
  import type { string_PascalCase } from '../utils/normalization/normalizeTo_PascalCase';
226
222
  import type { string_SCREAMING_CASE } from '../utils/normalization/normalizeTo_SCREAMING_CASE';
227
223
  import type { string_snake_case } from '../utils/normalization/normalizeTo_snake_case';
228
- import type { empty_object } from '../utils/organization/empty_object';
229
224
  import type { really_any } from '../utils/organization/really_any';
230
225
  import type { TODO_any } from '../utils/organization/TODO_any';
231
226
  import type { string_promptbook_version } from '../version';
@@ -238,7 +233,6 @@ export type { PipelineTemplateCommandParser };
238
233
  export type { CommandParserInput };
239
234
  export type { CommandUsagePlace };
240
235
  export type { ExpectCommand };
241
- export type { ForeachJson };
242
236
  export type { FormatCommand };
243
237
  export type { TemplateType };
244
238
  export type { PipelineStringToJsonOptions };
@@ -247,8 +241,6 @@ export type { renderPipelineMermaidOptions };
247
241
  export type { ErrorJson };
248
242
  export type { AvailableModel };
249
243
  export type { CommonExecutionToolsOptions };
250
- export type { CreatePipelineExecutorOptions };
251
- export type { CreatePipelineExecutorSettings };
252
244
  export type { EmbeddingVector };
253
245
  export type { ExecutionTools };
254
246
  export type { LlmExecutionTools };
@@ -266,8 +258,6 @@ export type { ScriptExecutionToolsExecuteOptions };
266
258
  export type { UncertainNumber };
267
259
  export type { UserInterfaceTools };
268
260
  export type { UserInterfaceToolsPromptDialogOptions };
269
- export type { FormatSubvalueDefinition };
270
- export type { CsvSettings };
271
261
  export type { CallbackInterfaceToolsOptions };
272
262
  export type { LlmToolsConfiguration };
273
263
  export type { LlmToolsMetadata };
@@ -281,6 +271,7 @@ export type { AnthropicClaudeExecutionToolsProxiedOptions };
281
271
  export type { AzureOpenAiExecutionToolsOptions };
282
272
  export type { LangtailExecutionToolsOptions };
283
273
  export type { MultipleLlmExecutionTools };
274
+ export type { OpenAiAssistantExecutionToolsOptions };
284
275
  export type { OpenAiExecutionToolsOptions };
285
276
  export type { PromptbookServer_Error };
286
277
  export type { PromptbookServer_ListModels_Request };
@@ -456,7 +447,6 @@ export type { string_camelCase };
456
447
  export type { string_PascalCase };
457
448
  export type { string_SCREAMING_CASE };
458
449
  export type { string_snake_case };
459
- export type { empty_object };
460
450
  export type { really_any };
461
451
  export type { TODO_any };
462
452
  export type { string_promptbook_version };
@@ -20,6 +20,7 @@ import { splitIntoSentences } from '../utils/expectation-counters/countSentences
20
20
  import { countSentences } from '../utils/expectation-counters/countSentences';
21
21
  import { countWords } from '../utils/expectation-counters/countWords';
22
22
  import { CountUtils } from '../utils/expectation-counters/index';
23
+ import { extractParameterNames } from '../utils/extractParameterNames';
23
24
  import { capitalize } from '../utils/normalization/capitalize';
24
25
  import { decapitalize } from '../utils/normalization/decapitalize';
25
26
  import { DIACRITIC_VARIANTS_LETTERS } from '../utils/normalization/DIACRITIC_VARIANTS_LETTERS';
@@ -42,12 +43,11 @@ import { parseKeywords } from '../utils/normalization/parseKeywords';
42
43
  import { parseKeywordsFromString } from '../utils/normalization/parseKeywordsFromString';
43
44
  import { removeDiacritics } from '../utils/normalization/removeDiacritics';
44
45
  import { searchKeywords } from '../utils/normalization/searchKeywords';
45
- import { extractParameterNames } from '../utils/parameters/extractParameterNames';
46
- import { replaceParameters } from '../utils/parameters/replaceParameters';
47
46
  import { parseNumber } from '../utils/parseNumber';
48
47
  import { $randomSeed } from '../utils/random/$randomSeed';
49
48
  import { removeEmojis } from '../utils/removeEmojis';
50
49
  import { removeQuotes } from '../utils/removeQuotes';
50
+ import { replaceParameters } from '../utils/replaceParameters';
51
51
  import { $deepFreeze } from '../utils/serialization/$deepFreeze';
52
52
  import { checkSerializableAsJson } from '../utils/serialization/checkSerializableAsJson';
53
53
  import { clonePipeline } from '../utils/serialization/clonePipeline';
@@ -91,6 +91,7 @@ export { splitIntoSentences };
91
91
  export { countSentences };
92
92
  export { countWords };
93
93
  export { CountUtils };
94
+ export { extractParameterNames };
94
95
  export { capitalize };
95
96
  export { decapitalize };
96
97
  export { DIACRITIC_VARIANTS_LETTERS };
@@ -113,12 +114,11 @@ export { parseKeywords };
113
114
  export { parseKeywordsFromString };
114
115
  export { removeDiacritics };
115
116
  export { searchKeywords };
116
- export { extractParameterNames };
117
- export { replaceParameters };
118
117
  export { parseNumber };
119
118
  export { $randomSeed };
120
119
  export { removeEmojis };
121
120
  export { removeQuotes };
121
+ export { replaceParameters };
122
122
  export { $deepFreeze };
123
123
  export { checkSerializableAsJson };
124
124
  export { clonePipeline };
@@ -1,10 +1,9 @@
1
- import type { ForeachJson } from './ForeachJson';
2
1
  /**
3
- * Parsed FOREACH command which is used to iterate over a table of values
2
+ * Parsed FOREACH command <- Write [🍭]
4
3
  *
5
4
  * @see ./foreachCommandParser.ts for more details
6
5
  * @private within the commands folder
7
6
  */
8
7
  export type ForeachCommand = {
9
8
  readonly type: 'FOREACH';
10
- } & ForeachJson;
9
+ };
@@ -10,5 +10,5 @@ import type { ForeachCommand } from './ForeachCommand';
10
10
  */
11
11
  export declare const foreachCommandParser: PipelineTemplateCommandParser<ForeachCommand>;
12
12
  /**
13
- * TODO: [🍭] Make .ptbk.md file with examples of the FOREACH with wrong parsing and logic
13
+ * TODO: [🍭] Make .ptbk.md file with examples of the FOREACH command and also with wrong parsing and logic
14
14
  */
@@ -147,39 +147,24 @@ export type $PipelineJson = WritableDeep<PipelineJson>;
147
147
  export type CommandParserInput = {
148
148
  /**
149
149
  * @@@
150
- *
151
- * @example 'PIPELINE_HEAD'
152
- * @example 'PIPELINE_TEMPLATE'
153
150
  */
154
151
  readonly usagePlace: CommandUsagePlace;
155
152
  /**
156
153
  * @@@
157
- *
158
- * @example 'promptbook version 0.62.0'
159
- * @example 'FOREACH Text Line `{customers}` -> `{customer}`'
160
154
  */
161
155
  readonly raw: string_markdown_text;
162
156
  /**
163
157
  * @@@
164
- *
165
- * @example '0.62.0'
166
- * @example 'List Line `{customers}` -> `{customer}`'
167
158
  */
168
159
  readonly rawArgs: string_markdown_text;
169
160
  /**
170
161
  * @@@
171
- *
172
- * @example 'PROMPTBOOK_VERSION_0_62_0'
173
- * @example 'FOREACH_LIST_LINE_CUSTOMERS_CUSTOMER'
174
162
  */
175
163
  readonly normalized: string_name & string_SCREAMING_CASE;
176
164
  /**
177
165
  * @@@
178
- *
179
- * @example [ '0.62.0' ]
180
- * @example [ 'List', 'Line', '{customers}', '', '{customer}' ]
181
166
  */
182
- readonly args: Array<string_name>;
167
+ readonly args: Array<string_name & string_SCREAMING_CASE>;
183
168
  };
184
169
  /**
185
170
  * TODO: [♓️] Add order here
@@ -1,4 +1,3 @@
1
- import type { CsvSettings } from './formats/csv/CsvSettings';
2
1
  /**
3
2
  * Warning message for the generated sections and files files
4
3
  *
@@ -138,12 +137,6 @@ export declare const DEFAULT_REMOTE_URL = "https://api.pavolhejny.com/";
138
137
  * @public exported from `@promptbook/core`
139
138
  */
140
139
  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;
147
140
  /**
148
141
  * @@@
149
142
  *
@@ -155,13 +148,7 @@ export declare const IS_VERBOSE = false;
155
148
  *
156
149
  * @private within the repository
157
150
  */
158
- export declare const IS_PIPELINE_LOGIC_VALIDATED: boolean;
159
- /**
160
- * @@@
161
- *
162
- * @private within the repository
163
- */
164
- export declare const IS_COST_PREVENTED: boolean;
151
+ export declare const DEBUG_ALLOW_PAYED_TESTING: boolean;
165
152
  /**
166
153
  * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
167
154
  */
@@ -22,9 +22,6 @@ export type renderPipelineMermaidOptions = {
22
22
  */
23
23
  export declare function renderPromptbookMermaid(pipelineJson: PipelineJson, options?: renderPipelineMermaidOptions): string;
24
24
  /**
25
- * TODO: !!!!! FOREACH in mermaid graph
26
- * TODO: !!!!! Knowledge in mermaid graph
27
- * TODO: !!!!! Personas in mermaid graph
28
25
  * TODO: Maybe use some Mermaid package instead of string templating
29
26
  * TODO: [🕌] When more than 2 functionalities, split into separate functions
30
27
  */
@@ -1,4 +1,3 @@
1
- import type { ReadonlyDeep } from 'type-fest';
2
1
  import type { TemplateJson } from '../../types/PipelineJson/TemplateJson';
3
2
  import type { string_parameter_name } from '../../types/typeAliases';
4
3
  /**
@@ -9,7 +8,7 @@ import type { string_parameter_name } from '../../types/typeAliases';
9
8
  * @throws {ParseError} if the script is invalid
10
9
  * @public exported from `@promptbook/utils`
11
10
  */
12
- export declare function extractParameterNamesFromTemplate(template: ReadonlyDeep<Pick<TemplateJson, 'title' | 'description' | 'templateType' | 'content' | 'preparedContent' | 'jokerParameterNames' | 'foreach'>>): Set<string_parameter_name>;
11
+ export declare function extractParameterNamesFromTemplate(template: Pick<TemplateJson, 'title' | 'description' | 'templateType' | 'content' | 'preparedContent' | 'jokerParameterNames'>): Set<string_parameter_name>;
13
12
  /**
14
13
  * TODO: [🔣] If script require contentLanguage
15
14
  */
@@ -16,11 +16,6 @@ import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
16
16
  */
17
17
  export declare function validatePipeline(pipeline: PipelineJson): PipelineJson;
18
18
  /**
19
- * @private internal function for `validatePipeline`
20
- */
21
- export declare function validatePipelineCore(pipeline: PipelineJson): void;
22
- /**
23
- * TODO: !!!!! [🧞‍♀️] Do not allow joker + foreach
24
19
  * TODO: [🧠] Work with promptbookVersion
25
20
  * TODO: Use here some json-schema, Zod or something similar and change it to:
26
21
  * > /**
@@ -1,8 +1,7 @@
1
- import { ReadonlyDeep } from 'type-fest';
2
- import type { ErrorJson } from '../errors/utils/ErrorJson';
3
1
  import type { ExecutionReportJson } from '../types/execution-report/ExecutionReportJson';
4
- import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
5
2
  import type { Parameters } from '../types/typeAliases';
3
+ import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
4
+ import type { ErrorJson } from '../errors/utils/ErrorJson';
6
5
  import type { PromptResultUsage } from './PromptResultUsage';
7
6
  /**
8
7
  * @@@
@@ -15,7 +14,7 @@ export type PipelineExecutorResult = {
15
14
  *
16
15
  * Note: If the execution was not successful, there are only some of the result parameters
17
16
  */
18
- readonly outputParameters: Readonly<Parameters>;
17
+ readonly outputParameters: Parameters;
19
18
  /**
20
19
  * Whether the execution was successful, details are aviable in `executionReport`
21
20
  */
@@ -23,26 +22,26 @@ export type PipelineExecutorResult = {
23
22
  /**
24
23
  * Added usage of whole execution, detailed usage is aviable in `executionReport`
25
24
  */
26
- readonly usage: ReadonlyDeep<PromptResultUsage>;
25
+ readonly usage: PromptResultUsage;
27
26
  /**
28
27
  * Errors that occured during the execution, details are aviable in `executionReport`
29
28
  */
30
- readonly errors: ReadonlyDeep<Array<ErrorJson>>;
29
+ readonly errors: Array<ErrorJson>;
31
30
  /**
32
31
  * Warnings that occured during the execution, details are aviable in `executionReport`
33
32
  */
34
- readonly warnings: ReadonlyDeep<Array<ErrorJson>>;
33
+ readonly warnings: Array<ErrorJson>;
35
34
  /**
36
35
  * The report of the execution with all details
37
36
  */
38
- readonly executionReport: ReadonlyDeep<ExecutionReportJson>;
37
+ readonly executionReport: ExecutionReportJson;
39
38
  /**
40
39
  * The prepared pipeline that was used for the execution
41
40
  *
42
41
  * Note: If you called `createPipelineExecutor` with fully prepared pipeline, this is the same object as this pipeline
43
42
  * If you passed not fully prepared pipeline, this is same pipeline but fully prepared
44
43
  */
45
- readonly preparedPipeline: ReadonlyDeep<PipelineJson>;
44
+ readonly preparedPipeline: PipelineJson;
46
45
  };
47
46
  /**
48
47
  * TODO: [🧠] Should this file be in /execution or /types folder?
@@ -0,0 +1,72 @@
1
+ import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
2
+ import type { ExecutionTools } from './ExecutionTools';
3
+ import type { PipelineExecutor } from './PipelineExecutor';
4
+ type CreatePipelineExecutorSettings = {
5
+ /**
6
+ * When executor does not satisfy expectations it will be retried this amount of times
7
+ *
8
+ * @default MAX_EXECUTION_ATTEMPTS
9
+ */
10
+ readonly maxExecutionAttempts?: number;
11
+ /**
12
+ * Maximum number of tasks running in parallel
13
+ *
14
+ * @default MAX_PARALLEL_COUNT
15
+ */
16
+ readonly maxParallelCount?: number;
17
+ /**
18
+ * If true, the preparation logs additional information
19
+ *
20
+ * @default false
21
+ */
22
+ readonly isVerbose?: boolean;
23
+ /**
24
+ * If you pass fully prepared pipeline, this does not matter
25
+ *
26
+ * Otherwise:
27
+ * If false or not set, warning is shown when pipeline is not prepared
28
+ * If true, warning is suppressed
29
+ *
30
+ * @default false
31
+ */
32
+ readonly isNotPreparedWarningSupressed?: boolean;
33
+ };
34
+ /**
35
+ * Options for `createPipelineExecutor`
36
+ */
37
+ interface CreatePipelineExecutorOptions {
38
+ /**
39
+ * The pipeline to be executed
40
+ */
41
+ readonly pipeline: PipelineJson;
42
+ /**
43
+ * The execution tools to be used during the execution of the pipeline
44
+ */
45
+ readonly tools: ExecutionTools;
46
+ /**
47
+ * Optional settings for the pipeline executor
48
+ */
49
+ readonly settings?: Partial<CreatePipelineExecutorSettings>;
50
+ }
51
+ /**
52
+ * Creates executor function from pipeline and execution tools.
53
+ *
54
+ * @returns The executor function
55
+ * @throws {PipelineLogicError} on logical error in the pipeline
56
+ * @public exported from `@promptbook/core`
57
+ */
58
+ export declare function createPipelineExecutor(options: CreatePipelineExecutorOptions): PipelineExecutor;
59
+ export {};
60
+ /**
61
+ * TODO:[main] !!! Identify not only pipeline BUT exact template ${block(pipelineIdentification)}
62
+ * TODO: Use isVerbose here (not only pass to `preparePipeline`)
63
+ * TODO: [🧠][🌳] Use here `countTotalUsage` and put preparation and prepared pipiline to report
64
+ * TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
65
+ * TODO: [♈] Probbably move expectations from templates to parameters
66
+ * TODO: [🧠] When not meet expectations in DIALOG_TEMPLATE, make some way to tell the user
67
+ * TODO: [👧] Strongly type the executors to avoid need of remove nullables whtn noUncheckedIndexedAccess in tsconfig.json
68
+ * Note: CreatePipelineExecutorOptions are just connected to PipelineExecutor so do not extract to types folder
69
+ * TODO: [🧠][3] transparent = (report intermediate parameters) / opaque execution = (report only output parameters) progress reporting mode
70
+ * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
71
+ * TODO: [🧠][💷] `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result BUT maybe NOT to preserve pure JSON object
72
+ */
@@ -7,7 +7,7 @@ interface LindatAutomaticTranslatorOptions extends TranslatorOptions {
7
7
  * @private still in development [🏳]
8
8
  */
9
9
  export declare class LindatAutomaticTranslator implements AutomaticTranslator {
10
- private readonly options;
10
+ protected readonly options: LindatAutomaticTranslatorOptions;
11
11
  constructor(options: LindatAutomaticTranslatorOptions);
12
12
  translate(message: string): Promise<string>;
13
13
  }
@@ -1,60 +1,4 @@
1
1
  import type { PromptResultUsage } from '../PromptResultUsage';
2
- /**
3
- * @@@
4
- *
5
- * @public exported from `@promptbook/core`
6
- */
7
- export declare const ZERO_USAGE: import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{
8
- readonly price: {
9
- readonly value: 0;
10
- };
11
- readonly input: {
12
- readonly tokensCount: {
13
- readonly value: 0;
14
- };
15
- readonly charactersCount: {
16
- readonly value: 0;
17
- };
18
- readonly wordsCount: {
19
- readonly value: 0;
20
- };
21
- readonly sentencesCount: {
22
- readonly value: 0;
23
- };
24
- readonly linesCount: {
25
- readonly value: 0;
26
- };
27
- readonly paragraphsCount: {
28
- readonly value: 0;
29
- };
30
- readonly pagesCount: {
31
- readonly value: 0;
32
- };
33
- };
34
- readonly output: {
35
- readonly tokensCount: {
36
- readonly value: 0;
37
- };
38
- readonly charactersCount: {
39
- readonly value: 0;
40
- };
41
- readonly wordsCount: {
42
- readonly value: 0;
43
- };
44
- readonly sentencesCount: {
45
- readonly value: 0;
46
- };
47
- readonly linesCount: {
48
- readonly value: 0;
49
- };
50
- readonly paragraphsCount: {
51
- readonly value: 0;
52
- };
53
- readonly pagesCount: {
54
- readonly value: 0;
55
- };
56
- };
57
- }>;
58
2
  /**
59
3
  * Function `addUsage` will add multiple usages into one
60
4
  *
@@ -24,6 +24,4 @@ export declare function checkExpectations(expectations: Expectations, value: str
24
24
  export declare function isPassingExpectations(expectations: Expectations, value: string): boolean;
25
25
  /**
26
26
  * TODO: [💝] Unite object for expecting amount and format
27
- * TODO: [🧠][🤠] This should be part of `TextFormatDefinition`
28
- * Note: [💝] and [🤠] are interconnected together
29
27
  */
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Represents the usage with no resources consumed
3
+ *
4
+ * @public exported from `@promptbook/core`
5
+ */
6
+ export declare const ZERO_USAGE: import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{
7
+ readonly price: {
8
+ readonly value: 0;
9
+ };
10
+ readonly input: {
11
+ readonly tokensCount: {
12
+ readonly value: 0;
13
+ };
14
+ readonly charactersCount: {
15
+ readonly value: 0;
16
+ };
17
+ readonly wordsCount: {
18
+ readonly value: 0;
19
+ };
20
+ readonly sentencesCount: {
21
+ readonly value: 0;
22
+ };
23
+ readonly linesCount: {
24
+ readonly value: 0;
25
+ };
26
+ readonly paragraphsCount: {
27
+ readonly value: 0;
28
+ };
29
+ readonly pagesCount: {
30
+ readonly value: 0;
31
+ };
32
+ };
33
+ readonly output: {
34
+ readonly tokensCount: {
35
+ readonly value: 0;
36
+ };
37
+ readonly charactersCount: {
38
+ readonly value: 0;
39
+ };
40
+ readonly wordsCount: {
41
+ readonly value: 0;
42
+ };
43
+ readonly sentencesCount: {
44
+ readonly value: 0;
45
+ };
46
+ readonly linesCount: {
47
+ readonly value: 0;
48
+ };
49
+ readonly paragraphsCount: {
50
+ readonly value: 0;
51
+ };
52
+ readonly pagesCount: {
53
+ readonly value: 0;
54
+ };
55
+ };
56
+ }>;
57
+ /**
58
+ * Represents the usage with unknown resources consumed
59
+ *
60
+ * @public exported from `@promptbook/core`
61
+ */
62
+ export declare const UNCERTAIN_USAGE: import("type-fest/source/readonly-deep").ReadonlyObjectDeep<{
63
+ readonly price: {
64
+ readonly value: 0;
65
+ readonly isUncertain: true;
66
+ };
67
+ readonly input: {
68
+ readonly tokensCount: {
69
+ readonly value: 0;
70
+ readonly isUncertain: true;
71
+ };
72
+ readonly charactersCount: {
73
+ readonly value: 0;
74
+ readonly isUncertain: true;
75
+ };
76
+ readonly wordsCount: {
77
+ readonly value: 0;
78
+ readonly isUncertain: true;
79
+ };
80
+ readonly sentencesCount: {
81
+ readonly value: 0;
82
+ readonly isUncertain: true;
83
+ };
84
+ readonly linesCount: {
85
+ readonly value: 0;
86
+ readonly isUncertain: true;
87
+ };
88
+ readonly paragraphsCount: {
89
+ readonly value: 0;
90
+ readonly isUncertain: true;
91
+ };
92
+ readonly pagesCount: {
93
+ readonly value: 0;
94
+ readonly isUncertain: true;
95
+ };
96
+ };
97
+ readonly output: {
98
+ readonly tokensCount: {
99
+ readonly value: 0;
100
+ readonly isUncertain: true;
101
+ };
102
+ readonly charactersCount: {
103
+ readonly value: 0;
104
+ readonly isUncertain: true;
105
+ };
106
+ readonly wordsCount: {
107
+ readonly value: 0;
108
+ readonly isUncertain: true;
109
+ };
110
+ readonly sentencesCount: {
111
+ readonly value: 0;
112
+ readonly isUncertain: true;
113
+ };
114
+ readonly linesCount: {
115
+ readonly value: 0;
116
+ readonly isUncertain: true;
117
+ };
118
+ readonly paragraphsCount: {
119
+ readonly value: 0;
120
+ readonly isUncertain: true;
121
+ };
122
+ readonly pagesCount: {
123
+ readonly value: 0;
124
+ readonly isUncertain: true;
125
+ };
126
+ };
127
+ }>;