@promptbook/node 0.69.0-2 โ†’ 0.69.0-4

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.
@@ -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';
41
+ import { createPipelineExecutor } from '../execution/createPipelineExecutor/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,6 +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
21
  import type { EmbeddingVector } from '../execution/EmbeddingVector';
20
22
  import type { ExecutionTools } from '../execution/ExecutionTools';
21
23
  import type { LlmExecutionTools } from '../execution/LlmExecutionTools';
@@ -242,6 +244,8 @@ export type { renderPipelineMermaidOptions };
242
244
  export type { ErrorJson };
243
245
  export type { AvailableModel };
244
246
  export type { CommonExecutionToolsOptions };
247
+ export type { CreatePipelineExecutorOptions };
248
+ export type { CreatePipelineExecutorSettings };
245
249
  export type { EmbeddingVector };
246
250
  export type { ExecutionTools };
247
251
  export type { LlmExecutionTools };
@@ -1,3 +1,4 @@
1
+ import type { ReadonlyDeep } from 'type-fest';
1
2
  import type { TemplateJson } from '../../types/PipelineJson/TemplateJson';
2
3
  import type { string_parameter_name } from '../../types/typeAliases';
3
4
  /**
@@ -8,7 +9,7 @@ import type { string_parameter_name } from '../../types/typeAliases';
8
9
  * @throws {ParseError} if the script is invalid
9
10
  * @public exported from `@promptbook/utils`
10
11
  */
11
- export declare function extractParameterNamesFromTemplate(template: Pick<TemplateJson, 'title' | 'description' | 'templateType' | 'content' | 'preparedContent' | 'jokerParameterNames' | 'foreach'>): Set<string_parameter_name>;
12
+ export declare function extractParameterNamesFromTemplate(template: ReadonlyDeep<Pick<TemplateJson, 'title' | 'description' | 'templateType' | 'content' | 'preparedContent' | 'jokerParameterNames' | 'foreach'>>): Set<string_parameter_name>;
12
13
  /**
13
14
  * TODO: [๐Ÿ”ฃ] If script require contentLanguage
14
15
  */
@@ -0,0 +1,20 @@
1
+ import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
2
+ import type { ExecutionTools } from '../ExecutionTools';
3
+ import type { CreatePipelineExecutorSettings } from './CreatePipelineExecutorSettings';
4
+ /**
5
+ * Options for `createPipelineExecutor`
6
+ */
7
+ export interface CreatePipelineExecutorOptions {
8
+ /**
9
+ * The pipeline to be executed
10
+ */
11
+ readonly pipeline: PipelineJson;
12
+ /**
13
+ * The execution tools to be used during the execution of the pipeline
14
+ */
15
+ readonly tools: ExecutionTools;
16
+ /**
17
+ * Optional settings for the pipeline executor
18
+ */
19
+ readonly settings?: Partial<CreatePipelineExecutorSettings>;
20
+ }
@@ -0,0 +1,30 @@
1
+ export type CreatePipelineExecutorSettings = {
2
+ /**
3
+ * When executor does not satisfy expectations it will be retried this amount of times
4
+ *
5
+ * @default MAX_EXECUTION_ATTEMPTS
6
+ */
7
+ readonly maxExecutionAttempts?: number;
8
+ /**
9
+ * Maximum number of tasks running in parallel
10
+ *
11
+ * @default MAX_PARALLEL_COUNT
12
+ */
13
+ readonly maxParallelCount?: number;
14
+ /**
15
+ * If true, the preparation logs additional information
16
+ *
17
+ * @default false
18
+ */
19
+ readonly isVerbose?: boolean;
20
+ /**
21
+ * If you pass fully prepared pipeline, this does not matter
22
+ *
23
+ * Otherwise:
24
+ * If false or not set, warning is shown when pipeline is not prepared
25
+ * If true, warning is suppressed
26
+ *
27
+ * @default false
28
+ */
29
+ readonly isNotPreparedWarningSupressed?: boolean;
30
+ };
@@ -0,0 +1,24 @@
1
+ import type { PipelineExecutor } from '../PipelineExecutor';
2
+ import type { CreatePipelineExecutorOptions } from './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;
11
+ /**
12
+ * TODO: [๐Ÿคนโ€โ™‚๏ธ] Make some smarter system for limiting concurrent executions MAX_PARALLEL_TOTAL, MAX_PARALLEL_PER_LLM
13
+ * TODO: !!! Identify not only pipeline BUT exact template ${block(pipelineIdentification)}
14
+ * TODO: Use isVerbose here (not only pass to `preparePipeline`)
15
+ * TODO: [๐Ÿง ][๐ŸŒณ] Use here `countTotalUsage` and put preparation and prepared pipiline to report
16
+ * TODO: [๐Ÿช‚] Use maxParallelCount here (not only pass to `preparePipeline`)
17
+ * TODO: [โ™ˆ] Probbably move expectations from templates to parameters
18
+ * TODO: [๐Ÿง ] When not meet expectations in DIALOG_TEMPLATE, make some way to tell the user
19
+ * TODO: [๐Ÿ‘ง] Strongly type the executors to avoid need of remove nullables whtn noUncheckedIndexedAccess in tsconfig.json
20
+ * Note: CreatePipelineExecutorOptions are just connected to PipelineExecutor so do not extract to types folder
21
+ * TODO: [๐Ÿง ][๐Ÿธ] transparent = (report intermediate parameters) / opaque execution = (report only output parameters) progress reporting mode
22
+ * TODO: [๐Ÿ› ] Actions, instruments (and maybe knowledge) => Functions and tools
23
+ * TODO: [๐Ÿง ][๐Ÿ’ท] `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result BUT maybe NOT to preserve pure JSON object
24
+ */
@@ -0,0 +1,27 @@
1
+ import { Promisable, ReadonlyDeep } from 'type-fest';
2
+ import type { ExecutionReportJson } from '../../types/execution-report/ExecutionReportJson';
3
+ import type { ExecutionTools } from '../ExecutionTools';
4
+ import { MultipleLlmExecutionTools } from '../../llm-providers/multiple/MultipleLlmExecutionTools';
5
+ import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
6
+ import type { TemplateJson } from '../../types/PipelineJson/TemplateJson';
7
+ import type { TaskProgress } from '../../types/TaskProgress';
8
+ import type { Parameters } from '../../types/typeAliases';
9
+ type executeSingleTemplateOptions = {
10
+ currentTemplate: ReadonlyDeep<TemplateJson>;
11
+ preparedPipeline: ReadonlyDeep<PipelineJson>;
12
+ parametersToPass: Readonly<Parameters>;
13
+ tools: Omit<ExecutionTools, 'llm'>;
14
+ llmTools: MultipleLlmExecutionTools;
15
+ onProgress: (taskProgress: TaskProgress) => Promisable<void>;
16
+ maxExecutionAttempts: number;
17
+ $executionReport: ExecutionReportJson;
18
+ pipelineIdentification: string;
19
+ };
20
+ /**
21
+ * @private @@@
22
+ */
23
+ export declare function executeSingleTemplate(options: executeSingleTemplateOptions): Promise<Readonly<Parameters>>;
24
+ export {};
25
+ /**
26
+ * TODO: [๐Ÿคนโ€โ™‚๏ธ]
27
+ */
@@ -0,0 +1,8 @@
1
+ import type { ReadonlyDeep } from 'type-fest';
2
+ import { PipelineExecutionError } from '../../errors/PipelineExecutionError';
3
+ import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
4
+ import type { Parameters } from '../../types/typeAliases';
5
+ /**
6
+ * @private @@@
7
+ */
8
+ export declare function filterJustOutputParameters(preparedPipeline: ReadonlyDeep<PipelineJson>, parametersToPass: Readonly<Parameters>, $warnings: PipelineExecutionError[], pipelineIdentification: string): Parameters;
@@ -0,0 +1,8 @@
1
+ import type { ReadonlyDeep } from 'type-fest';
2
+ import type { TemplateJson } from '../../types/PipelineJson/TemplateJson';
3
+ import type { string_markdown } from '../../types/typeAliases';
4
+ import type { string_parameter_value } from '../../types/typeAliases';
5
+ /**
6
+ * @private @@@
7
+ */
8
+ export declare function getContextForTemplate(template: ReadonlyDeep<TemplateJson>): Promise<string_parameter_value & string_markdown>;
@@ -0,0 +1,9 @@
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 { string_markdown } from '../../types/typeAliases';
5
+ import type { string_parameter_value } from '../../types/typeAliases';
6
+ /**
7
+ * @private @@@
8
+ */
9
+ export declare function getKnowledgeForTemplate(preparedPipeline: ReadonlyDeep<PipelineJson>, template: ReadonlyDeep<TemplateJson>): Promise<string_parameter_value & string_markdown>;
@@ -0,0 +1,8 @@
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 { ReservedParameters } from '../../types/typeAliases';
5
+ /**
6
+ * @private @@@
7
+ */
8
+ export declare function getReservedParametersForTemplate(preparedPipeline: ReadonlyDeep<PipelineJson>, template: ReadonlyDeep<TemplateJson>, pipelineIdentification: string): Promise<Readonly<ReservedParameters>>;
@@ -0,0 +1,8 @@
1
+ import type { ReadonlyDeep } from 'type-fest';
2
+ import type { TemplateJson } from '../../types/PipelineJson/TemplateJson';
3
+ import type { string_markdown } from '../../types/typeAliases';
4
+ import type { string_parameter_value } from '../../types/typeAliases';
5
+ /**
6
+ * @private @@@
7
+ */
8
+ 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-2",
3
+ "version": "0.69.0-4",
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-2"
50
+ "@promptbook/core": "0.69.0-4"
51
51
  },
52
52
  "dependencies": {
53
53
  "colors": "1.4.0",