@promptbook/openai 0.44.0-0 → 0.44.0-1

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.
@@ -9,7 +9,7 @@ import { countCharacters } from '../utils/expectation-counters/countCharacters';
9
9
  import { countLines } from '../utils/expectation-counters/countLines';
10
10
  import { countPages } from '../utils/expectation-counters/countPages';
11
11
  import { countParagraphs } from '../utils/expectation-counters/countParagraphs';
12
- import { countSentences } from '../utils/expectation-counters/countSentences';
12
+ import { countSentences, splitIntoSentences } from '../utils/expectation-counters/countSentences';
13
13
  import { countWords } from '../utils/expectation-counters/countWords';
14
14
  import { isValidJsonString } from '../utils/isValidJsonString';
15
15
  import { extractAllBlocksFromMarkdown } from '../utils/markdown/extractAllBlocksFromMarkdown';
@@ -17,16 +17,6 @@ import { extractAllListItemsFromMarkdown } from '../utils/markdown/extractAllLis
17
17
  import { extractOneBlockFromMarkdown } from '../utils/markdown/extractOneBlockFromMarkdown';
18
18
  import { removeContentComments } from '../utils/markdown/removeContentComments';
19
19
  import { removeMarkdownFormatting } from '../utils/markdown/removeMarkdownFormatting';
20
- import { extractBlock } from '../utils/postprocessing/extractBlock';
21
- import { removeEmojis } from '../utils/removeEmojis';
22
- import { removeQuotes } from '../utils/removeQuotes';
23
- import { trimCodeBlock } from '../utils/trimCodeBlock';
24
- import { trimEndOfCodeBlock } from '../utils/trimEndOfCodeBlock';
25
- import { unwrapResult } from '../utils/unwrapResult';
26
- export { assertsExecutionSuccessful, countCharacters, countLines, countPages, countParagraphs, countSentences, CountUtils, countWords, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, extractAllBlocksFromMarkdown, // <- [🌻]
27
- extractAllListItemsFromMarkdown, extractBlock, // <- [🌻]
28
- extractOneBlockFromMarkdown, isValidJsonString, parseNumber, // <- [🌻]
29
- prettifyPromptbookString, removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, trimCodeBlock, trimEndOfCodeBlock, unwrapResult, };
30
20
  import { capitalize } from '../utils/normalization/capitalize';
31
21
  import { decapitalize } from '../utils/normalization/decapitalize';
32
22
  import { DIACRITIC_VARIANTS_LETTERS } from '../utils/normalization/DIACRITIC_VARIANTS_LETTERS';
@@ -44,6 +34,25 @@ import { parseKeywords } from '../utils/normalization/parseKeywords';
44
34
  import { parseKeywordsFromString } from '../utils/normalization/parseKeywordsFromString';
45
35
  import { removeDiacritics } from '../utils/normalization/removeDiacritics';
46
36
  import { searchKeywords } from '../utils/normalization/searchKeywords';
37
+ import { extractBlock } from '../utils/postprocessing/extractBlock';
38
+ import { removeEmojis } from '../utils/removeEmojis';
39
+ import { removeQuotes } from '../utils/removeQuotes';
40
+ import { trimCodeBlock } from '../utils/trimCodeBlock';
41
+ import { trimEndOfCodeBlock } from '../utils/trimEndOfCodeBlock';
42
+ import { unwrapResult } from '../utils/unwrapResult';
43
+ export { assertsExecutionSuccessful, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, extractAllBlocksFromMarkdown, // <- [🌻]
44
+ extractAllListItemsFromMarkdown, extractBlock, // <- [🌻]
45
+ extractOneBlockFromMarkdown, isValidJsonString, parseNumber, // <- [🌻]
46
+ prettifyPromptbookString, removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, trimCodeBlock, trimEndOfCodeBlock, unwrapResult, };
47
+ export { countCharacters, countLines, countPages, countParagraphs, countSentences, CountUtils, countWords };
48
+ export { splitIntoSentences };
49
+ export declare const normalizeTo: {
50
+ camelCase: typeof normalizeTo_camelCase;
51
+ PascalCase: typeof normalizeTo_PascalCase;
52
+ 'SCREAMING-CASE': typeof normalizeTo_SCREAMING_CASE;
53
+ snake_case: typeof normalizeTo_snake_case;
54
+ 'kebab-case': typeof normalizeToKebabCase;
55
+ };
47
56
  export { capitalize, decapitalize, DIACRITIC_VARIANTS_LETTERS, IKeywords, isValidKeyword, nameToUriPart, nameToUriParts, normalizeTo_camelCase, normalizeTo_PascalCase, normalizeTo_SCREAMING_CASE, normalizeTo_snake_case, normalizeToKebabCase, normalizeWhitespaces, parseKeywords, parseKeywordsFromString, removeDiacritics, searchKeywords, string_keyword, };
48
57
  /**
49
58
  * TODO: [🧠] Maybe create some indipendent package like `markdown-tools` from both here exported and @private utilities
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This error indicates that promptbook not found in the library
3
+ */
4
+ export declare class PromptbookNotFoundError extends Error {
5
+ readonly name = "PromptbookNotFoundError";
6
+ constructor(message: string);
7
+ }
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * This error occurs when some expectation is not met in the execution of the pipeline
3
3
  *
4
+ * @private Always catched and rethrown as `PromptbookExecutionError`
4
5
  * Note: This is a kindof subtype of PromptbookExecutionError
5
6
  */
6
7
  export declare class ExpectError extends Error {
@@ -1,4 +1,8 @@
1
1
  import type { ExpectationAmount } from '../../types/PromptbookJson/PromptTemplateJson';
2
+ /**
3
+ * Split text into sentences
4
+ */
5
+ export declare function splitIntoSentences(text: string): Array<string>;
2
6
  /**
3
7
  * Counts number of sentences in the text
4
8
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/openai",
3
- "version": "0.44.0-0",
3
+ "version": "0.44.0-1",
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-0"
41
+ "@promptbook/core": "0.44.0-1"
42
42
  },
43
43
  "main": "./umd/index.umd.js",
44
44
  "module": "./esm/index.es.js",
@@ -9,7 +9,7 @@ import { countCharacters } from '../utils/expectation-counters/countCharacters';
9
9
  import { countLines } from '../utils/expectation-counters/countLines';
10
10
  import { countPages } from '../utils/expectation-counters/countPages';
11
11
  import { countParagraphs } from '../utils/expectation-counters/countParagraphs';
12
- import { countSentences } from '../utils/expectation-counters/countSentences';
12
+ import { countSentences, splitIntoSentences } from '../utils/expectation-counters/countSentences';
13
13
  import { countWords } from '../utils/expectation-counters/countWords';
14
14
  import { isValidJsonString } from '../utils/isValidJsonString';
15
15
  import { extractAllBlocksFromMarkdown } from '../utils/markdown/extractAllBlocksFromMarkdown';
@@ -17,16 +17,6 @@ import { extractAllListItemsFromMarkdown } from '../utils/markdown/extractAllLis
17
17
  import { extractOneBlockFromMarkdown } from '../utils/markdown/extractOneBlockFromMarkdown';
18
18
  import { removeContentComments } from '../utils/markdown/removeContentComments';
19
19
  import { removeMarkdownFormatting } from '../utils/markdown/removeMarkdownFormatting';
20
- import { extractBlock } from '../utils/postprocessing/extractBlock';
21
- import { removeEmojis } from '../utils/removeEmojis';
22
- import { removeQuotes } from '../utils/removeQuotes';
23
- import { trimCodeBlock } from '../utils/trimCodeBlock';
24
- import { trimEndOfCodeBlock } from '../utils/trimEndOfCodeBlock';
25
- import { unwrapResult } from '../utils/unwrapResult';
26
- export { assertsExecutionSuccessful, countCharacters, countLines, countPages, countParagraphs, countSentences, CountUtils, countWords, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, extractAllBlocksFromMarkdown, // <- [🌻]
27
- extractAllListItemsFromMarkdown, extractBlock, // <- [🌻]
28
- extractOneBlockFromMarkdown, isValidJsonString, parseNumber, // <- [🌻]
29
- prettifyPromptbookString, removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, trimCodeBlock, trimEndOfCodeBlock, unwrapResult, };
30
20
  import { capitalize } from '../utils/normalization/capitalize';
31
21
  import { decapitalize } from '../utils/normalization/decapitalize';
32
22
  import { DIACRITIC_VARIANTS_LETTERS } from '../utils/normalization/DIACRITIC_VARIANTS_LETTERS';
@@ -44,6 +34,25 @@ import { parseKeywords } from '../utils/normalization/parseKeywords';
44
34
  import { parseKeywordsFromString } from '../utils/normalization/parseKeywordsFromString';
45
35
  import { removeDiacritics } from '../utils/normalization/removeDiacritics';
46
36
  import { searchKeywords } from '../utils/normalization/searchKeywords';
37
+ import { extractBlock } from '../utils/postprocessing/extractBlock';
38
+ import { removeEmojis } from '../utils/removeEmojis';
39
+ import { removeQuotes } from '../utils/removeQuotes';
40
+ import { trimCodeBlock } from '../utils/trimCodeBlock';
41
+ import { trimEndOfCodeBlock } from '../utils/trimEndOfCodeBlock';
42
+ import { unwrapResult } from '../utils/unwrapResult';
43
+ export { assertsExecutionSuccessful, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, extractAllBlocksFromMarkdown, // <- [🌻]
44
+ extractAllListItemsFromMarkdown, extractBlock, // <- [🌻]
45
+ extractOneBlockFromMarkdown, isValidJsonString, parseNumber, // <- [🌻]
46
+ prettifyPromptbookString, removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, trimCodeBlock, trimEndOfCodeBlock, unwrapResult, };
47
+ export { countCharacters, countLines, countPages, countParagraphs, countSentences, CountUtils, countWords };
48
+ export { splitIntoSentences };
49
+ export declare const normalizeTo: {
50
+ camelCase: typeof normalizeTo_camelCase;
51
+ PascalCase: typeof normalizeTo_PascalCase;
52
+ 'SCREAMING-CASE': typeof normalizeTo_SCREAMING_CASE;
53
+ snake_case: typeof normalizeTo_snake_case;
54
+ 'kebab-case': typeof normalizeToKebabCase;
55
+ };
47
56
  export { capitalize, decapitalize, DIACRITIC_VARIANTS_LETTERS, IKeywords, isValidKeyword, nameToUriPart, nameToUriParts, normalizeTo_camelCase, normalizeTo_PascalCase, normalizeTo_SCREAMING_CASE, normalizeTo_snake_case, normalizeToKebabCase, normalizeWhitespaces, parseKeywords, parseKeywordsFromString, removeDiacritics, searchKeywords, string_keyword, };
48
57
  /**
49
58
  * TODO: [🧠] Maybe create some indipendent package like `markdown-tools` from both here exported and @private utilities
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This error indicates that promptbook not found in the library
3
+ */
4
+ export declare class PromptbookNotFoundError extends Error {
5
+ readonly name = "PromptbookNotFoundError";
6
+ constructor(message: string);
7
+ }
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * This error occurs when some expectation is not met in the execution of the pipeline
3
3
  *
4
+ * @private Always catched and rethrown as `PromptbookExecutionError`
4
5
  * Note: This is a kindof subtype of PromptbookExecutionError
5
6
  */
6
7
  export declare class ExpectError extends Error {
@@ -1,4 +1,8 @@
1
1
  import type { ExpectationAmount } from '../../types/PromptbookJson/PromptTemplateJson';
2
+ /**
3
+ * Split text into sentences
4
+ */
5
+ export declare function splitIntoSentences(text: string): Array<string>;
2
6
  /**
3
7
  * Counts number of sentences in the text
4
8
  */
@@ -1,7 +0,0 @@
1
- /**
2
- * This error indicates that the requested resource (for example promptbook in the library ) was not found
3
- */
4
- export declare class NotFoundError extends Error {
5
- readonly name = "NotFoundError";
6
- constructor(message: string);
7
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * This error indicates that the requested resource (for example promptbook in the library ) was not found
3
- */
4
- export declare class NotFoundError extends Error {
5
- readonly name = "NotFoundError";
6
- constructor(message: string);
7
- }