@promptbook/openai 0.24.0-2.4 → 0.25.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.
@@ -6,9 +6,18 @@ import { Prompt } from '../types/Prompt';
6
6
  import { PromptTemplatePipelineJson } from '../types/PromptTemplatePipelineJson/PromptTemplatePipelineJson';
7
7
  import { PromptTemplatePipelineString } from '../types/PromptTemplatePipelineString';
8
8
  import { PromptTemplatePipeline } from './PromptTemplatePipeline';
9
+ /**
10
+ * Options for PromptTemplatePipelineLibrary
11
+ */
9
12
  type PromptTemplatePipelineLibraryOptions = {
13
+ /**
14
+ * The library of prompt template pipelines
15
+ */
10
16
  readonly library: Record<string_name, PromptTemplatePipeline>;
11
- readonly settings: CreatePtpExecutorSettings;
17
+ /**
18
+ * Optional settings for creating a PromptTemplatePipelineExecutor
19
+ */
20
+ readonly settings?: Partial<CreatePtpExecutorSettings>;
12
21
  };
13
22
  /**
14
23
  * Library of prompt template pipelines that groups together prompt template pipelines for an application. This is a very thin wrapper around the Array / Set of prompt template pipelines.
@@ -28,9 +37,10 @@ export declare class PromptTemplatePipelineLibrary {
28
37
  * Note: You can combine .ptbk.md and .ptbk.json files BUT it is not recommended
29
38
  *
30
39
  * @param ptbkSources contents of .ptbk.md or .ptbk.json files
40
+ * @param settings settings for creating executor functions
31
41
  * @returns PromptTemplatePipelineLibrary
32
42
  */
33
- static fromSources(ptbkSources: Record<string_name, PromptTemplatePipelineJson | PromptTemplatePipelineString>, settings: CreatePtpExecutorSettings): PromptTemplatePipelineLibrary;
43
+ static fromSources(ptbkSources: Record<string_name, PromptTemplatePipelineJson | PromptTemplatePipelineString>, settings?: Partial<CreatePtpExecutorSettings>): PromptTemplatePipelineLibrary;
34
44
  private constructor();
35
45
  /**
36
46
  * Gets prompt template pipeline by name
@@ -5,14 +5,26 @@ export interface CreatePtpExecutorSettings {
5
5
  /**
6
6
  * When executor does not satisfy expectations it will be retried this amount of times
7
7
  *
8
- * !!!!!!! Make default in version 24.1.0
8
+ * @default 3
9
9
  */
10
10
  readonly maxNaturalExecutionAttempts: number;
11
11
  }
12
+ /**
13
+ * Options for creating a PTP (Prompt Template Pipeline) executor
14
+ */
12
15
  interface CreatePtpExecutorOptions {
16
+ /**
17
+ * The Prompt Template Pipeline (PTP) to be executed
18
+ */
13
19
  readonly ptp: PromptTemplatePipeline;
20
+ /**
21
+ * The execution tools to be used during the execution of the PTP
22
+ */
14
23
  readonly tools: ExecutionTools;
15
- readonly settings: CreatePtpExecutorSettings;
24
+ /**
25
+ * Optional settings for the PTP executor
26
+ */
27
+ readonly settings?: Partial<CreatePtpExecutorSettings>;
16
28
  }
17
29
  /**
18
30
  * Creates executor function from prompt template pipeline and execution tools.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/openai",
3
- "version": "0.24.0-2.4",
3
+ "version": "0.25.0",
4
4
  "description": "Library to supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -37,7 +37,7 @@
37
37
  "openai": "4.2.0"
38
38
  },
39
39
  "peerDependencies": {
40
- "@promptbook/core": "0.24.0-2.4"
40
+ "@promptbook/core": "0.25.0"
41
41
  },
42
42
  "main": "./umd/index.umd.js",
43
43
  "module": "./esm/index.es.js",
@@ -6,9 +6,18 @@ import { Prompt } from '../types/Prompt';
6
6
  import { PromptTemplatePipelineJson } from '../types/PromptTemplatePipelineJson/PromptTemplatePipelineJson';
7
7
  import { PromptTemplatePipelineString } from '../types/PromptTemplatePipelineString';
8
8
  import { PromptTemplatePipeline } from './PromptTemplatePipeline';
9
+ /**
10
+ * Options for PromptTemplatePipelineLibrary
11
+ */
9
12
  type PromptTemplatePipelineLibraryOptions = {
13
+ /**
14
+ * The library of prompt template pipelines
15
+ */
10
16
  readonly library: Record<string_name, PromptTemplatePipeline>;
11
- readonly settings: CreatePtpExecutorSettings;
17
+ /**
18
+ * Optional settings for creating a PromptTemplatePipelineExecutor
19
+ */
20
+ readonly settings?: Partial<CreatePtpExecutorSettings>;
12
21
  };
13
22
  /**
14
23
  * Library of prompt template pipelines that groups together prompt template pipelines for an application. This is a very thin wrapper around the Array / Set of prompt template pipelines.
@@ -28,9 +37,10 @@ export declare class PromptTemplatePipelineLibrary {
28
37
  * Note: You can combine .ptbk.md and .ptbk.json files BUT it is not recommended
29
38
  *
30
39
  * @param ptbkSources contents of .ptbk.md or .ptbk.json files
40
+ * @param settings settings for creating executor functions
31
41
  * @returns PromptTemplatePipelineLibrary
32
42
  */
33
- static fromSources(ptbkSources: Record<string_name, PromptTemplatePipelineJson | PromptTemplatePipelineString>, settings: CreatePtpExecutorSettings): PromptTemplatePipelineLibrary;
43
+ static fromSources(ptbkSources: Record<string_name, PromptTemplatePipelineJson | PromptTemplatePipelineString>, settings?: Partial<CreatePtpExecutorSettings>): PromptTemplatePipelineLibrary;
34
44
  private constructor();
35
45
  /**
36
46
  * Gets prompt template pipeline by name
@@ -5,14 +5,26 @@ export interface CreatePtpExecutorSettings {
5
5
  /**
6
6
  * When executor does not satisfy expectations it will be retried this amount of times
7
7
  *
8
- * !!!!!!! Make default in version 24.1.0
8
+ * @default 3
9
9
  */
10
10
  readonly maxNaturalExecutionAttempts: number;
11
11
  }
12
+ /**
13
+ * Options for creating a PTP (Prompt Template Pipeline) executor
14
+ */
12
15
  interface CreatePtpExecutorOptions {
16
+ /**
17
+ * The Prompt Template Pipeline (PTP) to be executed
18
+ */
13
19
  readonly ptp: PromptTemplatePipeline;
20
+ /**
21
+ * The execution tools to be used during the execution of the PTP
22
+ */
14
23
  readonly tools: ExecutionTools;
15
- readonly settings: CreatePtpExecutorSettings;
24
+ /**
25
+ * Optional settings for the PTP executor
26
+ */
27
+ readonly settings?: Partial<CreatePtpExecutorSettings>;
16
28
  }
17
29
  /**
18
30
  * Creates executor function from prompt template pipeline and execution tools.