@promptbook/openai 0.44.0-4 → 0.44.0-6

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.
@@ -1,6 +1,7 @@
1
1
  import { prettifyPromptbookString } from '../conversion/prettify/prettifyPromptbookString';
2
2
  import { parseNumber } from '../conversion/utils/parseNumber';
3
3
  import { assertsExecutionSuccessful } from '../execution/assertsExecutionSuccessful';
4
+ import { checkExpectations, isPassingExpectations } from '../execution/utils/checkExpectations';
4
5
  import { replaceParameters } from '../execution/utils/replaceParameters';
5
6
  import { executionReportJsonToString } from '../types/execution-report/executionReportJsonToString';
6
7
  import { ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults } from '../types/execution-report/ExecutionReportStringOptions';
@@ -40,9 +41,9 @@ import { removeQuotes } from '../utils/removeQuotes';
40
41
  import { trimCodeBlock } from '../utils/trimCodeBlock';
41
42
  import { trimEndOfCodeBlock } from '../utils/trimEndOfCodeBlock';
42
43
  import { unwrapResult } from '../utils/unwrapResult';
43
- export { assertsExecutionSuccessful, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, extractAllBlocksFromMarkdown, // <- [🌻]
44
+ export { assertsExecutionSuccessful, checkExpectations, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, extractAllBlocksFromMarkdown, // <- [🌻]
44
45
  extractAllListItemsFromMarkdown, extractBlock, // <- [🌻]
45
- extractOneBlockFromMarkdown, isValidJsonString, parseNumber, // <- [🌻]
46
+ extractOneBlockFromMarkdown, isPassingExpectations, isValidJsonString, parseNumber, // <- [🌻]
46
47
  prettifyPromptbookString, removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, trimCodeBlock, trimEndOfCodeBlock, unwrapResult, };
47
48
  export { countCharacters, countLines, countPages, countParagraphs, countSentences, CountUtils, countWords };
48
49
  export { splitIntoSentences };
@@ -5,3 +5,7 @@ import type { Expectations } from '../../../../types/PromptbookJson/PromptTempla
5
5
  * @private internal util for MockedFackedNaturalExecutionTools
6
6
  */
7
7
  export declare function $fakeTextToExpectations(expectations: Expectations): string;
8
+ /**
9
+ * TODO: Implement better
10
+ * TODO: [💝] Unite object for expecting amount and format - use here also a format
11
+ */
@@ -0,0 +1,25 @@
1
+ import type { Expectations } from '../../types/PromptbookJson/PromptTemplateJson';
2
+ /**
3
+ * Function checkExpectations will check if the expectations on given value are met
4
+ *
5
+ * Note: There are two simmilar functions:
6
+ * - `checkExpectations` which throws an error if the expectations are not met
7
+ * - `isPassingExpectations` which returns a boolean
8
+ *
9
+ * @throws {ExpectError} if the expectations are not met
10
+ * @returns {void} Nothing
11
+ */
12
+ export declare function checkExpectations(expectations: Expectations, value: string): void;
13
+ /**
14
+ * Function checkExpectations will check if the expectations on given value are met
15
+ *
16
+ * Note: There are two simmilar functions:
17
+ * - `checkExpectations` which throws an error if the expectations are not met
18
+ * - `isPassingExpectations` which returns a boolean
19
+ *
20
+ * @returns {boolean} True if the expectations are met
21
+ */
22
+ export declare function isPassingExpectations(expectations: Expectations, value: string): boolean;
23
+ /**
24
+ * TODO: [💝] Unite object for expecting amount and format
25
+ */
@@ -130,5 +130,6 @@ interface PromptTemplateJsonCommon {
130
130
  }
131
131
  export {};
132
132
  /**
133
+ * TODO: [💝] Unite object for expecting amount and format - remove expectFormat
133
134
  * TODO: use one helper type> (string_prompt | string_javascript | string_markdown) & string_template
134
135
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/openai",
3
- "version": "0.44.0-4",
3
+ "version": "0.44.0-6",
4
4
  "description": "Library to supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -38,7 +38,7 @@
38
38
  "openai": "4.2.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "@promptbook/core": "0.44.0-4"
41
+ "@promptbook/core": "0.44.0-6"
42
42
  },
43
43
  "main": "./umd/index.umd.js",
44
44
  "module": "./esm/index.es.js",
@@ -1,6 +1,7 @@
1
1
  import { prettifyPromptbookString } from '../conversion/prettify/prettifyPromptbookString';
2
2
  import { parseNumber } from '../conversion/utils/parseNumber';
3
3
  import { assertsExecutionSuccessful } from '../execution/assertsExecutionSuccessful';
4
+ import { checkExpectations, isPassingExpectations } from '../execution/utils/checkExpectations';
4
5
  import { replaceParameters } from '../execution/utils/replaceParameters';
5
6
  import { executionReportJsonToString } from '../types/execution-report/executionReportJsonToString';
6
7
  import { ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults } from '../types/execution-report/ExecutionReportStringOptions';
@@ -40,9 +41,9 @@ import { removeQuotes } from '../utils/removeQuotes';
40
41
  import { trimCodeBlock } from '../utils/trimCodeBlock';
41
42
  import { trimEndOfCodeBlock } from '../utils/trimEndOfCodeBlock';
42
43
  import { unwrapResult } from '../utils/unwrapResult';
43
- export { assertsExecutionSuccessful, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, extractAllBlocksFromMarkdown, // <- [🌻]
44
+ export { assertsExecutionSuccessful, checkExpectations, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, extractAllBlocksFromMarkdown, // <- [🌻]
44
45
  extractAllListItemsFromMarkdown, extractBlock, // <- [🌻]
45
- extractOneBlockFromMarkdown, isValidJsonString, parseNumber, // <- [🌻]
46
+ extractOneBlockFromMarkdown, isPassingExpectations, isValidJsonString, parseNumber, // <- [🌻]
46
47
  prettifyPromptbookString, removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, trimCodeBlock, trimEndOfCodeBlock, unwrapResult, };
47
48
  export { countCharacters, countLines, countPages, countParagraphs, countSentences, CountUtils, countWords };
48
49
  export { splitIntoSentences };
@@ -5,3 +5,7 @@ import type { Expectations } from '../../../../types/PromptbookJson/PromptTempla
5
5
  * @private internal util for MockedFackedNaturalExecutionTools
6
6
  */
7
7
  export declare function $fakeTextToExpectations(expectations: Expectations): string;
8
+ /**
9
+ * TODO: Implement better
10
+ * TODO: [💝] Unite object for expecting amount and format - use here also a format
11
+ */
@@ -0,0 +1,25 @@
1
+ import type { Expectations } from '../../types/PromptbookJson/PromptTemplateJson';
2
+ /**
3
+ * Function checkExpectations will check if the expectations on given value are met
4
+ *
5
+ * Note: There are two simmilar functions:
6
+ * - `checkExpectations` which throws an error if the expectations are not met
7
+ * - `isPassingExpectations` which returns a boolean
8
+ *
9
+ * @throws {ExpectError} if the expectations are not met
10
+ * @returns {void} Nothing
11
+ */
12
+ export declare function checkExpectations(expectations: Expectations, value: string): void;
13
+ /**
14
+ * Function checkExpectations will check if the expectations on given value are met
15
+ *
16
+ * Note: There are two simmilar functions:
17
+ * - `checkExpectations` which throws an error if the expectations are not met
18
+ * - `isPassingExpectations` which returns a boolean
19
+ *
20
+ * @returns {boolean} True if the expectations are met
21
+ */
22
+ export declare function isPassingExpectations(expectations: Expectations, value: string): boolean;
23
+ /**
24
+ * TODO: [💝] Unite object for expecting amount and format
25
+ */
@@ -130,5 +130,6 @@ interface PromptTemplateJsonCommon {
130
130
  }
131
131
  export {};
132
132
  /**
133
+ * TODO: [💝] Unite object for expecting amount and format - remove expectFormat
133
134
  * TODO: use one helper type> (string_prompt | string_javascript | string_markdown) & string_template
134
135
  */