@promptbook/core 0.84.0-15 โ 0.84.0-17
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/README.md +10 -3
- package/esm/index.es.js +72 -16
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/cli.index.d.ts +4 -0
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/_packages/deepseek.index.d.ts +8 -0
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/_packages/wizzard.index.d.ts +4 -0
- package/esm/typings/src/config.d.ts +6 -0
- package/esm/typings/src/conversion/compilePipelineOnRemoteServer.d.ts +1 -1
- package/esm/typings/src/llm-providers/deepseek/DeepseekExecutionToolsOptions.d.ts +9 -0
- package/esm/typings/src/llm-providers/deepseek/createDeepseekExecutionTools.d.ts +14 -0
- package/esm/typings/src/llm-providers/deepseek/register-configuration.d.ts +14 -0
- package/esm/typings/src/llm-providers/deepseek/register-constructor.d.ts +15 -0
- package/esm/typings/src/prepare/preparePipelineOnRemoteServer.d.ts +1 -1
- package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts +5 -2
- package/package.json +5 -3
- package/umd/index.umd.js +73 -15
- package/umd/index.umd.js.map +1 -1
- package/LICENSE.md +0 -1
package/README.md
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## ๐ New Features
|
|
18
18
|
|
|
19
|
-
- ๐ **Support of [DeepSeek models](https://www.
|
|
19
|
+
- ๐ **Support of [DeepSeek models](https://www.npmjs.com/package/@promptbook/deepseek)**
|
|
20
20
|
- ๐ Working [the **Book** language v1.0.0](https://github.com/webgptorg/book)
|
|
21
21
|
- ๐ค Run books from CLI - `npx ptbk run path/to/your/book`
|
|
22
22
|
- ๐ Support of `.docx`, `.doc` and `.pdf` documents as knowledge
|
|
@@ -267,8 +267,9 @@ Or you can install them separately:
|
|
|
267
267
|
- **[@promptbook/anthropic-claude](https://www.npmjs.com/package/@promptbook/anthropic-claude)** - Execution tools for Anthropic Claude API, wrapper around Anthropic Claude SDK
|
|
268
268
|
- **[@promptbook/vercel](https://www.npmjs.com/package/@promptbook/vercel)** - Adapter for Vercel functionalities
|
|
269
269
|
- **[@promptbook/google](https://www.npmjs.com/package/@promptbook/google)** - Integration with Google's Gemini API
|
|
270
|
+
- **[@promptbook/deepseek](https://www.npmjs.com/package/@promptbook/deepseek)** - Integration with [DeepSeek API](https://www.deepseek.com/)
|
|
270
271
|
- **[@promptbook/azure-openai](https://www.npmjs.com/package/@promptbook/azure-openai)** - Execution tools for Azure OpenAI API
|
|
271
|
-
|
|
272
|
+
|
|
272
273
|
- **[@promptbook/fake-llm](https://www.npmjs.com/package/@promptbook/fake-llm)** - Mocked execution tools for testing the library and saving the tokens
|
|
273
274
|
- **[@promptbook/remote-client](https://www.npmjs.com/package/@promptbook/remote-client)** - Remote client for remote execution of promptbooks
|
|
274
275
|
- **[@promptbook/remote-server](https://www.npmjs.com/package/@promptbook/remote-server)** - Remote server for remote execution of promptbooks
|
|
@@ -438,6 +439,12 @@ See [TODO.md](./TODO.md)
|
|
|
438
439
|
|
|
439
440
|
|
|
440
441
|
|
|
442
|
+
|
|
443
|
+
## ๐ค Partners
|
|
444
|
+
|
|
445
|
+
[](https://technologickainkubace.org/en/about-technology-incubation/about-the-project/)
|
|
446
|
+
|
|
447
|
+
|
|
441
448
|
## ๐๏ธ Contributing
|
|
442
449
|
|
|
443
450
|
I am open to pull requests, feedback, and suggestions. Or if you like this utility, you can [โ buy me a coffee](https://www.buymeacoffee.com/hejny) or [donate via cryptocurrencies](https://github.com/hejny/hejny/blob/main/documents/crypto.md).
|
package/esm/index.es.js
CHANGED
|
@@ -25,7 +25,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
25
25
|
* @generated
|
|
26
26
|
* @see https://github.com/webgptorg/promptbook
|
|
27
27
|
*/
|
|
28
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-
|
|
28
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-16';
|
|
29
29
|
/**
|
|
30
30
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
31
31
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
@@ -684,6 +684,12 @@ var DEFAULT_PROMPT_TASK_TITLE = "Prompt";
|
|
|
684
684
|
* @public exported from `@promptbook/core`
|
|
685
685
|
*/
|
|
686
686
|
var DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = 'result';
|
|
687
|
+
/**
|
|
688
|
+
* Maximum file size limit
|
|
689
|
+
*
|
|
690
|
+
* @public exported from `@promptbook/core`
|
|
691
|
+
*/
|
|
692
|
+
var DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
|
|
687
693
|
// <- TODO: [๐ง ] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
|
|
688
694
|
/**
|
|
689
695
|
* The maximum number of iterations for a loops
|
|
@@ -5919,11 +5925,10 @@ var scraperFetch = function (url, init) { return __awaiter(void 0, void 0, void
|
|
|
5919
5925
|
function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
5920
5926
|
var _a;
|
|
5921
5927
|
return __awaiter(this, void 0, void 0, function () {
|
|
5922
|
-
var _b, fetch, knowledgeSourceContent, name, _c, _d, rootDirname, url, response_1, mimeType, basename, hash, rootDirname_1, filepath, _f, _g,
|
|
5923
|
-
return __generator(this, function (
|
|
5924
|
-
switch (
|
|
5928
|
+
var _b, fetch, knowledgeSourceContent, name, _c, _d, rootDirname, url, response_1, mimeType, basename, hash, rootDirname_1, filepath, fileContent, _f, _g, filename_1, fileExtension, mimeType;
|
|
5929
|
+
return __generator(this, function (_h) {
|
|
5930
|
+
switch (_h.label) {
|
|
5925
5931
|
case 0:
|
|
5926
|
-
console.log('!!! makeKnowledgeSourceHandler', knowledgeSource);
|
|
5927
5932
|
_b = tools.fetch, fetch = _b === void 0 ? scraperFetch : _b;
|
|
5928
5933
|
knowledgeSourceContent = knowledgeSource.knowledgeSourceContent;
|
|
5929
5934
|
name = knowledgeSource.name;
|
|
@@ -5935,7 +5940,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5935
5940
|
url = knowledgeSourceContent;
|
|
5936
5941
|
return [4 /*yield*/, fetch(url)];
|
|
5937
5942
|
case 1:
|
|
5938
|
-
response_1 =
|
|
5943
|
+
response_1 = _h.sent();
|
|
5939
5944
|
mimeType = ((_a = response_1.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.split(';')[0]) || 'text/html';
|
|
5940
5945
|
if (tools.fs === undefined || !url.endsWith('.pdf' /* <- TODO: [๐ต] */)) {
|
|
5941
5946
|
return [2 /*return*/, {
|
|
@@ -5985,17 +5990,19 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5985
5990
|
filepath = join.apply(void 0, __spreadArray(__spreadArray([], __read(nameToSubfolderPath(hash /* <- TODO: [๐] Maybe add some SHA256 prefix */)), false), ["".concat(basename.substring(0, MAX_FILENAME_LENGTH), ".").concat(mimeTypeToExtension(mimeType))], false));
|
|
5986
5991
|
return [4 /*yield*/, tools.fs.mkdir(dirname(join(rootDirname_1, filepath)), { recursive: true })];
|
|
5987
5992
|
case 2:
|
|
5988
|
-
|
|
5989
|
-
_g = (_f =
|
|
5990
|
-
_h = [join(rootDirname_1, filepath)];
|
|
5991
|
-
_k = (_j = Buffer).from;
|
|
5993
|
+
_h.sent();
|
|
5994
|
+
_g = (_f = Buffer).from;
|
|
5992
5995
|
return [4 /*yield*/, response_1.arrayBuffer()];
|
|
5993
|
-
case 3:
|
|
5996
|
+
case 3:
|
|
5997
|
+
fileContent = _g.apply(_f, [_h.sent()]);
|
|
5998
|
+
if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
|
|
5999
|
+
throw new LimitReachedError("File is too large (".concat(Math.round(fileContent.length / 1024 / 1024), "MB). Maximum allowed size is ").concat(Math.round(DEFAULT_MAX_FILE_SIZE / 1024 / 1024), "MB."));
|
|
6000
|
+
}
|
|
6001
|
+
return [4 /*yield*/, tools.fs.writeFile(join(rootDirname_1, filepath), fileContent)];
|
|
5994
6002
|
case 4:
|
|
5995
|
-
|
|
6003
|
+
_h.sent();
|
|
5996
6004
|
// TODO: [๐ต] Check the file security
|
|
5997
|
-
// TODO:
|
|
5998
|
-
// TODO: !!!!!!!! Delete the file after the scraping is done
|
|
6005
|
+
// TODO: [๐งน][๐ง ] Delete the file after the scraping is done
|
|
5999
6006
|
return [2 /*return*/, makeKnowledgeSourceHandler({ name: name, knowledgeSourceContent: filepath }, tools, __assign(__assign({}, options), { rootDirname: rootDirname_1 }))];
|
|
6000
6007
|
case 5:
|
|
6001
6008
|
if (!isValidFilePath(knowledgeSourceContent)) return [3 /*break*/, 7];
|
|
@@ -6012,7 +6019,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
6012
6019
|
mimeType = extensionToMimeType(fileExtension || '');
|
|
6013
6020
|
return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
|
|
6014
6021
|
case 6:
|
|
6015
|
-
if (!(
|
|
6022
|
+
if (!(_h.sent())) {
|
|
6016
6023
|
throw new NotFoundError(spaceTrim(function (block) { return "\n Can not make source handler for file which does not exist:\n\n File:\n ".concat(block(knowledgeSourceContent), "\n\n Full file path:\n ").concat(block(filename_1), "\n "); }));
|
|
6017
6024
|
}
|
|
6018
6025
|
// TODO: [๐ง ][๐ฟ] Test security file - file is scoped to the project (BUT maybe do this in `filesystemTools`)
|
|
@@ -11032,6 +11039,55 @@ var _AzureOpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
|
11032
11039
|
*/
|
|
11033
11040
|
var $isRunningInJest = new Function("\n try {\n return process.env.JEST_WORKER_ID !== undefined;\n } catch (e) {\n return false;\n }\n");
|
|
11034
11041
|
|
|
11042
|
+
/**
|
|
11043
|
+
* Registration of LLM provider metadata
|
|
11044
|
+
*
|
|
11045
|
+
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available LLM tools
|
|
11046
|
+
*
|
|
11047
|
+
* @public exported from `@promptbook/core`
|
|
11048
|
+
* @public exported from `@promptbook/wizzard`
|
|
11049
|
+
* @public exported from `@promptbook/cli`
|
|
11050
|
+
*/
|
|
11051
|
+
var _DeepseekMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
11052
|
+
title: 'Deepseek',
|
|
11053
|
+
packageName: '@promptbook/deepseek',
|
|
11054
|
+
className: 'DeepseekExecutionTools',
|
|
11055
|
+
envVariables: ['DEEPSEEK_GENERATIVE_AI_API_KEY'],
|
|
11056
|
+
getBoilerplateConfiguration: function () {
|
|
11057
|
+
return {
|
|
11058
|
+
title: 'Deepseek (boilerplate)',
|
|
11059
|
+
packageName: '@promptbook/deepseek',
|
|
11060
|
+
className: 'DeepseekExecutionTools',
|
|
11061
|
+
options: {
|
|
11062
|
+
apiKey: 'AI',
|
|
11063
|
+
},
|
|
11064
|
+
};
|
|
11065
|
+
},
|
|
11066
|
+
createConfigurationFromEnv: function (env) {
|
|
11067
|
+
if ($isRunningInJest()
|
|
11068
|
+
// <- TODO: Maybe check `env.JEST_WORKER_ID` directly here or pass `env` into `$isRunningInJest`
|
|
11069
|
+
) {
|
|
11070
|
+
// Note: [๐] Maybe same problem as Gemini
|
|
11071
|
+
return null;
|
|
11072
|
+
}
|
|
11073
|
+
// Note: Note using `process.env` BUT `env` to pass in the environment variables dynamically
|
|
11074
|
+
if (typeof env.DEEPSEEK_GENERATIVE_AI_API_KEY === 'string') {
|
|
11075
|
+
return {
|
|
11076
|
+
title: 'Deepseek (from env)',
|
|
11077
|
+
packageName: '@promptbook/deepseek',
|
|
11078
|
+
className: 'DeepseekExecutionTools',
|
|
11079
|
+
options: {
|
|
11080
|
+
apiKey: env.DEEPSEEK_GENERATIVE_AI_API_KEY,
|
|
11081
|
+
},
|
|
11082
|
+
};
|
|
11083
|
+
}
|
|
11084
|
+
return null;
|
|
11085
|
+
},
|
|
11086
|
+
});
|
|
11087
|
+
/**
|
|
11088
|
+
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
11089
|
+
*/
|
|
11090
|
+
|
|
11035
11091
|
/**
|
|
11036
11092
|
* Registration of LLM provider metadata
|
|
11037
11093
|
*
|
|
@@ -11578,5 +11634,5 @@ var PrefixStorage = /** @class */ (function () {
|
|
|
11578
11634
|
return PrefixStorage;
|
|
11579
11635
|
}());
|
|
11580
11636
|
|
|
11581
|
-
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, AbstractFormatError, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_BOOKS_DIRNAME, DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, DEFAULT_BOOK_TITLE, DEFAULT_CSV_SETTINGS, DEFAULT_DOWNLOAD_CACHE_DIRNAME, DEFAULT_EXECUTION_CACHE_DIRNAME, DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_PROMPT_TASK_TITLE, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TASK_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError, LOGO_DARK_SRC, LOGO_LIGHT_SRC, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatDefinition, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _BoilerplateScraperMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _MarkitdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, assertsExecutionSuccessful, book, cacheLlmTools, collectionToJson, compilePipeline, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, getPipelineInterface, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, isValidPipelineString, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, parsePipeline, pipelineJsonToString, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTasks, prettifyPipelineString, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline, validatePipelineString };
|
|
11637
|
+
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, AbstractFormatError, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_BOOKS_DIRNAME, DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, DEFAULT_BOOK_TITLE, DEFAULT_CSV_SETTINGS, DEFAULT_DOWNLOAD_CACHE_DIRNAME, DEFAULT_EXECUTION_CACHE_DIRNAME, DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_PROMPT_TASK_TITLE, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TASK_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError, LOGO_DARK_SRC, LOGO_LIGHT_SRC, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatDefinition, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _BoilerplateScraperMetadataRegistration, _DeepseekMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _MarkitdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, assertsExecutionSuccessful, book, cacheLlmTools, collectionToJson, compilePipeline, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, getPipelineInterface, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, isValidPipelineString, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, parsePipeline, pipelineJsonToString, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTasks, prettifyPipelineString, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline, validatePipelineString };
|
|
11582
11638
|
//# sourceMappingURL=index.es.js.map
|