@promptbook/core 0.59.0-20 → 0.59.0-21
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 +12 -9
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +16 -2
- package/package.json +1 -1
- package/umd/index.umd.js +12 -9
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +16 -2
package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import type { LlmExecutionTools } from '../../../execution/LlmExecutionTools';
|
|
2
2
|
import type { KnowledgeJson } from '../../../types/PromptbookJson/KnowledgeJson';
|
|
3
3
|
import type { string_markdown } from '../../../types/typeAliases';
|
|
4
|
-
|
|
4
|
+
type PrepareKnowledgeFromMarkdownOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* The source of the knowledge in markdown format
|
|
7
|
+
*/
|
|
5
8
|
content: string_markdown;
|
|
9
|
+
/**
|
|
10
|
+
* The LLM tools to use for the conversion and extraction of knowledge
|
|
11
|
+
*/
|
|
6
12
|
llmTools: LlmExecutionTools;
|
|
7
|
-
|
|
13
|
+
/**
|
|
14
|
+
* If true, the preaparation of knowledge logs additional information
|
|
15
|
+
*
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
isVerbose?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare function prepareKnowledgeFromMarkdown(options: PrepareKnowledgeFromMarkdownOptions): Promise<KnowledgeJson>;
|
|
21
|
+
export {};
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
return PromptbookSyntaxError;
|
|
207
207
|
}(Error));
|
|
208
208
|
|
|
209
|
-
var promptbookLibrary = [{title:"Prepare Knowledge from Markdown",promptbookUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.59.0-
|
|
209
|
+
var promptbookLibrary = [{title:"Prepare Knowledge from Markdown",promptbookUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.59.0-20",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],executionType:"PROMPT_TEMPLATE",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {content}",resultingParameterName:"knowledge"}],knowledge:[]}];
|
|
210
210
|
|
|
211
211
|
/**
|
|
212
212
|
* This error indicates errors during the execution of the promptbook
|
|
@@ -531,7 +531,7 @@
|
|
|
531
531
|
/**
|
|
532
532
|
* The version of the Promptbook library
|
|
533
533
|
*/
|
|
534
|
-
var PROMPTBOOK_VERSION = '0.59.0-
|
|
534
|
+
var PROMPTBOOK_VERSION = '0.59.0-20';
|
|
535
535
|
|
|
536
536
|
/**
|
|
537
537
|
* Function `addUsage` will add multiple usages into one
|
|
@@ -2051,15 +2051,15 @@
|
|
|
2051
2051
|
|
|
2052
2052
|
function prepareKnowledgeFromMarkdown(options) {
|
|
2053
2053
|
return __awaiter(this, void 0, void 0, function () {
|
|
2054
|
-
var content, llmTools, library, promptbook, executor, result, outputParameters, knowledgeRaw, knowledgeTextPieces, knowledge;
|
|
2054
|
+
var content, llmTools, _a, isVerbose, library, promptbook, executor, result, outputParameters, knowledgeRaw, knowledgeTextPieces, knowledge;
|
|
2055
2055
|
var _this = this;
|
|
2056
|
-
return __generator(this, function (
|
|
2057
|
-
switch (
|
|
2056
|
+
return __generator(this, function (_b) {
|
|
2057
|
+
switch (_b.label) {
|
|
2058
2058
|
case 0:
|
|
2059
|
-
content = options.content, llmTools = options.llmTools;
|
|
2059
|
+
content = options.content, llmTools = options.llmTools, _a = options.isVerbose, isVerbose = _a === void 0 ? false : _a;
|
|
2060
2060
|
return [4 /*yield*/, createPromptbookLibraryFromSources.apply(void 0, __spreadArray([], __read(promptbookLibrary), false))];
|
|
2061
2061
|
case 1:
|
|
2062
|
-
library =
|
|
2062
|
+
library = _b.sent();
|
|
2063
2063
|
promptbook = library.getPromptbookByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md');
|
|
2064
2064
|
executor = createPromptbookExecutor({
|
|
2065
2065
|
promptbook: promptbook,
|
|
@@ -2072,11 +2072,14 @@
|
|
|
2072
2072
|
});
|
|
2073
2073
|
return [4 /*yield*/, executor({ content: content })];
|
|
2074
2074
|
case 2:
|
|
2075
|
-
result =
|
|
2075
|
+
result = _b.sent();
|
|
2076
2076
|
assertsExecutionSuccessful(result);
|
|
2077
2077
|
outputParameters = result.outputParameters;
|
|
2078
2078
|
knowledgeRaw = outputParameters.knowledge;
|
|
2079
2079
|
knowledgeTextPieces = (knowledgeRaw || '').split('\n---\n');
|
|
2080
|
+
if (isVerbose) {
|
|
2081
|
+
console.info('knowledgeTextPieces:', knowledgeTextPieces);
|
|
2082
|
+
}
|
|
2080
2083
|
return [4 /*yield*/, Promise.all(knowledgeTextPieces.map(function (knowledgeTextPiece, i) { return __awaiter(_this, void 0, void 0, function () {
|
|
2081
2084
|
var name, title, content, keywords, index, sources;
|
|
2082
2085
|
return __generator(this, function (_a) {
|
|
@@ -2108,7 +2111,7 @@
|
|
|
2108
2111
|
});
|
|
2109
2112
|
}); }))];
|
|
2110
2113
|
case 3:
|
|
2111
|
-
knowledge =
|
|
2114
|
+
knowledge = _b.sent();
|
|
2112
2115
|
return [2 /*return*/, knowledge];
|
|
2113
2116
|
}
|
|
2114
2117
|
});
|