@promptbook/remote-server 0.67.3 → 0.67.5
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.
- package/esm/index.es.js +1 -1
- package/esm/typings/src/_packages/markdown-utils.index.d.ts +4 -0
- package/esm/typings/src/_packages/utils.index.d.ts +0 -2
- package/esm/typings/src/formats/_common/FormatDefinition.d.ts +1 -0
- package/esm/typings/src/postprocessing/utils/extractBlock.d.ts +5 -6
- package/esm/typings/src/postprocessing/utils/extractJsonBlock.d.ts +25 -0
- package/esm/typings/src/postprocessing/utils/extractJsonBlock.test.d.ts +1 -0
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +3 -1
- package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +4 -2
- package/package.json +2 -2
- package/umd/index.umd.js +1 -1
package/esm/index.es.js
CHANGED
|
@@ -7,7 +7,7 @@ import spaceTrim$1, { spaceTrim } from 'spacetrim';
|
|
|
7
7
|
/**
|
|
8
8
|
* The version of the Promptbook library
|
|
9
9
|
*/
|
|
10
|
-
var PROMPTBOOK_VERSION = '0.67.
|
|
10
|
+
var PROMPTBOOK_VERSION = '0.67.4';
|
|
11
11
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
12
12
|
|
|
13
13
|
/*! *****************************************************************************
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { PROMPTBOOK_VERSION } from '../version';
|
|
2
|
+
import { extractBlock } from '../postprocessing/utils/extractBlock';
|
|
3
|
+
import { extractJsonBlock } from '../postprocessing/utils/extractJsonBlock';
|
|
2
4
|
import type { string_markdown } from '../types/typeAliases';
|
|
3
5
|
import type { string_markdown_section } from '../types/typeAliases';
|
|
4
6
|
import type { string_markdown_section_content } from '../types/typeAliases';
|
|
@@ -17,6 +19,8 @@ import { removeContentComments } from '../utils/markdown/removeContentComments';
|
|
|
17
19
|
import { removeMarkdownFormatting } from '../utils/markdown/removeMarkdownFormatting';
|
|
18
20
|
import { splitMarkdownIntoSections } from '../utils/markdown/splitMarkdownIntoSections';
|
|
19
21
|
export { PROMPTBOOK_VERSION };
|
|
22
|
+
export { extractBlock };
|
|
23
|
+
export { extractJsonBlock };
|
|
20
24
|
export type { string_markdown };
|
|
21
25
|
export type { string_markdown_section };
|
|
22
26
|
export type { string_markdown_section_content };
|
|
@@ -8,7 +8,6 @@ import { deserializeError } from '../errors/utils/deserializeError';
|
|
|
8
8
|
import { serializeError } from '../errors/utils/serializeError';
|
|
9
9
|
import { forEachAsync } from '../execution/utils/forEachAsync';
|
|
10
10
|
import { isValidJsonString } from '../formats/json/utils/isValidJsonString';
|
|
11
|
-
import { extractBlock } from '../postprocessing/utils/extractBlock';
|
|
12
11
|
import { $currentDate } from '../utils/$currentDate';
|
|
13
12
|
import { $isRunningInBrowser } from '../utils/environment/$isRunningInBrowser';
|
|
14
13
|
import { $isRunningInNode } from '../utils/environment/$isRunningInNode';
|
|
@@ -80,7 +79,6 @@ export { deserializeError };
|
|
|
80
79
|
export { serializeError };
|
|
81
80
|
export { forEachAsync };
|
|
82
81
|
export { isValidJsonString };
|
|
83
|
-
export { extractBlock };
|
|
84
82
|
export { $currentDate };
|
|
85
83
|
export { $isRunningInBrowser };
|
|
86
84
|
export { $isRunningInNode };
|
|
@@ -62,6 +62,7 @@ export type FormatDefinition<TValue extends TPartialValue, TPartialValue extends
|
|
|
62
62
|
extractValues(value: string, schema?: TSchema): Array<string>;
|
|
63
63
|
};
|
|
64
64
|
/**
|
|
65
|
+
* TODO: [♏] Add some prepare hook to modify prompt according to the format
|
|
65
66
|
* TODO: [🍓]`name` and `aliases` should be UPPERCASE only and interpreted as case-insensitive (via normalization)
|
|
66
67
|
* TODO: [🍓][👨⚖️] Compute TPartialValue dynamically - PartialString<TValue>
|
|
67
68
|
* TODO: [🍓][🧠] Should execution tools be aviable to heal, canBeValid and isValid?
|
|
@@ -2,16 +2,15 @@ import type { string_markdown } from '../../types/typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Extracts code block from markdown.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* - When there are multiple or no code blocks the function throws a `ParsingError`
|
|
6
6
|
*
|
|
7
|
-
* Note: There are
|
|
7
|
+
* Note: There are multiple simmilar function:
|
|
8
8
|
* - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
|
|
9
|
+
* - `extractJsonBlock` extracts exactly one valid JSON code block
|
|
9
10
|
* - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
|
|
10
11
|
* - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
|
|
11
12
|
*
|
|
12
|
-
* @public exported from `@promptbook/utils`
|
|
13
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
14
|
+
* @throws {ParsingError} if there is not exactly one code block in the markdown
|
|
13
15
|
*/
|
|
14
16
|
export declare function extractBlock(markdown: string_markdown): string;
|
|
15
|
-
/**
|
|
16
|
-
* TODO: [🧠][🌻] Maybe export through `@promptbook/markdown-utils` not `@promptbook/utils`
|
|
17
|
-
*/
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { string_json } from '../../types/typeAliases';
|
|
2
|
+
import type { string_markdown } from '../../types/typeAliases';
|
|
3
|
+
import type { really_unknown } from '../../utils/organization/really_unknown';
|
|
4
|
+
/**
|
|
5
|
+
* Extracts extracts exactly one valid JSON code block
|
|
6
|
+
*
|
|
7
|
+
* - When given string is a valid JSON as it is, it just returns it
|
|
8
|
+
* - When there is no JSON code block the function throws a `ParsingError`
|
|
9
|
+
* - When there are multiple JSON code blocks the function throws a `ParsingError`
|
|
10
|
+
*
|
|
11
|
+
* Note: It is not important if marked as ```json BUT if it is VALID JSON
|
|
12
|
+
* Note: There are multiple simmilar function:
|
|
13
|
+
* - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
|
|
14
|
+
* - `extractJsonBlock` extracts exactly one valid JSON code block
|
|
15
|
+
* - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
|
|
16
|
+
* - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
|
|
17
|
+
*
|
|
18
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
19
|
+
* @throws {ParsingError} if there is no valid JSON block in the markdown
|
|
20
|
+
*/
|
|
21
|
+
export declare function extractJsonBlock(markdown: string_markdown): string_json<really_unknown>;
|
|
22
|
+
/**
|
|
23
|
+
* TODO: Add some auto-healing logic + extract YAML, JSON5, TOML, etc.
|
|
24
|
+
* TODO: [🏢] Make this logic part of `JsonFormatDefinition` or `isValidJsonString`
|
|
25
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -19,13 +19,15 @@ export type CodeBlock = {
|
|
|
19
19
|
/**
|
|
20
20
|
* Extracts all code blocks from markdown.
|
|
21
21
|
*
|
|
22
|
-
* Note: There are
|
|
22
|
+
* Note: There are multiple simmilar function:
|
|
23
23
|
* - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
|
|
24
|
+
* - `extractJsonBlock` extracts exactly one valid JSON code block
|
|
24
25
|
* - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
|
|
25
26
|
* - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
|
|
26
27
|
*
|
|
27
28
|
* @param markdown any valid markdown
|
|
28
29
|
* @returns code blocks with language and content
|
|
30
|
+
* @throws {ParsingError} if block is not closed properly
|
|
29
31
|
* @public exported from `@promptbook/markdown-utils`
|
|
30
32
|
*/
|
|
31
33
|
export declare function extractAllBlocksFromMarkdown(markdown: string_markdown): Array<CodeBlock>;
|
|
@@ -3,16 +3,18 @@ import type { CodeBlock } from './extractAllBlocksFromMarkdown';
|
|
|
3
3
|
/**
|
|
4
4
|
* Extracts exactly ONE code block from markdown.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* - When there are multiple or no code blocks the function throws a `ParsingError`
|
|
7
7
|
*
|
|
8
|
-
* Note: There are
|
|
8
|
+
* Note: There are multiple simmilar function:
|
|
9
9
|
* - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
|
|
10
|
+
* - `extractJsonBlock` extracts exactly one valid JSON code block
|
|
10
11
|
* - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
|
|
11
12
|
* - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
|
|
12
13
|
*
|
|
13
14
|
* @param markdown any valid markdown
|
|
14
15
|
* @returns code block with language and content
|
|
15
16
|
* @public exported from `@promptbook/markdown-utils`
|
|
17
|
+
* @throws {ParsingError} if there is not exactly one code block in the markdown
|
|
16
18
|
*/
|
|
17
19
|
export declare function extractOneBlockFromMarkdown(markdown: string_markdown): CodeBlock;
|
|
18
20
|
/***
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-server",
|
|
3
|
-
"version": "0.67.
|
|
3
|
+
"version": "0.67.5",
|
|
4
4
|
"description": "Supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"module": "./esm/index.es.js",
|
|
48
48
|
"typings": "./esm/typings/src/_packages/remote-server.index.d.ts",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@promptbook/core": "0.67.
|
|
50
|
+
"@promptbook/core": "0.67.5"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
/**
|
|
15
15
|
* The version of the Promptbook library
|
|
16
16
|
*/
|
|
17
|
-
var PROMPTBOOK_VERSION = '0.67.
|
|
17
|
+
var PROMPTBOOK_VERSION = '0.67.4';
|
|
18
18
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
19
19
|
|
|
20
20
|
/*! *****************************************************************************
|