@promptbook/openai 0.22.6 → 0.23.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.
@@ -1,7 +1,7 @@
1
1
  import { EMOJIS, EMOJIS_IN_CATEGORIES } from '../utils/emojis';
2
2
  import { isValidJsonString } from '../utils/isValidJsonString';
3
+ import { extractAllBlocksFromMarkdown } from '../utils/markdown/extractAllBlocksFromMarkdown';
3
4
  import { extractAllListItemsFromMarkdown } from '../utils/markdown/extractAllListItemsFromMarkdown';
4
- import { extractBlocksFromMarkdown } from '../utils/markdown/extractBlocksFromMarkdown';
5
5
  import { extractOneBlockFromMarkdown } from '../utils/markdown/extractOneBlockFromMarkdown';
6
6
  import { removeContentComments } from '../utils/markdown/removeContentComments';
7
7
  import { removeMarkdownFormatting } from '../utils/markdown/removeMarkdownFormatting';
@@ -10,4 +10,4 @@ import { removeQuotes } from '../utils/removeQuotes';
10
10
  import { replaceParameters } from '../utils/replaceParameters';
11
11
  import { trimEndOfCodeBlock } from '../utils/trimEndOfCodeBlock';
12
12
  import { unwrapResult } from '../utils/unwrapResult';
13
- export { EMOJIS, EMOJIS_IN_CATEGORIES, extractAllListItemsFromMarkdown, extractBlocksFromMarkdown, extractOneBlockFromMarkdown, isValidJsonString, removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, trimEndOfCodeBlock, unwrapResult, };
13
+ export { EMOJIS, EMOJIS_IN_CATEGORIES, extractAllBlocksFromMarkdown, extractAllListItemsFromMarkdown, extractOneBlockFromMarkdown, isValidJsonString, removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, trimEndOfCodeBlock, unwrapResult, };
@@ -0,0 +1,22 @@
1
+ import { string_markdown } from '../../types/typeAliases';
2
+ /**
3
+ * Single code block inside markdown.
4
+ */
5
+ type CodeBlock = {
6
+ /**
7
+ * Language of the code block OR null if the language is not specified in opening ```
8
+ */
9
+ language: string | null;
10
+ /**
11
+ * Content of the code block (unescaped)
12
+ */
13
+ content: string;
14
+ };
15
+ /**
16
+ * Extracts all code blocks from markdown.
17
+ *
18
+ * @param markdown any valid markdown
19
+ * @returns code blocks with language and content
20
+ */
21
+ export declare function extractAllBlocksFromMarkdown(markdown: string_markdown): Array<CodeBlock>;
22
+ export {};
@@ -2,7 +2,7 @@ import { string_markdown } from '../.././types/typeAliases';
2
2
  /**
3
3
  * Extracts exactly ONE code block from markdown.
4
4
  *
5
- * Note: This function is similar to extractBlocksFromMarkdown but it validates that there is exactly one code block.
5
+ * Note: This function is similar to extractAllBlocksFromMarkdown but it validates that there is exactly one code block.
6
6
  * Note: If there are multiple or no code blocks the function throws an error
7
7
  *
8
8
  * @param markdown any valid markdown
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/openai",
3
- "version": "0.22.6",
3
+ "version": "0.23.1",
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.22.6"
40
+ "@promptbook/core": "0.23.1"
41
41
  },
42
42
  "main": "./umd/index.umd.js",
43
43
  "module": "./esm/index.es.js",
@@ -1,7 +1,7 @@
1
1
  import { EMOJIS, EMOJIS_IN_CATEGORIES } from '../utils/emojis';
2
2
  import { isValidJsonString } from '../utils/isValidJsonString';
3
+ import { extractAllBlocksFromMarkdown } from '../utils/markdown/extractAllBlocksFromMarkdown';
3
4
  import { extractAllListItemsFromMarkdown } from '../utils/markdown/extractAllListItemsFromMarkdown';
4
- import { extractBlocksFromMarkdown } from '../utils/markdown/extractBlocksFromMarkdown';
5
5
  import { extractOneBlockFromMarkdown } from '../utils/markdown/extractOneBlockFromMarkdown';
6
6
  import { removeContentComments } from '../utils/markdown/removeContentComments';
7
7
  import { removeMarkdownFormatting } from '../utils/markdown/removeMarkdownFormatting';
@@ -10,4 +10,4 @@ import { removeQuotes } from '../utils/removeQuotes';
10
10
  import { replaceParameters } from '../utils/replaceParameters';
11
11
  import { trimEndOfCodeBlock } from '../utils/trimEndOfCodeBlock';
12
12
  import { unwrapResult } from '../utils/unwrapResult';
13
- export { EMOJIS, EMOJIS_IN_CATEGORIES, extractAllListItemsFromMarkdown, extractBlocksFromMarkdown, extractOneBlockFromMarkdown, isValidJsonString, removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, trimEndOfCodeBlock, unwrapResult, };
13
+ export { EMOJIS, EMOJIS_IN_CATEGORIES, extractAllBlocksFromMarkdown, extractAllListItemsFromMarkdown, extractOneBlockFromMarkdown, isValidJsonString, removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, trimEndOfCodeBlock, unwrapResult, };
@@ -0,0 +1,22 @@
1
+ import { string_markdown } from '../../types/typeAliases';
2
+ /**
3
+ * Single code block inside markdown.
4
+ */
5
+ type CodeBlock = {
6
+ /**
7
+ * Language of the code block OR null if the language is not specified in opening ```
8
+ */
9
+ language: string | null;
10
+ /**
11
+ * Content of the code block (unescaped)
12
+ */
13
+ content: string;
14
+ };
15
+ /**
16
+ * Extracts all code blocks from markdown.
17
+ *
18
+ * @param markdown any valid markdown
19
+ * @returns code blocks with language and content
20
+ */
21
+ export declare function extractAllBlocksFromMarkdown(markdown: string_markdown): Array<CodeBlock>;
22
+ export {};
@@ -2,7 +2,7 @@ import { string_markdown } from '../.././types/typeAliases';
2
2
  /**
3
3
  * Extracts exactly ONE code block from markdown.
4
4
  *
5
- * Note: This function is similar to extractBlocksFromMarkdown but it validates that there is exactly one code block.
5
+ * Note: This function is similar to extractAllBlocksFromMarkdown but it validates that there is exactly one code block.
6
6
  * Note: If there are multiple or no code blocks the function throws an error
7
7
  *
8
8
  * @param markdown any valid markdown
@@ -1,11 +0,0 @@
1
- import { string_markdown } from '../.././types/typeAliases';
2
- /**
3
- * Extracts all code blocks from markdown.
4
- *
5
- * @param markdown any valid markdown
6
- * @returns code blocks with language and content
7
- */
8
- export declare function extractBlocksFromMarkdown(markdown: string_markdown): Array<{
9
- language: string | null;
10
- content: string;
11
- }>;
@@ -1,11 +0,0 @@
1
- import { string_markdown } from '../.././types/typeAliases';
2
- /**
3
- * Extracts all code blocks from markdown.
4
- *
5
- * @param markdown any valid markdown
6
- * @returns code blocks with language and content
7
- */
8
- export declare function extractBlocksFromMarkdown(markdown: string_markdown): Array<{
9
- language: string | null;
10
- content: string;
11
- }>;