@promptbook/node 0.69.0-4 → 0.69.0-5

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 (22) hide show
  1. package/esm/index.es.js +166 -113
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/core.index.d.ts +1 -1
  4. package/esm/typings/src/_packages/types.index.d.ts +2 -2
  5. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +5 -3
  6. package/esm/typings/src/execution/createPipelineExecutor/{CreatePipelineExecutorOptions.d.ts → 00-CreatePipelineExecutorOptions.d.ts} +1 -1
  7. package/esm/typings/src/execution/createPipelineExecutor/{CreatePipelineExecutorSettings.d.ts → 00-CreatePipelineExecutorSettings.d.ts} +4 -4
  8. package/esm/typings/src/execution/createPipelineExecutor/00-createPipelineExecutor.d.ts +10 -0
  9. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +55 -0
  10. package/esm/typings/src/execution/createPipelineExecutor/20-executeTemplate.d.ts +62 -0
  11. package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatCell.d.ts +30 -0
  12. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempt.d.ts +30 -0
  13. package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +28 -2
  14. package/esm/typings/src/execution/createPipelineExecutor/getContextForTemplate.d.ts +3 -1
  15. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTemplate.d.ts +20 -2
  16. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTemplate.d.ts +24 -2
  17. package/esm/typings/src/execution/createPipelineExecutor/getSamplesForTemplate.d.ts +3 -1
  18. package/package.json +2 -2
  19. package/umd/index.umd.js +166 -113
  20. package/umd/index.umd.js.map +1 -1
  21. package/esm/typings/src/execution/createPipelineExecutor/createPipelineExecutor.d.ts +0 -24
  22. package/esm/typings/src/execution/createPipelineExecutor/executeSingleTemplate.d.ts +0 -27
@@ -38,7 +38,7 @@ import { PipelineLogicError } from '../errors/PipelineLogicError';
38
38
  import { PipelineUrlError } from '../errors/PipelineUrlError';
39
39
  import { UnexpectedError } from '../errors/UnexpectedError';
40
40
  import { assertsExecutionSuccessful } from '../execution/assertsExecutionSuccessful';
41
- import { createPipelineExecutor } from '../execution/createPipelineExecutor/createPipelineExecutor';
41
+ import { createPipelineExecutor } from '../execution/createPipelineExecutor/00-createPipelineExecutor';
42
42
  import { embeddingVectorToString } from '../execution/embeddingVectorToString';
43
43
  import { ZERO_USAGE } from '../execution/utils/addUsage';
44
44
  import { addUsage } from '../execution/utils/addUsage';
@@ -16,8 +16,8 @@ import type { renderPipelineMermaidOptions } from '../conversion/prettify/render
16
16
  import type { ErrorJson } from '../errors/utils/ErrorJson';
17
17
  import type { AvailableModel } from '../execution/AvailableModel';
18
18
  import type { CommonExecutionToolsOptions } from '../execution/CommonExecutionToolsOptions';
19
- import type { CreatePipelineExecutorOptions } from '../execution/createPipelineExecutor/CreatePipelineExecutorOptions';
20
- import type { CreatePipelineExecutorSettings } from '../execution/createPipelineExecutor/CreatePipelineExecutorSettings';
19
+ import type { CreatePipelineExecutorOptions } from '../execution/createPipelineExecutor/00-CreatePipelineExecutorOptions';
20
+ import type { CreatePipelineExecutorSettings } from '../execution/createPipelineExecutor/00-CreatePipelineExecutorSettings';
21
21
  import type { EmbeddingVector } from '../execution/EmbeddingVector';
22
22
  import type { ExecutionTools } from '../execution/ExecutionTools';
23
23
  import type { LlmExecutionTools } from '../execution/LlmExecutionTools';
@@ -1,7 +1,8 @@
1
+ import { ReadonlyDeep } from 'type-fest';
2
+ import type { ErrorJson } from '../errors/utils/ErrorJson';
1
3
  import type { ExecutionReportJson } from '../types/execution-report/ExecutionReportJson';
2
- import type { Parameters } from '../types/typeAliases';
3
4
  import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
4
- import type { ErrorJson } from '../errors/utils/ErrorJson';
5
+ import type { Parameters } from '../types/typeAliases';
5
6
  import type { PromptResultUsage } from './PromptResultUsage';
6
7
  /**
7
8
  * @@@
@@ -41,9 +42,10 @@ export type PipelineExecutorResult = {
41
42
  * Note: If you called `createPipelineExecutor` with fully prepared pipeline, this is the same object as this pipeline
42
43
  * If you passed not fully prepared pipeline, this is same pipeline but fully prepared
43
44
  */
44
- readonly preparedPipeline: PipelineJson;
45
+ readonly preparedPipeline: ReadonlyDeep<PipelineJson>;
45
46
  };
46
47
  /**
48
+ * TODO: !!!!!! Maybe add ReadonlyDeep< to all
47
49
  * TODO: [🧠] Should this file be in /execution or /types folder?
48
50
  * TODO: [🧠] Maybe constrain `ErrorJson` -> `ErrorJson & { name: 'PipelineExecutionError' | 'Error' }`
49
51
  */
@@ -1,6 +1,6 @@
1
1
  import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
2
2
  import type { ExecutionTools } from '../ExecutionTools';
3
- import type { CreatePipelineExecutorSettings } from './CreatePipelineExecutorSettings';
3
+ import type { CreatePipelineExecutorSettings } from './00-CreatePipelineExecutorSettings';
4
4
  /**
5
5
  * Options for `createPipelineExecutor`
6
6
  */
@@ -4,19 +4,19 @@ export type CreatePipelineExecutorSettings = {
4
4
  *
5
5
  * @default MAX_EXECUTION_ATTEMPTS
6
6
  */
7
- readonly maxExecutionAttempts?: number;
7
+ readonly maxExecutionAttempts: number;
8
8
  /**
9
9
  * Maximum number of tasks running in parallel
10
10
  *
11
11
  * @default MAX_PARALLEL_COUNT
12
12
  */
13
- readonly maxParallelCount?: number;
13
+ readonly maxParallelCount: number;
14
14
  /**
15
15
  * If true, the preparation logs additional information
16
16
  *
17
17
  * @default false
18
18
  */
19
- readonly isVerbose?: boolean;
19
+ readonly isVerbose: boolean;
20
20
  /**
21
21
  * If you pass fully prepared pipeline, this does not matter
22
22
  *
@@ -26,5 +26,5 @@ export type CreatePipelineExecutorSettings = {
26
26
  *
27
27
  * @default false
28
28
  */
29
- readonly isNotPreparedWarningSupressed?: boolean;
29
+ readonly isNotPreparedWarningSupressed: boolean;
30
30
  };
@@ -0,0 +1,10 @@
1
+ import type { PipelineExecutor } from '../PipelineExecutor';
2
+ import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions';
3
+ /**
4
+ * Creates executor function from pipeline and execution tools.
5
+ *
6
+ * @returns The executor function
7
+ * @throws {PipelineLogicError} on logical error in the pipeline
8
+ * @public exported from `@promptbook/core`
9
+ */
10
+ export declare function createPipelineExecutor(options: CreatePipelineExecutorOptions): PipelineExecutor;
@@ -0,0 +1,55 @@
1
+ import type { Promisable, ReadonlyDeep } from 'type-fest';
2
+ import type { CreatePipelineExecutorSettings } from './00-CreatePipelineExecutorSettings';
3
+ import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
4
+ import type { TaskProgress } from '../../types/TaskProgress';
5
+ import type { Parameters } from '../../types/typeAliases';
6
+ import type { ExecutionTools } from '../ExecutionTools';
7
+ import type { PipelineExecutorResult } from '../PipelineExecutorResult';
8
+ /**
9
+ * @@@
10
+ *
11
+ * @private internal type of `executePipelinex`
12
+ */
13
+ type ExecutePipelineOptions = {
14
+ /**
15
+ * @@@
16
+ */
17
+ readonly inputParameters: Readonly<Parameters>;
18
+ /**
19
+ * @@@
20
+ */
21
+ readonly tools: ExecutionTools;
22
+ /**
23
+ * @@@
24
+ */
25
+ readonly onProgress?: (taskProgress: TaskProgress) => Promisable<void>;
26
+ /**
27
+ * @@@
28
+ */
29
+ readonly pipeline: PipelineJson;
30
+ /**
31
+ * @@@
32
+ */
33
+ readonly preparedPipeline: ReadonlyDeep<PipelineJson>;
34
+ /**
35
+ * @@@
36
+ */
37
+ readonly setPreparedPipeline: (preparedPipeline: ReadonlyDeep<PipelineJson>) => void;
38
+ /**
39
+ * @@@
40
+ */
41
+ readonly pipelineIdentification: string;
42
+ /**
43
+ * Settings for the pipeline executor
44
+ */
45
+ readonly settings: CreatePipelineExecutorSettings;
46
+ };
47
+ /**
48
+ * @@@
49
+ *
50
+ * Note: This is not a `PipelineExecutor` (which is binded with one exact pipeline), but a utility function of `createPipelineExecutor` which creates `PipelineExecutor`
51
+ *
52
+ * @private internal utility of `createPipelineExecutor`
53
+ */
54
+ export declare function executePipeline(options: ExecutePipelineOptions): Promise<PipelineExecutorResult>;
55
+ export {};
@@ -0,0 +1,62 @@
1
+ import { Promisable, ReadonlyDeep } from 'type-fest';
2
+ import { MultipleLlmExecutionTools } from '../../llm-providers/multiple/MultipleLlmExecutionTools';
3
+ import type { ExecutionReportJson } from '../../types/execution-report/ExecutionReportJson';
4
+ import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
5
+ import type { TemplateJson } from '../../types/PipelineJson/TemplateJson';
6
+ import type { TaskProgress } from '../../types/TaskProgress';
7
+ import type { Parameters } from '../../types/typeAliases';
8
+ import type { ExecutionTools } from '../ExecutionTools';
9
+ import type { CreatePipelineExecutorSettings } from './00-CreatePipelineExecutorSettings';
10
+ /**
11
+ * @@@
12
+ *
13
+ * @private internal type of `executeTemplate`
14
+ */
15
+ type executeSingleTemplateOptions = {
16
+ /**
17
+ * @@@
18
+ */
19
+ readonly currentTemplate: ReadonlyDeep<TemplateJson>;
20
+ /**
21
+ * @@@
22
+ */
23
+ readonly preparedPipeline: ReadonlyDeep<PipelineJson>;
24
+ /**
25
+ * @@@
26
+ */
27
+ readonly parametersToPass: Readonly<Parameters>;
28
+ /**
29
+ * @@@
30
+ */
31
+ readonly tools: Omit<ExecutionTools, 'llm'>;
32
+ /**
33
+ * @@@
34
+ */
35
+ readonly llmTools: MultipleLlmExecutionTools;
36
+ /**
37
+ * @@@
38
+ */
39
+ readonly onProgress: (taskProgress: TaskProgress) => Promisable<void>;
40
+ /**
41
+ * Settings for the pipeline executor
42
+ */
43
+ readonly settings: CreatePipelineExecutorSettings;
44
+ /**
45
+ * @@@
46
+ */
47
+ readonly $executionReport: ExecutionReportJson;
48
+ /**
49
+ * @@@
50
+ */
51
+ readonly pipelineIdentification: string;
52
+ };
53
+ /**
54
+ * @@@
55
+ *
56
+ * @private internal utility of `createPipelineExecutor`
57
+ */
58
+ export declare function executeTemplate(options: executeSingleTemplateOptions): Promise<Readonly<Parameters>>;
59
+ export {};
60
+ /**
61
+ * TODO: [🤹‍♂️]
62
+ */
@@ -0,0 +1,30 @@
1
+ import type { ReadonlyDeep } from 'type-fest';
2
+ import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
3
+ import type { TemplateJson } from '../../types/PipelineJson/TemplateJson';
4
+ import type { TODO_any } from '../../utils/organization/TODO_any';
5
+ /**
6
+ * @@@
7
+ *
8
+ * @private internal type of `executeFormatCell`
9
+ */
10
+ type ExecuteFormatCellOptions = {
11
+ /**
12
+ * @@@
13
+ */
14
+ readonly preparedPipeline: ReadonlyDeep<PipelineJson>;
15
+ /**
16
+ * @@@
17
+ */
18
+ readonly template: ReadonlyDeep<TemplateJson>;
19
+ /**
20
+ * @@@
21
+ */
22
+ readonly pipelineIdentification: string;
23
+ };
24
+ /**
25
+ * @@@
26
+ *
27
+ * @private internal utility of `createPipelineExecutor`
28
+ */
29
+ export declare function executeFormatCell(options: ExecuteFormatCellOptions): Promise<TODO_any>;
30
+ export {};
@@ -0,0 +1,30 @@
1
+ import type { ReadonlyDeep } from 'type-fest';
2
+ import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
3
+ import type { TemplateJson } from '../../types/PipelineJson/TemplateJson';
4
+ import type { TODO_any } from '../../utils/organization/TODO_any';
5
+ /**
6
+ * @@@
7
+ *
8
+ * @private internal type of `executeAttempt`
9
+ */
10
+ type ExecuteAttemptOptions = {
11
+ /**
12
+ * @@@
13
+ */
14
+ readonly preparedPipeline: ReadonlyDeep<PipelineJson>;
15
+ /**
16
+ * @@@
17
+ */
18
+ readonly template: ReadonlyDeep<TemplateJson>;
19
+ /**
20
+ * @@@
21
+ */
22
+ readonly pipelineIdentification: string;
23
+ };
24
+ /**
25
+ * @@@
26
+ *
27
+ * @private internal utility of `createPipelineExecutor`
28
+ */
29
+ export declare function executeAttempt(options: ExecuteAttemptOptions): Promise<TODO_any>;
30
+ export {};
@@ -3,6 +3,32 @@ import { PipelineExecutionError } from '../../errors/PipelineExecutionError';
3
3
  import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
4
4
  import type { Parameters } from '../../types/typeAliases';
5
5
  /**
6
- * @private @@@
6
+ * @@@
7
+ *
8
+ * @private internal type of `createPipelineExecutor`
7
9
  */
8
- export declare function filterJustOutputParameters(preparedPipeline: ReadonlyDeep<PipelineJson>, parametersToPass: Readonly<Parameters>, $warnings: PipelineExecutionError[], pipelineIdentification: string): Parameters;
10
+ type FilterJustOutputParametersOptions = {
11
+ /**
12
+ * @@@
13
+ */
14
+ readonly preparedPipeline: ReadonlyDeep<PipelineJson>;
15
+ /**
16
+ * @@@
17
+ */
18
+ readonly parametersToPass: Readonly<Parameters>;
19
+ /**
20
+ * @@@
21
+ */
22
+ readonly $warnings: PipelineExecutionError[];
23
+ /**
24
+ * @@@
25
+ */
26
+ readonly pipelineIdentification: string;
27
+ };
28
+ /**
29
+ * @@@
30
+ *
31
+ * @private internal utility of `createPipelineExecutor`
32
+ */
33
+ export declare function filterJustOutputParameters(options: FilterJustOutputParametersOptions): Parameters;
34
+ export {};
@@ -3,6 +3,8 @@ import type { TemplateJson } from '../../types/PipelineJson/TemplateJson';
3
3
  import type { string_markdown } from '../../types/typeAliases';
4
4
  import type { string_parameter_value } from '../../types/typeAliases';
5
5
  /**
6
- * @private @@@
6
+ * @@@
7
+ *
8
+ * @private internal utility of `createPipelineExecutor`
7
9
  */
8
10
  export declare function getContextForTemplate(template: ReadonlyDeep<TemplateJson>): Promise<string_parameter_value & string_markdown>;
@@ -4,6 +4,24 @@ import type { TemplateJson } from '../../types/PipelineJson/TemplateJson';
4
4
  import type { string_markdown } from '../../types/typeAliases';
5
5
  import type { string_parameter_value } from '../../types/typeAliases';
6
6
  /**
7
- * @private @@@
7
+ * @@@
8
+ *
9
+ * @private internal type of `getKnowledgeForTemplate`
8
10
  */
9
- export declare function getKnowledgeForTemplate(preparedPipeline: ReadonlyDeep<PipelineJson>, template: ReadonlyDeep<TemplateJson>): Promise<string_parameter_value & string_markdown>;
11
+ type GetKnowledgeForTemplateOptions = {
12
+ /**
13
+ * @@@
14
+ */
15
+ readonly preparedPipeline: ReadonlyDeep<PipelineJson>;
16
+ /**
17
+ * @@@
18
+ */
19
+ readonly template: ReadonlyDeep<TemplateJson>;
20
+ };
21
+ /**
22
+ * @@@
23
+ *
24
+ * @private internal utility of `createPipelineExecutor`
25
+ */
26
+ export declare function getKnowledgeForTemplate(options: GetKnowledgeForTemplateOptions): Promise<string_parameter_value & string_markdown>;
27
+ export {};
@@ -3,6 +3,28 @@ import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
3
3
  import type { TemplateJson } from '../../types/PipelineJson/TemplateJson';
4
4
  import type { ReservedParameters } from '../../types/typeAliases';
5
5
  /**
6
- * @private @@@
6
+ * @@@
7
+ *
8
+ * @private internal type of `getReservedParametersForTemplate`
7
9
  */
8
- export declare function getReservedParametersForTemplate(preparedPipeline: ReadonlyDeep<PipelineJson>, template: ReadonlyDeep<TemplateJson>, pipelineIdentification: string): Promise<Readonly<ReservedParameters>>;
10
+ type GetReservedParametersForTemplateOptions = {
11
+ /**
12
+ * @@@
13
+ */
14
+ readonly preparedPipeline: ReadonlyDeep<PipelineJson>;
15
+ /**
16
+ * @@@
17
+ */
18
+ readonly template: ReadonlyDeep<TemplateJson>;
19
+ /**
20
+ * @@@
21
+ */
22
+ readonly pipelineIdentification: string;
23
+ };
24
+ /**
25
+ * @@@
26
+ *
27
+ * @private internal utility of `createPipelineExecutor`
28
+ */
29
+ export declare function getReservedParametersForTemplate(options: GetReservedParametersForTemplateOptions): Promise<Readonly<ReservedParameters>>;
30
+ export {};
@@ -3,6 +3,8 @@ import type { TemplateJson } from '../../types/PipelineJson/TemplateJson';
3
3
  import type { string_markdown } from '../../types/typeAliases';
4
4
  import type { string_parameter_value } from '../../types/typeAliases';
5
5
  /**
6
- * @private @@@
6
+ * @@@
7
+ *
8
+ * @private internal utility of `createPipelineExecutor`
7
9
  */
8
10
  export declare function getSamplesForTemplate(template: ReadonlyDeep<TemplateJson>): Promise<string_parameter_value & string_markdown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/node",
3
- "version": "0.69.0-4",
3
+ "version": "0.69.0-5",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -47,7 +47,7 @@
47
47
  "module": "./esm/index.es.js",
48
48
  "typings": "./esm/typings/src/_packages/node.index.d.ts",
49
49
  "peerDependencies": {
50
- "@promptbook/core": "0.69.0-4"
50
+ "@promptbook/core": "0.69.0-5"
51
51
  },
52
52
  "dependencies": {
53
53
  "colors": "1.4.0",