@promptbook/openai 0.60.0-0 → 0.60.0-4
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 +9 -9
- package/esm/index.es.js +25 -25
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +23 -23
- package/esm/typings/src/_packages/node.index.d.ts +2 -2
- package/esm/typings/src/_packages/types.index.d.ts +11 -11
- package/esm/typings/src/_packages/utils.index.d.ts +9 -11
- package/esm/typings/src/config.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +12 -0
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +32 -0
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +23 -0
- package/esm/typings/src/conversion/prettify/PrettifyOptions.d.ts +1 -1
- package/{umd/typings/src/conversion/prettify/prettifyPromptbookString.d.ts → esm/typings/src/conversion/prettify/prettifyPipelineString.d.ts} +2 -2
- package/esm/typings/src/conversion/prettify/{renderPromptbookMermaid.d.ts → renderPipelineMermaidOptions.d.ts} +4 -4
- package/esm/typings/src/conversion/utils/extractParametersFromPromptTemplate.d.ts +2 -2
- package/esm/typings/src/conversion/utils/extractVariables.d.ts +1 -1
- package/esm/typings/src/conversion/utils/parseCommand.d.ts +2 -2
- package/esm/typings/src/conversion/utils/parseNumber.d.ts +1 -1
- package/esm/typings/src/conversion/utils/renameParameter.d.ts +4 -4
- package/esm/typings/src/conversion/validation/_importPipeline.d.ts +13 -0
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +27 -0
- package/{umd/typings/src/errors/PromptbookLibraryError.d.ts → esm/typings/src/errors/CollectionError.d.ts} +2 -2
- package/esm/typings/src/errors/{PromptbookExecutionError.d.ts → ExecutionError.d.ts} +2 -2
- package/{umd/typings/src/errors/PromptbookNotFoundError.d.ts → esm/typings/src/errors/NotFoundError.d.ts} +2 -2
- package/{umd/typings/src/errors/PromptbookLogicError.d.ts → esm/typings/src/errors/PipelineLogicError.d.ts} +2 -2
- package/{umd/typings/src/errors/PromptbookReferenceError.d.ts → esm/typings/src/errors/ReferenceError.d.ts} +2 -2
- package/esm/typings/src/errors/{PromptbookSyntaxError.d.ts → SyntaxError.d.ts} +2 -2
- package/esm/typings/src/errors/TemplateError.d.ts +1 -1
- package/esm/typings/src/errors/_ExpectError.d.ts +2 -2
- package/esm/typings/src/execution/ExecutionTools.d.ts +1 -1
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +4 -4
- package/esm/typings/src/execution/PromptResult.d.ts +1 -1
- package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +1 -1
- package/esm/typings/src/execution/createPromptbookExecutor.d.ts +3 -3
- package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +1 -1
- package/esm/typings/src/execution/utils/checkExpectations.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -1
- package/esm/typings/src/library/PipelineCollection.d.ts +25 -0
- package/esm/typings/src/library/{SimplePromptbookLibrary.d.ts → SimplePipelineCollection.d.ts} +11 -11
- package/{umd/typings/src/library/constructors/createLibraryFromDirectory.d.ts → esm/typings/src/library/constructors/createCollectionFromDirectory.d.ts} +5 -5
- package/esm/typings/src/library/constructors/createCollectionFromJson.d.ts +12 -0
- package/esm/typings/src/library/constructors/createCollectionFromPromise.d.ts +22 -0
- package/esm/typings/src/library/constructors/{createLibraryFromUrl.d.ts → createCollectionFromUrl.d.ts} +5 -5
- package/esm/typings/src/library/constructors/createSubcollection.d.ts +12 -0
- package/esm/typings/src/library/libraryToJson.d.ts +5 -5
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -2
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/mocked/fakeTextToExpectations.d.ts +1 -1
- package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +2 -2
- package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
- package/esm/typings/src/types/Command.d.ts +4 -4
- package/esm/typings/src/types/Parameters.d.ts +1 -1
- package/esm/typings/src/types/{PromptbookJson/PromptbookJson.d.ts → PipelineJson/PipelineJson.d.ts} +5 -5
- package/{umd/typings/src/types/PromptbookString.d.ts → esm/typings/src/types/PipelineString.d.ts} +3 -3
- package/esm/typings/src/types/Prompt.d.ts +4 -4
- package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +2 -2
- package/esm/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +4 -4
- package/esm/typings/src/utils/emojis.d.ts +2 -2
- package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countLines.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countPages.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countWords.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/index.d.ts +2 -2
- package/esm/typings/src/utils/formatNumber.d.ts +1 -1
- package/esm/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +1 -1
- package/esm/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
- package/esm/typings/src/utils/markdown/createMarkdownTable.d.ts +1 -1
- package/esm/typings/src/utils/markdown-json/MarkdownStructure.d.ts +1 -1
- package/esm/typings/src/utils/markdown-json/countMarkdownStructureDeepness.d.ts +1 -1
- package/esm/typings/src/utils/markdown-json/markdownToMarkdownStructure.d.ts +1 -1
- package/package.json +3 -3
- package/umd/index.umd.js +25 -25
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/src/_packages/core.index.d.ts +23 -23
- package/umd/typings/src/_packages/node.index.d.ts +2 -2
- package/umd/typings/src/_packages/types.index.d.ts +11 -11
- package/umd/typings/src/_packages/utils.index.d.ts +9 -11
- package/umd/typings/src/config.d.ts +1 -1
- package/umd/typings/src/conversion/pipelineJsonToString.d.ts +12 -0
- package/umd/typings/src/conversion/pipelineStringToJson.d.ts +32 -0
- package/umd/typings/src/conversion/pipelineStringToJsonSync.d.ts +23 -0
- package/umd/typings/src/conversion/prettify/PrettifyOptions.d.ts +1 -1
- package/{esm/typings/src/conversion/prettify/prettifyPromptbookString.d.ts → umd/typings/src/conversion/prettify/prettifyPipelineString.d.ts} +2 -2
- package/umd/typings/src/conversion/prettify/{renderPromptbookMermaid.d.ts → renderPipelineMermaidOptions.d.ts} +4 -4
- package/umd/typings/src/conversion/utils/extractParametersFromPromptTemplate.d.ts +2 -2
- package/umd/typings/src/conversion/utils/extractVariables.d.ts +1 -1
- package/umd/typings/src/conversion/utils/parseCommand.d.ts +2 -2
- package/umd/typings/src/conversion/utils/parseNumber.d.ts +1 -1
- package/umd/typings/src/conversion/utils/renameParameter.d.ts +4 -4
- package/umd/typings/src/conversion/validation/_importPipeline.d.ts +13 -0
- package/umd/typings/src/conversion/validation/validatePipeline.d.ts +27 -0
- package/{esm/typings/src/errors/PromptbookLibraryError.d.ts → umd/typings/src/errors/CollectionError.d.ts} +2 -2
- package/umd/typings/src/errors/{PromptbookExecutionError.d.ts → ExecutionError.d.ts} +2 -2
- package/{esm/typings/src/errors/PromptbookNotFoundError.d.ts → umd/typings/src/errors/NotFoundError.d.ts} +2 -2
- package/{esm/typings/src/errors/PromptbookLogicError.d.ts → umd/typings/src/errors/PipelineLogicError.d.ts} +2 -2
- package/{esm/typings/src/errors/PromptbookReferenceError.d.ts → umd/typings/src/errors/ReferenceError.d.ts} +2 -2
- package/umd/typings/src/errors/{PromptbookSyntaxError.d.ts → SyntaxError.d.ts} +2 -2
- package/umd/typings/src/errors/TemplateError.d.ts +1 -1
- package/umd/typings/src/errors/_ExpectError.d.ts +2 -2
- package/umd/typings/src/execution/ExecutionTools.d.ts +1 -1
- package/umd/typings/src/execution/LlmExecutionTools.d.ts +4 -4
- package/umd/typings/src/execution/PromptResult.d.ts +1 -1
- package/umd/typings/src/execution/assertsExecutionSuccessful.d.ts +1 -1
- package/umd/typings/src/execution/createPromptbookExecutor.d.ts +3 -3
- package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +1 -1
- package/umd/typings/src/execution/utils/checkExpectations.d.ts +1 -1
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -1
- package/umd/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -1
- package/umd/typings/src/library/PipelineCollection.d.ts +25 -0
- package/umd/typings/src/library/{SimplePromptbookLibrary.d.ts → SimplePipelineCollection.d.ts} +11 -11
- package/{esm/typings/src/library/constructors/createLibraryFromDirectory.d.ts → umd/typings/src/library/constructors/createCollectionFromDirectory.d.ts} +5 -5
- package/umd/typings/src/library/constructors/createCollectionFromJson.d.ts +12 -0
- package/umd/typings/src/library/constructors/createCollectionFromPromise.d.ts +22 -0
- package/umd/typings/src/library/constructors/{createLibraryFromUrl.d.ts → createCollectionFromUrl.d.ts} +5 -5
- package/umd/typings/src/library/constructors/createSubcollection.d.ts +12 -0
- package/umd/typings/src/library/libraryToJson.d.ts +5 -5
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +3 -3
- package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +3 -3
- package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -2
- package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +3 -3
- package/umd/typings/src/llm-providers/mocked/fakeTextToExpectations.d.ts +1 -1
- package/umd/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +3 -3
- package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +3 -3
- package/umd/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +1 -1
- package/umd/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
- package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +3 -3
- package/umd/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +2 -2
- package/umd/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
- package/umd/typings/src/types/Command.d.ts +4 -4
- package/umd/typings/src/types/Parameters.d.ts +1 -1
- package/umd/typings/src/types/{PromptbookJson/PromptbookJson.d.ts → PipelineJson/PipelineJson.d.ts} +5 -5
- package/{esm/typings/src/types/PromptbookString.d.ts → umd/typings/src/types/PipelineString.d.ts} +3 -3
- package/umd/typings/src/types/Prompt.d.ts +4 -4
- package/umd/typings/src/types/execution-report/ExecutionReportJson.d.ts +2 -2
- package/umd/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
- package/umd/typings/src/types/typeAliases.d.ts +4 -4
- package/umd/typings/src/utils/emojis.d.ts +2 -2
- package/umd/typings/src/utils/expectation-counters/countCharacters.d.ts +1 -1
- package/umd/typings/src/utils/expectation-counters/countLines.d.ts +1 -1
- package/umd/typings/src/utils/expectation-counters/countPages.d.ts +1 -1
- package/umd/typings/src/utils/expectation-counters/countParagraphs.d.ts +1 -1
- package/umd/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
- package/umd/typings/src/utils/expectation-counters/countWords.d.ts +1 -1
- package/umd/typings/src/utils/expectation-counters/index.d.ts +2 -2
- package/umd/typings/src/utils/formatNumber.d.ts +1 -1
- package/umd/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +1 -1
- package/umd/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
- package/umd/typings/src/utils/markdown/createMarkdownTable.d.ts +1 -1
- package/umd/typings/src/utils/markdown-json/MarkdownStructure.d.ts +1 -1
- package/umd/typings/src/utils/markdown-json/countMarkdownStructureDeepness.d.ts +1 -1
- package/umd/typings/src/utils/markdown-json/markdownToMarkdownStructure.d.ts +1 -1
- package/esm/typings/src/conversion/promptbookJsonToString.d.ts +0 -12
- package/esm/typings/src/conversion/promptbookStringToJson.d.ts +0 -32
- package/esm/typings/src/conversion/promptbookStringToJsonSync.d.ts +0 -23
- package/esm/typings/src/conversion/validation/_importPromptbook.d.ts +0 -13
- package/esm/typings/src/conversion/validation/validatePromptbook.d.ts +0 -27
- package/esm/typings/src/library/PromptbookLibrary.d.ts +0 -25
- package/esm/typings/src/library/constructors/createLibraryFromJson.d.ts +0 -12
- package/esm/typings/src/library/constructors/createLibraryFromPromise.d.ts +0 -22
- package/esm/typings/src/library/constructors/createSublibrary.d.ts +0 -12
- package/umd/typings/src/conversion/promptbookJsonToString.d.ts +0 -12
- package/umd/typings/src/conversion/promptbookStringToJson.d.ts +0 -32
- package/umd/typings/src/conversion/promptbookStringToJsonSync.d.ts +0 -23
- package/umd/typings/src/conversion/validation/_importPromptbook.d.ts +0 -13
- package/umd/typings/src/conversion/validation/validatePromptbook.d.ts +0 -27
- package/umd/typings/src/library/PromptbookLibrary.d.ts +0 -25
- package/umd/typings/src/library/constructors/createLibraryFromJson.d.ts +0 -12
- package/umd/typings/src/library/constructors/createLibraryFromPromise.d.ts +0 -22
- package/umd/typings/src/library/constructors/createSublibrary.d.ts +0 -12
- /package/esm/typings/{promptbook-library → promptbook-collection}/index.d.ts +0 -0
- /package/esm/typings/src/conversion/{promptbookStringToJson.test.d.ts → pipelineStringToJson.test.d.ts} +0 -0
- /package/esm/typings/src/conversion/{promptbookStringToJsonSync.test.d.ts → pipelineStringToJsonSync.test.d.ts} +0 -0
- /package/esm/typings/src/conversion/validation/{promptbookStringToJson-syntaxErrors.test.d.ts → pipelineStringToJson-syntaxErrors.test.d.ts} +0 -0
- /package/esm/typings/src/conversion/validation/{validatePromptbook-logicErrors.test.d.ts → validatePipeline-logicErrors.test.d.ts} +0 -0
- /package/esm/typings/src/conversion/validation/{validatePromptbook.test.d.ts → validatePipeline.test.d.ts} +0 -0
- /package/esm/typings/src/library/constructors/{createLibraryFromDirectory.test.d.ts → createCollectionFromDirectory.test.d.ts} +0 -0
- /package/esm/typings/src/library/constructors/{createLibraryFromJson.test.d.ts → createCollectionFromJson.test.d.ts} +0 -0
- /package/esm/typings/src/library/constructors/{createLibraryFromPromise.test.d.ts → createCollectionFromPromise.test.d.ts} +0 -0
- /package/esm/typings/src/types/{PromptbookJson → PipelineJson}/KnowledgeJson.d.ts +0 -0
- /package/esm/typings/src/types/{PromptbookJson → PipelineJson}/MaterialKnowledgePieceJson.d.ts +0 -0
- /package/esm/typings/src/types/{PromptbookJson → PipelineJson}/PromptTemplateJson.d.ts +0 -0
- /package/esm/typings/src/types/{PromptbookJson → PipelineJson}/PromptTemplateParameterJson.d.ts +0 -0
- /package/umd/typings/{promptbook-library → promptbook-collection}/index.d.ts +0 -0
- /package/umd/typings/src/conversion/{promptbookStringToJson.test.d.ts → pipelineStringToJson.test.d.ts} +0 -0
- /package/umd/typings/src/conversion/{promptbookStringToJsonSync.test.d.ts → pipelineStringToJsonSync.test.d.ts} +0 -0
- /package/umd/typings/src/conversion/validation/{promptbookStringToJson-syntaxErrors.test.d.ts → pipelineStringToJson-syntaxErrors.test.d.ts} +0 -0
- /package/umd/typings/src/conversion/validation/{validatePromptbook-logicErrors.test.d.ts → validatePipeline-logicErrors.test.d.ts} +0 -0
- /package/umd/typings/src/conversion/validation/{validatePromptbook.test.d.ts → validatePipeline.test.d.ts} +0 -0
- /package/umd/typings/src/library/constructors/{createLibraryFromDirectory.test.d.ts → createCollectionFromDirectory.test.d.ts} +0 -0
- /package/umd/typings/src/library/constructors/{createLibraryFromJson.test.d.ts → createCollectionFromJson.test.d.ts} +0 -0
- /package/umd/typings/src/library/constructors/{createLibraryFromPromise.test.d.ts → createCollectionFromPromise.test.d.ts} +0 -0
- /package/umd/typings/src/types/{PromptbookJson → PipelineJson}/KnowledgeJson.d.ts +0 -0
- /package/umd/typings/src/types/{PromptbookJson → PipelineJson}/MaterialKnowledgePieceJson.d.ts +0 -0
- /package/umd/typings/src/types/{PromptbookJson → PipelineJson}/PromptTemplateJson.d.ts +0 -0
- /package/umd/typings/src/types/{PromptbookJson → PipelineJson}/PromptTemplateParameterJson.d.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { spaceTrim } from 'spacetrim';
|
|
2
|
-
import { renderPromptbookMermaid } from '../conversion/prettify/
|
|
2
|
+
import { renderPromptbookMermaid } from '../conversion/prettify/renderPipelineMermaidOptions';
|
|
3
3
|
import { extractParametersFromPromptTemplate } from '../conversion/utils/extractParametersFromPromptTemplate';
|
|
4
4
|
import { extractVariables } from '../conversion/utils/extractVariables';
|
|
5
5
|
import { parseNumber } from '../conversion/utils/parseNumber';
|
|
@@ -8,32 +8,30 @@ import { titleToName } from '../conversion/utils/titleToName';
|
|
|
8
8
|
import { forEachAsync } from '../execution/utils/forEachAsync';
|
|
9
9
|
import { replaceParameters } from '../execution/utils/replaceParameters';
|
|
10
10
|
import { isValidJsonString } from '../formats/json/utils/isValidJsonString';
|
|
11
|
-
import { CountUtils } from '../utils/expectation-counters/index';
|
|
12
11
|
import { countCharacters } from '../utils/expectation-counters/countCharacters';
|
|
13
12
|
import { countLines } from '../utils/expectation-counters/countLines';
|
|
14
13
|
import { countPages } from '../utils/expectation-counters/countPages';
|
|
15
14
|
import { countParagraphs } from '../utils/expectation-counters/countParagraphs';
|
|
16
|
-
import { countSentences } from '../utils/expectation-counters/countSentences';
|
|
17
|
-
import { splitIntoSentences } from '../utils/expectation-counters/countSentences';
|
|
15
|
+
import { countSentences, splitIntoSentences } from '../utils/expectation-counters/countSentences';
|
|
18
16
|
import { countWords } from '../utils/expectation-counters/countWords';
|
|
17
|
+
import { CountUtils } from '../utils/expectation-counters/index';
|
|
19
18
|
import { extractParameters } from '../utils/extractParameters';
|
|
20
19
|
import { extractAllBlocksFromMarkdown } from '../utils/markdown/extractAllBlocksFromMarkdown';
|
|
21
20
|
import { extractAllListItemsFromMarkdown } from '../utils/markdown/extractAllListItemsFromMarkdown';
|
|
22
21
|
import { extractOneBlockFromMarkdown } from '../utils/markdown/extractOneBlockFromMarkdown';
|
|
23
22
|
import { removeContentComments } from '../utils/markdown/removeContentComments';
|
|
24
23
|
import { removeMarkdownFormatting } from '../utils/markdown/removeMarkdownFormatting';
|
|
24
|
+
import { DIACRITIC_VARIANTS_LETTERS } from '../utils/normalization/DIACRITIC_VARIANTS_LETTERS';
|
|
25
|
+
import type { IKeywords, string_keyword } from '../utils/normalization/IKeywords';
|
|
25
26
|
import { capitalize } from '../utils/normalization/capitalize';
|
|
26
27
|
import { decapitalize } from '../utils/normalization/decapitalize';
|
|
27
|
-
import { DIACRITIC_VARIANTS_LETTERS } from '../utils/normalization/DIACRITIC_VARIANTS_LETTERS';
|
|
28
|
-
import type { IKeywords } from '../utils/normalization/IKeywords';
|
|
29
|
-
import type { string_keyword } from '../utils/normalization/IKeywords';
|
|
30
28
|
import { isValidKeyword } from '../utils/normalization/isValidKeyword';
|
|
31
29
|
import { nameToUriPart } from '../utils/normalization/nameToUriPart';
|
|
32
30
|
import { nameToUriParts } from '../utils/normalization/nameToUriParts';
|
|
33
31
|
import { normalizeToKebabCase } from '../utils/normalization/normalize-to-kebab-case';
|
|
34
|
-
import { normalizeTo_camelCase } from '../utils/normalization/normalizeTo_camelCase';
|
|
35
32
|
import { normalizeTo_PascalCase } from '../utils/normalization/normalizeTo_PascalCase';
|
|
36
33
|
import { normalizeTo_SCREAMING_CASE } from '../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
34
|
+
import { normalizeTo_camelCase } from '../utils/normalization/normalizeTo_camelCase';
|
|
37
35
|
import { normalizeTo_snake_case } from '../utils/normalization/normalizeTo_snake_case';
|
|
38
36
|
import { normalizeWhitespaces } from '../utils/normalization/normalizeWhitespaces';
|
|
39
37
|
import { parseKeywords } from '../utils/normalization/parseKeywords';
|
|
@@ -50,12 +48,12 @@ import { trimCodeBlock } from '../utils/trimCodeBlock';
|
|
|
50
48
|
import { trimEndOfCodeBlock } from '../utils/trimEndOfCodeBlock';
|
|
51
49
|
import { unwrapResult } from '../utils/unwrapResult';
|
|
52
50
|
import { PROMPTBOOK_VERSION } from '../version';
|
|
53
|
-
export {
|
|
51
|
+
export { PROMPTBOOK_VERSION, forEachAsync };
|
|
54
52
|
export { extractAllBlocksFromMarkdown, // <- [🌻]
|
|
55
53
|
extractAllListItemsFromMarkdown, extractBlock, // <- [🌻]
|
|
56
54
|
extractOneBlockFromMarkdown, extractParameters, extractVariables, isValidJsonString, parseNumber, // <- [🌻]
|
|
57
55
|
removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, spaceTrim, trimCodeBlock, trimEndOfCodeBlock, unwrapResult, };
|
|
58
|
-
export { countCharacters, countLines, countPages, countParagraphs, countSentences,
|
|
56
|
+
export { CountUtils, countCharacters, countLines, countPages, countParagraphs, countSentences, countWords };
|
|
59
57
|
export { splitIntoSentences };
|
|
60
58
|
export declare const normalizeTo: {
|
|
61
59
|
camelCase: typeof normalizeTo_camelCase;
|
|
@@ -64,7 +62,7 @@ export declare const normalizeTo: {
|
|
|
64
62
|
snake_case: typeof normalizeTo_snake_case;
|
|
65
63
|
'kebab-case': typeof normalizeToKebabCase;
|
|
66
64
|
};
|
|
67
|
-
export {
|
|
65
|
+
export { DIACRITIC_VARIANTS_LETTERS, IKeywords, capitalize, decapitalize, isValidKeyword, nameToUriPart, nameToUriParts, normalizeToKebabCase, normalizeTo_PascalCase, normalizeTo_SCREAMING_CASE, normalizeTo_camelCase, normalizeTo_snake_case, normalizeWhitespaces, parseKeywords, parseKeywordsFromString, removeDiacritics, searchKeywords, string_keyword, titleToName, };
|
|
68
66
|
export { extractParametersFromPromptTemplate, renameParameter, renderPromptbookMermaid };
|
|
69
67
|
export { difference, intersection, union };
|
|
70
68
|
/**
|
|
@@ -7,6 +7,6 @@ export declare const LOOP_LIMIT = 1000;
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const CHARACTER_LOOP_LIMIT = 100000;
|
|
9
9
|
/**
|
|
10
|
-
* The name of the builded promptbook library made by CLI `promptbook make` and for lookup in `
|
|
10
|
+
* The name of the builded promptbook library made by CLI `promptbook make` and for lookup in `createCollectionFromDirectory`
|
|
11
11
|
*/
|
|
12
12
|
export declare const PROMPTBOOK_MAKED_BASE_FILENAME = "index";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
|
|
2
|
+
import type { PipelineString } from '../types/PipelineString';
|
|
3
|
+
/**
|
|
4
|
+
* Converts promptbook in JSON format to string format
|
|
5
|
+
*
|
|
6
|
+
* @param pipelineJson Promptbook in JSON format (.ptbk.json)
|
|
7
|
+
* @returns Promptbook in string format (.ptbk.md)
|
|
8
|
+
*/
|
|
9
|
+
export declare function pipelineJsonToString(pipelineJson: PipelineJson): PipelineString;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: Escape all
|
|
12
|
+
*/
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { LlmExecutionTools } from '../execution/LlmExecutionTools';
|
|
2
|
+
import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
|
|
3
|
+
import type { PipelineString } from '../types/PipelineString';
|
|
4
|
+
/**
|
|
5
|
+
* Options for pipelineStringToJson
|
|
6
|
+
*/
|
|
7
|
+
type PipelineStringToJsonOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* Tools for processing required for knowledge processing *(not for actual execution)*
|
|
10
|
+
*/
|
|
11
|
+
llmTools?: LlmExecutionTools;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Compile promptbook from string (markdown) format to JSON format
|
|
15
|
+
*
|
|
16
|
+
* Note: There are two similar functions:
|
|
17
|
+
* - `pipelineStringToJson` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
|
|
18
|
+
* - `pipelineStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
|
|
19
|
+
*
|
|
20
|
+
* @param pipelineString {Promptbook} in string markdown format (.ptbk.md)
|
|
21
|
+
* @param options - Options and tools for the compilation
|
|
22
|
+
* @returns {Promptbook} compiled in JSON format (.ptbk.json)
|
|
23
|
+
* @throws {SyntaxError} if the promptbook string is not valid
|
|
24
|
+
*
|
|
25
|
+
* Note: This function does not validate logic of the pipeline only the syntax
|
|
26
|
+
* Note: This function acts as compilation process
|
|
27
|
+
*/
|
|
28
|
+
export declare function pipelineStringToJson(pipelineString: PipelineString, options?: PipelineStringToJsonOptions): Promise<PipelineJson>;
|
|
29
|
+
export {};
|
|
30
|
+
/**
|
|
31
|
+
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
32
|
+
*/
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
|
|
2
|
+
import type { PipelineString } from '../types/PipelineString';
|
|
3
|
+
/**
|
|
4
|
+
* Compile promptbook from string (markdown) format to JSON format synchronously
|
|
5
|
+
*
|
|
6
|
+
* Note: There are two similar functions:
|
|
7
|
+
* - `pipelineStringToJson` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
|
|
8
|
+
* - `pipelineStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
|
|
9
|
+
*
|
|
10
|
+
* @param pipelineString {Promptbook} in string markdown format (.ptbk.md)
|
|
11
|
+
* @param options - Options and tools for the compilation
|
|
12
|
+
* @returns {Promptbook} compiled in JSON format (.ptbk.json)
|
|
13
|
+
* @throws {SyntaxError} if the promptbook string is not valid
|
|
14
|
+
*
|
|
15
|
+
* Note: This function does not validate logic of the pipeline only the syntax
|
|
16
|
+
* Note: This function acts as compilation process
|
|
17
|
+
*/
|
|
18
|
+
export declare function pipelineStringToJsonSync(pipelineString: PipelineString): PipelineJson;
|
|
19
|
+
/**
|
|
20
|
+
* TODO: Report here line/column of error
|
|
21
|
+
* TODO: Use spaceTrim more effectively
|
|
22
|
+
* TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
|
|
23
|
+
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineString } from '../../types/PipelineString';
|
|
2
2
|
import type { PrettifyOptions } from './PrettifyOptions';
|
|
3
3
|
/**
|
|
4
4
|
* Prettyfies Promptbook string and adds Mermaid graph
|
|
5
5
|
*/
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function prettifyPipelineString(pipelineString: PipelineString, options: PrettifyOptions): Promise<PipelineString>;
|
|
7
7
|
/**
|
|
8
8
|
* TODO: Maybe use some Mermaid library instead of string templating
|
|
9
9
|
* TODO: [🕌] When more than 2 functionalities, split into separate functions
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { PromptTemplateJson } from '../../types/
|
|
1
|
+
import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
|
|
2
|
+
import type { PromptTemplateJson } from '../../types/PipelineJson/PromptTemplateJson';
|
|
3
3
|
import type { string_href } from '../../types/typeAliases';
|
|
4
4
|
/**
|
|
5
5
|
* Addtional options for rendering Mermaid graph
|
|
6
6
|
*/
|
|
7
|
-
export type
|
|
7
|
+
export type renderPipelineMermaidOptions = {
|
|
8
8
|
/**
|
|
9
9
|
* Callback for creating from prompt template graph node
|
|
10
10
|
*/
|
|
@@ -18,7 +18,7 @@ export type renderPromptbookMermaidOptions = {
|
|
|
18
18
|
*
|
|
19
19
|
* Note: The result is not wrapped in a Markdown code block
|
|
20
20
|
*/
|
|
21
|
-
export declare function renderPromptbookMermaid(
|
|
21
|
+
export declare function renderPromptbookMermaid(pipelineJson: PipelineJson, options?: renderPipelineMermaidOptions): string;
|
|
22
22
|
/**
|
|
23
23
|
* TODO: Maybe use some Mermaid library instead of string templating
|
|
24
24
|
* TODO: [🕌] When more than 2 functionalities, split into separate functions
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { PromptTemplateJson } from '../../types/
|
|
1
|
+
import type { PromptTemplateJson } from '../../types/PipelineJson/PromptTemplateJson';
|
|
2
2
|
import type { string_name } from '../../types/typeAliases';
|
|
3
3
|
/**
|
|
4
4
|
* Parses the prompt template and returns the set of all used parameters
|
|
5
5
|
*
|
|
6
6
|
* @param promptTemplate the template with used parameters
|
|
7
7
|
* @returns the set of parameter names
|
|
8
|
-
* @throws {
|
|
8
|
+
* @throws {SyntaxError} if the script is invalid
|
|
9
9
|
*/
|
|
10
10
|
export declare function extractParametersFromPromptTemplate(promptTemplate: Pick<PromptTemplateJson, 'title' | 'description' | 'executionType' | 'content'>): Set<string_name>;
|
|
11
11
|
/**
|
|
@@ -5,7 +5,7 @@ import type { string_javascript_name } from '../../types/typeAliases';
|
|
|
5
5
|
*
|
|
6
6
|
* @param script from which to extract the variables
|
|
7
7
|
* @returns the list of variable names
|
|
8
|
-
* @throws {
|
|
8
|
+
* @throws {SyntaxError} if the script is invalid
|
|
9
9
|
*/
|
|
10
10
|
export declare function extractVariables(script: string_javascript): Set<string_javascript_name>;
|
|
11
11
|
/**
|
|
@@ -4,8 +4,8 @@ import type { string_markdown_text } from '../../types/typeAliases';
|
|
|
4
4
|
* Parses one line of ul/ol to command
|
|
5
5
|
*
|
|
6
6
|
* @returns parsed command object
|
|
7
|
-
* @throws {
|
|
7
|
+
* @throws {SyntaxError} if the command is invalid
|
|
8
8
|
*
|
|
9
|
-
* @private within the
|
|
9
|
+
* @private within the pipelineStringToJson
|
|
10
10
|
*/
|
|
11
11
|
export declare function parseCommand(listItem: string_markdown_text): Command;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
|
|
2
2
|
import type { string_name } from '../../types/typeAliases';
|
|
3
3
|
type RenameParameterOptions = {
|
|
4
4
|
/**
|
|
5
5
|
* Promptbook to search and replace for parameters
|
|
6
6
|
* This promptbook is returned as copy with replaced parameters
|
|
7
7
|
*/
|
|
8
|
-
promptbook:
|
|
8
|
+
promptbook: PipelineJson;
|
|
9
9
|
/**
|
|
10
10
|
* Original parameter name that should be replaced
|
|
11
11
|
*/
|
|
@@ -19,7 +19,7 @@ type RenameParameterOptions = {
|
|
|
19
19
|
* Function renameParameter will find all usable parameters for given prompt template
|
|
20
20
|
* In other words, it will find all parameters that are not used in the prompt template itseld and all its dependencies
|
|
21
21
|
*
|
|
22
|
-
* @throws {
|
|
22
|
+
* @throws {PipelineLogicError} If the new parameter name is already used in the promptbook
|
|
23
23
|
*/
|
|
24
|
-
export declare function renameParameter(options: RenameParameterOptions):
|
|
24
|
+
export declare function renameParameter(options: RenameParameterOptions): PipelineJson;
|
|
25
25
|
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
|
|
2
|
+
import type { PipelineString } from '../../types/PipelineString';
|
|
3
|
+
/**
|
|
4
|
+
* Import the text file
|
|
5
|
+
*
|
|
6
|
+
* Note: Using here custom import to work in jest tests
|
|
7
|
+
* Note: Using sync version is 💩 in the production code, but it's ok here in tests
|
|
8
|
+
*
|
|
9
|
+
* @param path - The path to the file relative to samples/templates directory
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
export declare function importPipeline(path: `${string}.ptbk.md`): PipelineString;
|
|
13
|
+
export declare function importPipeline(path: `${string}.ptbk.json`): PipelineJson;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
|
|
2
|
+
/**
|
|
3
|
+
* Validates PipelineJson if it is logically valid
|
|
4
|
+
*
|
|
5
|
+
* It checks:
|
|
6
|
+
* - if it has correct parameters dependency
|
|
7
|
+
*
|
|
8
|
+
* It does NOT check:
|
|
9
|
+
* - if it is valid json
|
|
10
|
+
* - if it is meaningful
|
|
11
|
+
*
|
|
12
|
+
* @param pipeline valid or invalid PipelineJson
|
|
13
|
+
* @returns the same pipeline if it is logically valid
|
|
14
|
+
* @throws {PipelineLogicError} on logical error in the pipeline
|
|
15
|
+
*/
|
|
16
|
+
export declare function validatePipeline(pipeline: PipelineJson): PipelineJson;
|
|
17
|
+
/**
|
|
18
|
+
* TODO: [🧠] Work with promptbookVersion
|
|
19
|
+
* TODO: Use here some json-schema, Zod or something similar and change it to:
|
|
20
|
+
* > /**
|
|
21
|
+
* > * Validates PipelineJson if it is logically valid.
|
|
22
|
+
* > *
|
|
23
|
+
* > * It checks:
|
|
24
|
+
* > * - it has a valid structure
|
|
25
|
+
* > * - ...
|
|
26
|
+
* > ex port function validatePipeline(promptbook: unknown): asserts promptbook is PipelineJson {
|
|
27
|
+
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This error indicates that the promptbook library cannot be propperly loaded
|
|
3
3
|
*/
|
|
4
|
-
export declare class
|
|
5
|
-
readonly name = "
|
|
4
|
+
export declare class CollectionError extends Error {
|
|
5
|
+
readonly name = "CollectionError";
|
|
6
6
|
constructor(message: string);
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This error indicates errors during the execution of the promptbook
|
|
3
3
|
*/
|
|
4
|
-
export declare class
|
|
5
|
-
readonly name = "
|
|
4
|
+
export declare class ExecutionError extends Error {
|
|
5
|
+
readonly name = "ExecutionError";
|
|
6
6
|
constructor(message: string);
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This error indicates that promptbook not found in the library
|
|
3
3
|
*/
|
|
4
|
-
export declare class
|
|
5
|
-
readonly name = "
|
|
4
|
+
export declare class NotFoundError extends Error {
|
|
5
|
+
readonly name = "NotFoundError";
|
|
6
6
|
constructor(message: string);
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This error indicates that the promptbook object has valid syntax but contains logical errors (like circular dependencies)
|
|
3
3
|
*/
|
|
4
|
-
export declare class
|
|
5
|
-
readonly name = "
|
|
4
|
+
export declare class PipelineLogicError extends Error {
|
|
5
|
+
readonly name = "PipelineLogicError";
|
|
6
6
|
constructor(message: string);
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This error indicates errors in referencing promptbooks between each other
|
|
3
3
|
*/
|
|
4
|
-
export declare class
|
|
5
|
-
readonly name = "
|
|
4
|
+
export declare class ReferenceError extends Error {
|
|
5
|
+
readonly name = "ReferenceError";
|
|
6
6
|
constructor(message: string);
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
3
3
|
*/
|
|
4
|
-
export declare class
|
|
5
|
-
readonly name = "
|
|
4
|
+
export declare class SyntaxError extends Error {
|
|
5
|
+
readonly name = "SyntaxError";
|
|
6
6
|
constructor(message: string);
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This error occurs during the parameter replacement in the template
|
|
3
3
|
*
|
|
4
|
-
* Note: This is a kindof subtype of
|
|
4
|
+
* Note: This is a kindof subtype of ExecutionError because it occurs during the execution of the pipeline
|
|
5
5
|
*/
|
|
6
6
|
export declare class TemplateError extends Error {
|
|
7
7
|
readonly name = "TemplateError";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This error occurs when some expectation is not met in the execution of the pipeline
|
|
3
3
|
*
|
|
4
|
-
* @private Always catched and rethrown as `
|
|
5
|
-
* Note: This is a kindof subtype of
|
|
4
|
+
* @private Always catched and rethrown as `ExecutionError`
|
|
5
|
+
* Note: This is a kindof subtype of ExecutionError
|
|
6
6
|
*/
|
|
7
7
|
export declare class ExpectError extends Error {
|
|
8
8
|
readonly name = "ExpectError";
|
|
@@ -2,7 +2,7 @@ import type { LlmExecutionTools } from './LlmExecutionTools';
|
|
|
2
2
|
import type { ScriptExecutionTools } from './ScriptExecutionTools';
|
|
3
3
|
import type { UserInterfaceTools } from './UserInterfaceTools';
|
|
4
4
|
/**
|
|
5
|
-
* All the tools needed to execute
|
|
5
|
+
* All the tools needed to execute pipelines.
|
|
6
6
|
*
|
|
7
7
|
* @see https://github.com/webgptorg/promptbook#execution-tools
|
|
8
8
|
*/
|
|
@@ -16,11 +16,11 @@ export type LlmExecutionTools = {
|
|
|
16
16
|
/**
|
|
17
17
|
* Use a chat model
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
callChatModel(prompt: Prompt): Promise<PromptChatResult>;
|
|
20
20
|
/**
|
|
21
21
|
* Use a completion model
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
callCompletionModel(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
24
24
|
/**
|
|
25
25
|
* List all available models that can be used
|
|
26
26
|
*/
|
|
@@ -46,6 +46,6 @@ export type AvailableModel = {
|
|
|
46
46
|
/**
|
|
47
47
|
* TODO: [🧠] Emulation of one type of model with another one - emuate chat with completion; emulate translation with chat
|
|
48
48
|
* TODO: [🍓][♐] Some heuristic to pick the best model in listed models
|
|
49
|
-
* TODO: [🏳]
|
|
50
|
-
* TODO: [🧠] Should or should not there be a word "GPT" in both
|
|
49
|
+
* TODO: [🏳] callChatModel -> chat, callCompletionModel -> complete, translate
|
|
50
|
+
* TODO: [🧠] Should or should not there be a word "GPT" in both callCompletionModel and callChatModel
|
|
51
51
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { KebabCase } from 'type-fest';
|
|
2
|
-
import type { ExpectationUnit } from '../types/
|
|
2
|
+
import type { ExpectationUnit } from '../types/PipelineJson/PromptTemplateJson';
|
|
3
3
|
import type { number_positive } from '../types/typeAliases';
|
|
4
4
|
import type { number_usd } from '../types/typeAliases';
|
|
5
5
|
import type { string_date_iso8601 } from '../types/typeAliases';
|
|
@@ -3,7 +3,7 @@ import type { PromptbookExecutor } from './PromptbookExecutor';
|
|
|
3
3
|
* Asserts that the execution of a promptnook is successful
|
|
4
4
|
*
|
|
5
5
|
* @param executionResult - The partial result of the promptnook execution
|
|
6
|
-
* @throws {
|
|
6
|
+
* @throws {ExecutionError} If the execution is not successful or if multiple errors occurred
|
|
7
7
|
*/
|
|
8
8
|
export declare function assertsExecutionSuccessful(executionResult: Pick<Awaited<ReturnType<PromptbookExecutor>>, 'isSuccessful' | 'errors'>): void;
|
|
9
9
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
|
|
2
2
|
import type { ExecutionTools } from './ExecutionTools';
|
|
3
3
|
import type { PromptbookExecutor } from './PromptbookExecutor';
|
|
4
4
|
type CreatePromptbookExecutorSettings = {
|
|
@@ -16,7 +16,7 @@ interface CreatePromptbookExecutorOptions {
|
|
|
16
16
|
/**
|
|
17
17
|
* The promptbook to be executed
|
|
18
18
|
*/
|
|
19
|
-
readonly promptbook:
|
|
19
|
+
readonly promptbook: PipelineJson;
|
|
20
20
|
/**
|
|
21
21
|
* The execution tools to be used during the execution of the PROMPTBOOK
|
|
22
22
|
*/
|
|
@@ -30,7 +30,7 @@ interface CreatePromptbookExecutorOptions {
|
|
|
30
30
|
* Creates executor function from promptbook and execution tools.
|
|
31
31
|
*
|
|
32
32
|
* @returns The executor function
|
|
33
|
-
* @throws {
|
|
33
|
+
* @throws {PipelineLogicError} on logical error in the promptbook
|
|
34
34
|
*/
|
|
35
35
|
export declare function createPromptbookExecutor(options: CreatePromptbookExecutorOptions): PromptbookExecutor;
|
|
36
36
|
export {};
|
package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LlmExecutionTools } from '../../../execution/LlmExecutionTools';
|
|
2
|
-
import type { KnowledgeJson } from '../../../types/
|
|
2
|
+
import type { KnowledgeJson } from '../../../types/PipelineJson/KnowledgeJson';
|
|
3
3
|
import type { string_markdown } from '../../../types/typeAliases';
|
|
4
4
|
type PrepareKnowledgeFromMarkdownOptions = {
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LlmExecutionTools } from '../../../execution/LlmExecutionTools';
|
|
2
|
-
import type { KnowledgeJson } from '../../../types/
|
|
2
|
+
import type { KnowledgeJson } from '../../../types/PipelineJson/KnowledgeJson';
|
|
3
3
|
import type { string_base64 } from '../../../types/typeAliases';
|
|
4
4
|
type PrepareKnowledgeFromPdfOptions = {
|
|
5
5
|
/**
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Promisable } from 'type-fest';
|
|
2
|
+
import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
|
|
3
|
+
import type { Prompt } from '../types/Prompt';
|
|
4
|
+
import type { string_pipeline_url } from '../types/typeAliases';
|
|
5
|
+
/**
|
|
6
|
+
* Collection that groups together pipelines, knowledge, personas, tools and actions
|
|
7
|
+
*
|
|
8
|
+
* @see !!! https://github.com/webgptorg/pipeline#pipeline-library
|
|
9
|
+
*/
|
|
10
|
+
export type PipelineCollection = {
|
|
11
|
+
/**
|
|
12
|
+
* Gets all pipelines in the library
|
|
13
|
+
*/
|
|
14
|
+
listPipelines(): Promisable<Array<string_pipeline_url>>;
|
|
15
|
+
/**
|
|
16
|
+
* Gets pipeline by its URL
|
|
17
|
+
*
|
|
18
|
+
* Note: This is not a direct fetching from the URL, but a lookup in the library
|
|
19
|
+
*/
|
|
20
|
+
getPipelineByUrl(url: string_pipeline_url): Promisable<PipelineJson>;
|
|
21
|
+
/**
|
|
22
|
+
* Checks whether given prompt was defined in any pipeline in the library
|
|
23
|
+
*/
|
|
24
|
+
isResponsibleForPrompt(prompt: Prompt): Promisable<boolean>;
|
|
25
|
+
};
|
package/esm/typings/src/library/{SimplePromptbookLibrary.d.ts → SimplePipelineCollection.d.ts}
RENAMED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
+
import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
|
|
1
2
|
import type { Prompt } from '../types/Prompt';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type { PromptbookLibrary } from './PromptbookLibrary';
|
|
3
|
+
import type { string_pipeline_url } from '../types/typeAliases';
|
|
4
|
+
import type { PipelineCollection } from './PipelineCollection';
|
|
5
5
|
/**
|
|
6
6
|
* Library of promptbooks that groups together promptbooks for an application.
|
|
7
7
|
* This implementation is a very thin wrapper around the Array / Map of promptbooks.
|
|
8
8
|
*
|
|
9
|
-
* @private use `
|
|
10
|
-
* @see https://github.com/webgptorg/promptbook#promptbook-
|
|
9
|
+
* @private use `createCollectionFromJson` instead
|
|
10
|
+
* @see https://github.com/webgptorg/promptbook#promptbook-collection
|
|
11
11
|
*/
|
|
12
|
-
export declare class
|
|
12
|
+
export declare class SimplePipelineCollection implements PipelineCollection {
|
|
13
13
|
private library;
|
|
14
14
|
/**
|
|
15
15
|
* Constructs a promptbook library from promptbooks
|
|
16
16
|
*
|
|
17
17
|
* @param promptbooks !!!
|
|
18
18
|
*
|
|
19
|
-
* @private Use instead `
|
|
19
|
+
* @private Use instead `createCollectionFromJson`
|
|
20
20
|
* Note: During the construction logic of all promptbooks are validated
|
|
21
|
-
* Note: It is not recommended to use this constructor directly, use `
|
|
21
|
+
* Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
|
|
22
22
|
*/
|
|
23
|
-
constructor(...promptbooks: Array<
|
|
23
|
+
constructor(...promptbooks: Array<PipelineJson>);
|
|
24
24
|
/**
|
|
25
25
|
* Gets all promptbooks in the library
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
listPipelines(): Array<string_pipeline_url>;
|
|
28
28
|
/**
|
|
29
29
|
* Gets promptbook by its URL
|
|
30
30
|
*
|
|
31
31
|
* Note: This is not a direct fetching from the URL, but a lookup in the library
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
getPipelineByUrl(url: string_pipeline_url): PipelineJson;
|
|
34
34
|
/**
|
|
35
35
|
* Checks whether given prompt was defined in any promptbook in the library
|
|
36
36
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { string_folder_path } from '../../types/typeAliases';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PipelineCollection } from '../PipelineCollection';
|
|
3
3
|
/**
|
|
4
|
-
* Options for `
|
|
4
|
+
* Options for `createCollectionFromDirectory` function
|
|
5
5
|
*/
|
|
6
|
-
type
|
|
6
|
+
type CreatePipelineCollectionFromDirectoryOptions = {
|
|
7
7
|
/**
|
|
8
8
|
* If true, the directory is searched recursively for promptbooks
|
|
9
9
|
*
|
|
@@ -37,9 +37,9 @@ type CreatePromptbookLibraryFromDirectoryOptions = {
|
|
|
37
37
|
*
|
|
38
38
|
* @param path - path to the directory with promptbooks
|
|
39
39
|
* @param options - Misc options for the library
|
|
40
|
-
* @returns
|
|
40
|
+
* @returns PipelineCollection
|
|
41
41
|
*/
|
|
42
|
-
export declare function
|
|
42
|
+
export declare function createCollectionFromDirectory(path: string_folder_path, options?: CreatePipelineCollectionFromDirectoryOptions): Promise<PipelineCollection>;
|
|
43
43
|
export {};
|
|
44
44
|
/**
|
|
45
45
|
* TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
|
|
2
|
+
import type { PipelineCollection } from '../PipelineCollection';
|
|
3
|
+
/**
|
|
4
|
+
* Creates PipelineCollection from array of PipelineJson or PipelineString
|
|
5
|
+
*
|
|
6
|
+
* Note: Functions `libraryToJson` and `createCollectionFromJson` are complementary
|
|
7
|
+
* Note: During the construction syntax and logic of all sources are validated
|
|
8
|
+
*
|
|
9
|
+
* @param promptbookSources
|
|
10
|
+
* @returns PipelineCollection
|
|
11
|
+
*/
|
|
12
|
+
export declare function createCollectionFromJson(...promptbooks: Array<PipelineJson>): PipelineCollection;
|