@promptbook/openai 0.52.0-28 → 0.52.0-29

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.
@@ -5,6 +5,7 @@ import { extractVariables } from '../conversion/utils/extractVariables';
5
5
  import { parseNumber } from '../conversion/utils/parseNumber';
6
6
  import { renameParameter } from '../conversion/utils/renameParameter';
7
7
  import { titleToName } from '../conversion/utils/titleToName';
8
+ import { forEachAsync } from '../execution/utils/forEachAsync';
8
9
  import { replaceParameters } from '../execution/utils/replaceParameters';
9
10
  import { CountUtils } from '../utils/expectation-counters';
10
11
  import { countCharacters } from '../utils/expectation-counters/countCharacters';
@@ -46,6 +47,7 @@ import { union } from '../utils/sets/union';
46
47
  import { trimCodeBlock } from '../utils/trimCodeBlock';
47
48
  import { trimEndOfCodeBlock } from '../utils/trimEndOfCodeBlock';
48
49
  import { unwrapResult } from '../utils/unwrapResult';
50
+ export { forEachAsync };
49
51
  export { extractAllBlocksFromMarkdown, // <- [🌻]
50
52
  extractAllListItemsFromMarkdown, extractBlock, // <- [🌻]
51
53
  extractOneBlockFromMarkdown, extractParameters, extractVariables, isValidJsonString, parseNumber, // <- [🌻]
@@ -0,0 +1,18 @@
1
+ import type { Promisable } from 'type-fest';
2
+ type ForEachAsyncOptions = {
3
+ /**
4
+ * Maximum number of tasks running in parallel
5
+ *
6
+ * @default Infinity
7
+ */
8
+ inParallelCount?: number;
9
+ };
10
+ /**
11
+ * Async version of Array.forEach
12
+ *
13
+ * @param array - Array to iterate over
14
+ * @param options - Options for the function
15
+ * @param callbackfunction - Function to call for each item
16
+ */
17
+ export declare function forEachAsync<TItem>(array: Array<TItem>, options: ForEachAsyncOptions, callbackfunction: (value: TItem, index: number, array: Array<TItem>) => Promisable<void>): Promise<void>;
18
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/openai",
3
- "version": "0.52.0-28",
3
+ "version": "0.52.0-29",
4
4
  "description": "Library to supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -48,7 +48,7 @@
48
48
  }
49
49
  ],
50
50
  "peerDependencies": {
51
- "@promptbook/core": "0.52.0-28"
51
+ "@promptbook/core": "0.52.0-29"
52
52
  },
53
53
  "main": "./umd/index.umd.js",
54
54
  "module": "./esm/index.es.js",
@@ -5,6 +5,7 @@ import { extractVariables } from '../conversion/utils/extractVariables';
5
5
  import { parseNumber } from '../conversion/utils/parseNumber';
6
6
  import { renameParameter } from '../conversion/utils/renameParameter';
7
7
  import { titleToName } from '../conversion/utils/titleToName';
8
+ import { forEachAsync } from '../execution/utils/forEachAsync';
8
9
  import { replaceParameters } from '../execution/utils/replaceParameters';
9
10
  import { CountUtils } from '../utils/expectation-counters';
10
11
  import { countCharacters } from '../utils/expectation-counters/countCharacters';
@@ -46,6 +47,7 @@ import { union } from '../utils/sets/union';
46
47
  import { trimCodeBlock } from '../utils/trimCodeBlock';
47
48
  import { trimEndOfCodeBlock } from '../utils/trimEndOfCodeBlock';
48
49
  import { unwrapResult } from '../utils/unwrapResult';
50
+ export { forEachAsync };
49
51
  export { extractAllBlocksFromMarkdown, // <- [🌻]
50
52
  extractAllListItemsFromMarkdown, extractBlock, // <- [🌻]
51
53
  extractOneBlockFromMarkdown, extractParameters, extractVariables, isValidJsonString, parseNumber, // <- [🌻]
@@ -0,0 +1,18 @@
1
+ import type { Promisable } from 'type-fest';
2
+ type ForEachAsyncOptions = {
3
+ /**
4
+ * Maximum number of tasks running in parallel
5
+ *
6
+ * @default Infinity
7
+ */
8
+ inParallelCount?: number;
9
+ };
10
+ /**
11
+ * Async version of Array.forEach
12
+ *
13
+ * @param array - Array to iterate over
14
+ * @param options - Options for the function
15
+ * @param callbackfunction - Function to call for each item
16
+ */
17
+ export declare function forEachAsync<TItem>(array: Array<TItem>, options: ForEachAsyncOptions, callbackfunction: (value: TItem, index: number, array: Array<TItem>) => Promisable<void>): Promise<void>;
18
+ export {};