@promptbook/markdown-utils 0.81.0-16 → 0.81.0-18
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 +5 -6
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/_packages/markdown-utils.index.d.ts +2 -2
- package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +9 -4
- package/esm/typings/src/formfactors/image-generator/ImageGeneratorFormfactorDefinition.d.ts +1 -1
- package/esm/typings/src/formfactors/index.d.ts +10 -5
- package/esm/typings/src/high-level-abstractions/quick-chatbot/QuickChatbotHla.d.ts +3 -0
- package/esm/typings/src/pipeline/book-notation.d.ts +15 -0
- package/esm/typings/src/pipeline/isValidPipelineString.d.ts +11 -0
- package/esm/typings/src/pipeline/isValidPipelineString.test.d.ts +4 -0
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +3 -1
- package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -1
- package/esm/typings/src/utils/markdown/{removeContentComments.d.ts → removeMarkdownComments.d.ts} +2 -2
- package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +5 -6
- package/umd/index.umd.js.map +1 -1
- /package/esm/typings/src/utils/markdown/{removeContentComments.test.d.ts → removeMarkdownComments.test.d.ts} +0 -0
|
@@ -93,6 +93,8 @@ import { MultipleLlmExecutionTools } from '../llm-providers/multiple/MultipleLlm
|
|
|
93
93
|
import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
94
94
|
import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
95
95
|
import { preparePersona } from '../personas/preparePersona';
|
|
96
|
+
import { book } from '../pipeline/book-notation';
|
|
97
|
+
import { isValidPipelineString } from '../pipeline/isValidPipelineString';
|
|
96
98
|
import { GENERIC_PIPELINE_INTERFACE } from '../pipeline/PipelineInterface/constants';
|
|
97
99
|
import { getPipelineInterface } from '../pipeline/PipelineInterface/getPipelineInterface';
|
|
98
100
|
import { isPipelineImplementingInterface } from '../pipeline/PipelineInterface/isPipelineImplementingInterface';
|
|
@@ -213,6 +215,8 @@ export { MultipleLlmExecutionTools };
|
|
|
213
215
|
export { _OpenAiMetadataRegistration };
|
|
214
216
|
export { _OpenAiAssistantMetadataRegistration };
|
|
215
217
|
export { preparePersona };
|
|
218
|
+
export { book };
|
|
219
|
+
export { isValidPipelineString };
|
|
216
220
|
export { GENERIC_PIPELINE_INTERFACE };
|
|
217
221
|
export { getPipelineInterface };
|
|
218
222
|
export { isPipelineImplementingInterface };
|
|
@@ -19,7 +19,7 @@ import { extractOneBlockFromMarkdown } from '../utils/markdown/extractOneBlockFr
|
|
|
19
19
|
import { flattenMarkdown } from '../utils/markdown/flattenMarkdown';
|
|
20
20
|
import type { MarkdownSection } from '../utils/markdown/parseMarkdownSection';
|
|
21
21
|
import { parseMarkdownSection } from '../utils/markdown/parseMarkdownSection';
|
|
22
|
-
import {
|
|
22
|
+
import { removeMarkdownComments } from '../utils/markdown/removeMarkdownComments';
|
|
23
23
|
import { removeMarkdownFormatting } from '../utils/markdown/removeMarkdownFormatting';
|
|
24
24
|
import { splitMarkdownIntoSections } from '../utils/markdown/splitMarkdownIntoSections';
|
|
25
25
|
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
|
@@ -43,6 +43,6 @@ export { extractOneBlockFromMarkdown };
|
|
|
43
43
|
export { flattenMarkdown };
|
|
44
44
|
export type { MarkdownSection };
|
|
45
45
|
export { parseMarkdownSection };
|
|
46
|
-
export {
|
|
46
|
+
export { removeMarkdownComments };
|
|
47
47
|
export { removeMarkdownFormatting };
|
|
48
48
|
export { splitMarkdownIntoSections };
|
|
@@ -5,15 +5,20 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const GeneratorFormfactorDefinition: {
|
|
7
7
|
readonly name: "GENERATOR";
|
|
8
|
-
readonly description: "
|
|
8
|
+
readonly description: "Generates any kind (in HTML with possible scripts and css format) of content from input message";
|
|
9
9
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/184";
|
|
10
10
|
readonly pipelineInterface: {
|
|
11
11
|
readonly inputParameters: readonly [{
|
|
12
|
-
readonly name: "
|
|
13
|
-
readonly description: "
|
|
12
|
+
readonly name: "inputMessage";
|
|
13
|
+
readonly description: "Input message to be image made from";
|
|
14
14
|
readonly isInput: true;
|
|
15
15
|
readonly isOutput: false;
|
|
16
16
|
}];
|
|
17
|
-
readonly outputParameters: readonly [
|
|
17
|
+
readonly outputParameters: readonly [{
|
|
18
|
+
readonly name: "result";
|
|
19
|
+
readonly description: "Result in HTML to be shown to user";
|
|
20
|
+
readonly isInput: false;
|
|
21
|
+
readonly isOutput: true;
|
|
22
|
+
}];
|
|
18
23
|
};
|
|
19
24
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const ImageGeneratorFormfactorDefinition: {
|
|
7
7
|
readonly name: "IMAGE_GENERATOR";
|
|
8
|
-
readonly description: "
|
|
8
|
+
readonly description: "Generates prompt for image generation from input message";
|
|
9
9
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/184";
|
|
10
10
|
readonly pipelineInterface: {
|
|
11
11
|
readonly inputParameters: readonly [{
|
|
@@ -105,20 +105,25 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
|
105
105
|
};
|
|
106
106
|
}, {
|
|
107
107
|
readonly name: "GENERATOR";
|
|
108
|
-
readonly description: "
|
|
108
|
+
readonly description: "Generates any kind (in HTML with possible scripts and css format) of content from input message";
|
|
109
109
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/184";
|
|
110
110
|
readonly pipelineInterface: {
|
|
111
111
|
readonly inputParameters: readonly [{
|
|
112
|
-
readonly name: "
|
|
113
|
-
readonly description: "
|
|
112
|
+
readonly name: "inputMessage";
|
|
113
|
+
readonly description: "Input message to be image made from";
|
|
114
114
|
readonly isInput: true;
|
|
115
115
|
readonly isOutput: false;
|
|
116
116
|
}];
|
|
117
|
-
readonly outputParameters: readonly [
|
|
117
|
+
readonly outputParameters: readonly [{
|
|
118
|
+
readonly name: "result";
|
|
119
|
+
readonly description: "Result in HTML to be shown to user";
|
|
120
|
+
readonly isInput: false;
|
|
121
|
+
readonly isOutput: true;
|
|
122
|
+
}];
|
|
118
123
|
};
|
|
119
124
|
}, {
|
|
120
125
|
readonly name: "IMAGE_GENERATOR";
|
|
121
|
-
readonly description: "
|
|
126
|
+
readonly description: "Generates prompt for image generation from input message";
|
|
122
127
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/184";
|
|
123
128
|
readonly pipelineInterface: {
|
|
124
129
|
readonly inputParameters: readonly [{
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PipelineString } from './PipelineString';
|
|
2
|
+
/**
|
|
3
|
+
* Function for notating a pipeline with a book\`...\ notation as template literal
|
|
4
|
+
*
|
|
5
|
+
* @param strings @@@
|
|
6
|
+
* @param values @@@
|
|
7
|
+
* @returns the pipeline string
|
|
8
|
+
* @public exported from `@promptbook/core`
|
|
9
|
+
*/
|
|
10
|
+
export declare function book(strings: TemplateStringsArray, ...values: Array<string>): PipelineString;
|
|
11
|
+
/**
|
|
12
|
+
* TODO: !!!!!! Use book\`...\ notation instead of as PipelineString
|
|
13
|
+
* TODO: [🧠][🈴] Where is the best location for this file
|
|
14
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
15
|
+
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PipelineString } from './PipelineString';
|
|
2
|
+
/**
|
|
3
|
+
* Function `isValidPipelineString` will validate the if the string is a valid pipeline string
|
|
4
|
+
* It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/core`
|
|
7
|
+
*/
|
|
8
|
+
export declare function isValidPipelineString(value: string): value is PipelineString;
|
|
9
|
+
/**
|
|
10
|
+
* TODO: [🧠][🈴] Where is the best location for this file
|
|
11
|
+
*/
|
|
@@ -12,7 +12,9 @@ export declare const createWebsiteScraper: ((tools: Pick<ExecutionTools, 'llm'>,
|
|
|
12
12
|
className: string;
|
|
13
13
|
mimeTypes: string[];
|
|
14
14
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
15
|
-
isAvilableInBrowser:
|
|
15
|
+
isAvilableInBrowser: true; /**
|
|
16
|
+
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
17
|
+
*/
|
|
16
18
|
requiredExecutables: never[];
|
|
17
19
|
}>;
|
|
18
20
|
/**
|
|
@@ -10,7 +10,7 @@ export declare const websiteScraperMetadata: import("type-fest/source/readonly-d
|
|
|
10
10
|
className: string;
|
|
11
11
|
mimeTypes: string[];
|
|
12
12
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
13
|
-
isAvilableInBrowser:
|
|
13
|
+
isAvilableInBrowser: true;
|
|
14
14
|
requiredExecutables: never[];
|
|
15
15
|
}>;
|
|
16
16
|
/**
|
package/esm/typings/src/utils/markdown/{removeContentComments.d.ts → removeMarkdownComments.d.ts}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { string_html } from '../../types/typeAliases';
|
|
2
2
|
import type { string_markdown } from '../../types/typeAliases';
|
|
3
3
|
/**
|
|
4
|
-
* Removes
|
|
4
|
+
* Removes Markdown (or HTML) comments
|
|
5
5
|
*
|
|
6
6
|
* @param {string} content - The string to remove comments from.
|
|
7
7
|
* @returns {string} The input string with all comments removed.
|
|
8
8
|
* @public exported from `@promptbook/markdown-utils`
|
|
9
9
|
*/
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function removeMarkdownComments<TContent extends string_html | string_markdown>(content: TContent): TContent;
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* @generated
|
|
25
25
|
* @see https://github.com/webgptorg/promptbook
|
|
26
26
|
*/
|
|
27
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.81.0-
|
|
27
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.81.0-17';
|
|
28
28
|
/**
|
|
29
29
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
30
30
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -969,7 +969,6 @@
|
|
|
969
969
|
function deepClone(objectValue) {
|
|
970
970
|
return JSON.parse(JSON.stringify(objectValue));
|
|
971
971
|
/*
|
|
972
|
-
!!!!!!!!
|
|
973
972
|
TODO: [🧠] Is there a better implementation?
|
|
974
973
|
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
975
974
|
> for (const propertyName of propertyNames) {
|
|
@@ -6138,13 +6137,13 @@
|
|
|
6138
6137
|
*/
|
|
6139
6138
|
|
|
6140
6139
|
/**
|
|
6141
|
-
* Removes
|
|
6140
|
+
* Removes Markdown (or HTML) comments
|
|
6142
6141
|
*
|
|
6143
6142
|
* @param {string} content - The string to remove comments from.
|
|
6144
6143
|
* @returns {string} The input string with all comments removed.
|
|
6145
6144
|
* @public exported from `@promptbook/markdown-utils`
|
|
6146
6145
|
*/
|
|
6147
|
-
function
|
|
6146
|
+
function removeMarkdownComments(content) {
|
|
6148
6147
|
return spaceTrim.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
|
|
6149
6148
|
}
|
|
6150
6149
|
|
|
@@ -6163,7 +6162,7 @@
|
|
|
6163
6162
|
return content.replace(sectionRegex, contentToInsert);
|
|
6164
6163
|
}
|
|
6165
6164
|
// Note: Following is the case when the section is not found in the file so we add it there
|
|
6166
|
-
var placeForSection =
|
|
6165
|
+
var placeForSection = removeMarkdownComments(content).match(/^##.*$/im);
|
|
6167
6166
|
if (placeForSection !== null) {
|
|
6168
6167
|
var _a = __read(placeForSection, 1), heading_1 = _a[0];
|
|
6169
6168
|
return content.replace(heading_1, spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(contentToInsert), "\n\n ").concat(block(heading_1), "\n "); }));
|
|
@@ -6477,7 +6476,7 @@
|
|
|
6477
6476
|
exports.extractOneBlockFromMarkdown = extractOneBlockFromMarkdown;
|
|
6478
6477
|
exports.flattenMarkdown = flattenMarkdown;
|
|
6479
6478
|
exports.parseMarkdownSection = parseMarkdownSection;
|
|
6480
|
-
exports.
|
|
6479
|
+
exports.removeMarkdownComments = removeMarkdownComments;
|
|
6481
6480
|
exports.removeMarkdownFormatting = removeMarkdownFormatting;
|
|
6482
6481
|
exports.splitMarkdownIntoSections = splitMarkdownIntoSections;
|
|
6483
6482
|
|