@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
|
@@ -22,11 +22,11 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
|
|
|
22
22
|
/**
|
|
23
23
|
* Calls Anthropic Claude API to use a chat model.
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<PromptChatResult>;
|
|
26
26
|
/**
|
|
27
27
|
* Calls Anthropic Claude API to use a complete model.
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
callCompletionModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<PromptCompletionResult>;
|
|
30
30
|
/**
|
|
31
31
|
* Get the model that should be used as default
|
|
32
32
|
*/
|
|
@@ -43,6 +43,6 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
|
|
|
43
43
|
/**
|
|
44
44
|
* TODO: !!!! [🍆] JSON mode
|
|
45
45
|
* TODO: [🧠] Maybe handle errors via transformAnthropicError (like transformAzureError)
|
|
46
|
-
* TODO: Maybe Create some common util for
|
|
46
|
+
* TODO: Maybe Create some common util for callChatModel and callCompletionModel
|
|
47
47
|
* TODO: Maybe make custom OpenaiError
|
|
48
48
|
*/
|
|
@@ -22,11 +22,11 @@ export declare class AzureOpenAiExecutionTools implements LlmExecutionTools {
|
|
|
22
22
|
/**
|
|
23
23
|
* Calls OpenAI API to use a chat model.
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<PromptChatResult>;
|
|
26
26
|
/**
|
|
27
27
|
* Calls Azure OpenAI API to use a complete model.
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
callCompletionModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<PromptCompletionResult>;
|
|
30
30
|
/**
|
|
31
31
|
* Changes Azure error (which is not propper Error but object) to propper Error
|
|
32
32
|
*/
|
|
@@ -37,6 +37,6 @@ export declare class AzureOpenAiExecutionTools implements LlmExecutionTools {
|
|
|
37
37
|
listModels(): Promise<Array<AvailableModel>>;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* TODO: Maybe Create some common util for
|
|
40
|
+
* TODO: Maybe Create some common util for callChatModel and callCompletionModel
|
|
41
41
|
* TODO: Maybe make custom AzureOpenaiError
|
|
42
42
|
*/
|
|
@@ -13,11 +13,11 @@ export declare class MockedEchoLlmExecutionTools implements LlmExecutionTools {
|
|
|
13
13
|
/**
|
|
14
14
|
* Mocks chat model
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<PromptChatResult>;
|
|
17
17
|
/**
|
|
18
18
|
* Mocks completion model
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
callCompletionModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<PromptCompletionResult>;
|
|
21
21
|
/**
|
|
22
22
|
* List all available mocked-models that can be used
|
|
23
23
|
*/
|
|
@@ -13,11 +13,11 @@ export declare class MockedFackedLlmExecutionTools implements LlmExecutionTools
|
|
|
13
13
|
/**
|
|
14
14
|
* Fakes chat model
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<PromptChatResult & PromptCompletionResult>;
|
|
17
17
|
/**
|
|
18
18
|
* Fakes completion model
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
callCompletionModel(prompt: Pick<Prompt, 'content' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<PromptCompletionResult>;
|
|
21
21
|
/**
|
|
22
22
|
* List all available fake-models that can be used
|
|
23
23
|
*/
|
|
@@ -25,4 +25,4 @@ export declare class MockedFackedLlmExecutionTools implements LlmExecutionTools
|
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* TODO: [🕵️♀️] Maybe just remove
|
|
28
|
-
*/
|
|
28
|
+
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PostprocessingFunction } from '../../scripting/javascript/JavascriptExecutionToolsOptions';
|
|
2
|
-
import type { Expectations } from '../../types/
|
|
2
|
+
import type { Expectations } from '../../types/PipelineJson/PromptTemplateJson';
|
|
3
3
|
/**
|
|
4
4
|
* Gets the expectations and creates a fake text that meets the expectations
|
|
5
5
|
*
|
|
@@ -20,15 +20,15 @@ export declare class MultipleLlmExecutionTools implements LlmExecutionTools {
|
|
|
20
20
|
/**
|
|
21
21
|
* Calls the best available chat model
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
callChatModel(prompt: Prompt): Promise<PromptChatResult>;
|
|
24
24
|
/**
|
|
25
25
|
* Calls the best available completion model
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
callCompletionModel(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
28
28
|
/**
|
|
29
29
|
* Calls the best available model
|
|
30
30
|
*/
|
|
31
|
-
private
|
|
31
|
+
private callModelCommon;
|
|
32
32
|
/**
|
|
33
33
|
* List all available models that can be used
|
|
34
34
|
* This liost is a combination of all available models from all execution tools
|
|
@@ -23,11 +23,11 @@ export declare class OpenAiExecutionTools implements LlmExecutionTools {
|
|
|
23
23
|
/**
|
|
24
24
|
* Calls OpenAI API to use a chat model.
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements' | 'expectFormat'>): Promise<PromptChatResult>;
|
|
27
27
|
/**
|
|
28
28
|
* Calls OpenAI API to use a complete model.
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
callCompletionModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<PromptCompletionResult>;
|
|
31
31
|
/**
|
|
32
32
|
* Calls OpenAI API to use a embedding model
|
|
33
33
|
*/
|
|
@@ -55,6 +55,6 @@ export declare class OpenAiExecutionTools implements LlmExecutionTools {
|
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* TODO: [🧠][🧙♂️] Maybe there can be some wizzard for thoose who want to use just OpenAI
|
|
58
|
-
* TODO: Maybe Create some common util for
|
|
58
|
+
* TODO: Maybe Create some common util for callChatModel and callCompletionModel
|
|
59
59
|
* TODO: Maybe make custom OpenaiError
|
|
60
60
|
*/
|
|
@@ -7,7 +7,7 @@ import type { Prompt } from '../../types/Prompt';
|
|
|
7
7
|
* @param promptContent The content of the prompt
|
|
8
8
|
* @param resultContent The content of the result (for embedding prompts or failed prompts pass empty string)
|
|
9
9
|
* @param rawResponse The raw response from OpenAI API
|
|
10
|
-
* @throws {
|
|
10
|
+
* @throws {ExecutionError} If the usage is not defined in the response from OpenAI
|
|
11
11
|
* @private internal util of `OpenAiExecutionTools`
|
|
12
12
|
*/
|
|
13
13
|
export declare function computeOpenaiUsage(promptContent: Prompt['content'], // <- Note: Intentionally using [] to access type properties to bring jsdoc from Prompt/PromptResult to consumer
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* @see https://openai.com/api/pricing/
|
|
5
5
|
* @see https://docs.anthropic.com/en/docs/models-overview
|
|
6
6
|
*
|
|
7
|
-
* @private within the
|
|
7
|
+
* @private within the package, used only as internal helper for `OPENAI_MODELS` and `computeUsage`
|
|
8
8
|
*/
|
|
9
9
|
type string_model_price = `$${number}.${number} / ${number}M tokens`;
|
|
10
10
|
/**
|
|
11
11
|
* Function computeUsage will create price per one token based on the string value found on openai page
|
|
12
12
|
*
|
|
13
|
-
* @private within the
|
|
13
|
+
* @private within the package, used only as internal helper for `OPENAI_MODELS`
|
|
14
14
|
*/
|
|
15
15
|
export declare function computeUsage(value: string_model_price): number;
|
|
16
16
|
export {};
|
|
@@ -22,15 +22,15 @@ export declare class RemoteLlmExecutionTools implements LlmExecutionTools {
|
|
|
22
22
|
/**
|
|
23
23
|
* Calls remote proxy server to use a chat model.
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
callChatModel(prompt: Prompt): Promise<PromptChatResult>;
|
|
26
26
|
/**
|
|
27
27
|
* Calls remote proxy server to use a completion model.
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
callCompletionModel(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
30
30
|
/**
|
|
31
31
|
* Calls remote proxy server to use both completion or chat model.
|
|
32
32
|
*/
|
|
33
|
-
private
|
|
33
|
+
private callModelCommon;
|
|
34
34
|
/**
|
|
35
35
|
* List all available models that can be used
|
|
36
36
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CommonExecutionToolsOptions } from '../../../execution/CommonExecutionToolsOptions';
|
|
2
2
|
import type { LlmExecutionTools } from '../../../execution/LlmExecutionTools';
|
|
3
|
-
import type {
|
|
3
|
+
import type { PipelineCollection } from '../../../library/PipelineCollection';
|
|
4
4
|
import type { client_id } from '../../../types/typeAliases';
|
|
5
5
|
import type { string_uri } from '../../../types/typeAliases';
|
|
6
6
|
export type RemoteServerOptions = CommonExecutionToolsOptions & {
|
|
@@ -20,7 +20,7 @@ export type RemoteServerOptions = CommonExecutionToolsOptions & {
|
|
|
20
20
|
*
|
|
21
21
|
* This is used to checkl validity of the prompt to prevent DDoS
|
|
22
22
|
*/
|
|
23
|
-
readonly library:
|
|
23
|
+
readonly library: PipelineCollection;
|
|
24
24
|
/**
|
|
25
25
|
* Creates llm execution tools for each client
|
|
26
26
|
*/
|
|
@@ -10,7 +10,7 @@ import type { RemoteServerOptions } from './interfaces/RemoteServerOptions';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare function startRemoteServer(options: RemoteServerOptions): IDestroyable;
|
|
12
12
|
/**
|
|
13
|
-
* TODO: [⚖] Expose the library to be able to connect to same library via
|
|
13
|
+
* TODO: [⚖] Expose the library to be able to connect to same library via createCollectionFromUrl
|
|
14
14
|
* TODO: Handle progress - support streaming
|
|
15
15
|
* TODO: [🤹♂️] Do not hang up immediately but wait until client closes OR timeout
|
|
16
16
|
* TODO: [🤹♂️] Timeout on chat to free up resources
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import type { ExecutionType } from './ExecutionTypes';
|
|
2
|
+
import type { ModelRequirements } from './ModelRequirements';
|
|
3
|
+
import type { ExpectationAmount } from './PipelineJson/PromptTemplateJson';
|
|
4
|
+
import type { ExpectationUnit } from './PipelineJson/PromptTemplateJson';
|
|
1
5
|
import type { string_markdown_text } from './typeAliases';
|
|
2
6
|
import type { string_name } from './typeAliases';
|
|
3
7
|
import type { string_version } from './typeAliases';
|
|
4
|
-
import type { ExecutionType } from './ExecutionTypes';
|
|
5
|
-
import type { ModelRequirements } from './ModelRequirements';
|
|
6
|
-
import type { ExpectationAmount } from './PromptbookJson/PromptTemplateJson';
|
|
7
|
-
import type { ExpectationUnit } from './PromptbookJson/PromptTemplateJson';
|
|
8
8
|
/**
|
|
9
9
|
* Command is one piece of the prompt template which adds some logic to the prompt template or the whole pipeline.
|
|
10
10
|
* It is parsed from the markdown from ul/ol items - one command per one item.
|
package/umd/typings/src/types/{PromptbookJson/PromptbookJson.d.ts → PipelineJson/PipelineJson.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { string_markdown_text } from '../typeAliases';
|
|
2
|
-
import type {
|
|
2
|
+
import type { string_pipeline_url } from '../typeAliases';
|
|
3
3
|
import type { string_version } from '../typeAliases';
|
|
4
4
|
import type { KnowledgeJson } from './KnowledgeJson';
|
|
5
5
|
import type { PromptTemplateJson } from './PromptTemplateJson';
|
|
@@ -8,19 +8,19 @@ import type { PromptTemplateParameterJson } from './PromptTemplateParameterJson'
|
|
|
8
8
|
* Promptbook is the **core concept of this library**.
|
|
9
9
|
* It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
|
|
10
10
|
*
|
|
11
|
-
* @see https://github.com/webgptorg/promptbook#promptbook
|
|
11
|
+
* @see !!! https://github.com/webgptorg/promptbook#promptbook
|
|
12
12
|
*/
|
|
13
|
-
export type
|
|
13
|
+
export type PipelineJson = {
|
|
14
14
|
/**
|
|
15
15
|
* Unique identifier of the promptbook
|
|
16
16
|
*
|
|
17
17
|
* Note: It must be unique across all promptbooks libraries
|
|
18
18
|
* Note: It must use HTTPs URL
|
|
19
19
|
* Tip: You can do versioning in the URL
|
|
20
|
-
* For example: https://promptbook.webgpt
|
|
20
|
+
* For example: https://promptbook.studio/webgpt/write-website-content-cs.ptbk.md@1.0.0
|
|
21
21
|
* Warning: Do not hash part of the URL, hash part is used for identification of the prompt template in the pipeline
|
|
22
22
|
*/
|
|
23
|
-
readonly promptbookUrl?:
|
|
23
|
+
readonly promptbookUrl?: string_pipeline_url;
|
|
24
24
|
/**
|
|
25
25
|
* Title of the promptbook
|
|
26
26
|
* -It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
package/{esm/typings/src/types/PromptbookString.d.ts → umd/typings/src/types/PipelineString.d.ts}
RENAMED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Promptbook is the **core concept of this library**.
|
|
3
3
|
* It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
|
|
4
4
|
*
|
|
5
|
-
* @see https://github.com/webgptorg/promptbook#promptbook
|
|
5
|
+
* @see !!! https://github.com/webgptorg/promptbook#promptbook
|
|
6
6
|
*/
|
|
7
|
-
export type
|
|
7
|
+
export type PipelineString = string & {
|
|
8
8
|
readonly _type: 'Promptbook';
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
|
-
* TODO: !! Better validation (
|
|
11
|
+
* TODO: !! Better validation (validatePipelineString) or remove branded type and make it just string
|
|
12
12
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { PostprocessingFunction } from '../scripting/javascript/JavascriptExecutionToolsOptions';
|
|
2
2
|
import type { ExpectFormatCommand } from './Command';
|
|
3
3
|
import type { ModelRequirements } from './ModelRequirements';
|
|
4
|
-
import type { Expectations } from './
|
|
4
|
+
import type { Expectations } from './PipelineJson/PromptTemplateJson';
|
|
5
5
|
import type { string_name } from './typeAliases';
|
|
6
|
+
import type { string_pipeline_url_with_hashtemplate } from './typeAliases';
|
|
6
7
|
import type { string_prompt } from './typeAliases';
|
|
7
|
-
import type { string_promptbook_url_with_hashtemplate } from './typeAliases';
|
|
8
8
|
import type { string_title } from './typeAliases';
|
|
9
9
|
/**
|
|
10
10
|
* Prompt in a text along with model requirements, but without any execution or templating logic.
|
|
@@ -50,9 +50,9 @@ export type Prompt = {
|
|
|
50
50
|
/**
|
|
51
51
|
* Unique identifier of the promptbook with specific template name as hash
|
|
52
52
|
*
|
|
53
|
-
* @example https://promptbook.webgpt
|
|
53
|
+
* @example https://promptbook.studio/webgpt/write-website-content-cs.ptbk.md#keywords
|
|
54
54
|
*/
|
|
55
|
-
readonly promptbookUrl:
|
|
55
|
+
readonly promptbookUrl: string_pipeline_url_with_hashtemplate;
|
|
56
56
|
/**
|
|
57
57
|
* Parameters used in the prompt
|
|
58
58
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PromptResult } from '../../execution/PromptResult';
|
|
2
2
|
import type { Prompt } from '../Prompt';
|
|
3
3
|
import type { string_markdown_text } from '../typeAliases';
|
|
4
|
-
import type {
|
|
4
|
+
import type { string_pipeline_url } from '../typeAliases';
|
|
5
5
|
import type { string_version } from '../typeAliases';
|
|
6
6
|
/**
|
|
7
7
|
* ExecutionReport is result of executing one promptbook
|
|
@@ -17,7 +17,7 @@ export type ExecutionReportJson = {
|
|
|
17
17
|
/**
|
|
18
18
|
* Unique identifier of the promptbook from promptbook which was executed
|
|
19
19
|
*/
|
|
20
|
-
readonly promptbookUrl?:
|
|
20
|
+
readonly promptbookUrl?: string_pipeline_url;
|
|
21
21
|
/**
|
|
22
22
|
* Title of from promptbook which was executed
|
|
23
23
|
*/
|
|
@@ -179,15 +179,15 @@ export type string_url = string;
|
|
|
179
179
|
/**
|
|
180
180
|
* Semantic helper
|
|
181
181
|
*
|
|
182
|
-
* For example `"https://promptbook.webgpt
|
|
182
|
+
* For example `"https://promptbook.studio/webgpt/write-website-content-cs.ptbk.md"`
|
|
183
183
|
*/
|
|
184
|
-
export type
|
|
184
|
+
export type string_pipeline_url = string;
|
|
185
185
|
/**
|
|
186
186
|
* Semantic helper
|
|
187
187
|
*
|
|
188
|
-
* For example `"https://promptbook.webgpt
|
|
188
|
+
* For example `"https://promptbook.studio/webgpt/write-website-content-cs.ptbk.md#keywords"`
|
|
189
189
|
*/
|
|
190
|
-
export type
|
|
190
|
+
export type string_pipeline_url_with_hashtemplate = string;
|
|
191
191
|
/**
|
|
192
192
|
* Semantic helper
|
|
193
193
|
*
|
|
@@ -5,7 +5,7 @@ import type { string_char_emoji } from '../types/typeAliasEmoji';
|
|
|
5
5
|
*
|
|
6
6
|
* @see https://getemoji.com/
|
|
7
7
|
*
|
|
8
|
-
* @private within the
|
|
8
|
+
* @private within the package
|
|
9
9
|
* @deprecated Use /\p{Extended_Pictographic}/ instead
|
|
10
10
|
*/
|
|
11
11
|
export declare const EMOJIS_IN_CATEGORIES: Record<string, Array<string_char_emoji>>;
|
|
@@ -13,7 +13,7 @@ export declare const EMOJIS_IN_CATEGORIES: Record<string, Array<string_char_emoj
|
|
|
13
13
|
*
|
|
14
14
|
* All possible emoji chars like "🍆", "🍡", "🍤"...
|
|
15
15
|
*
|
|
16
|
-
* @private within the
|
|
16
|
+
* @private within the package
|
|
17
17
|
* @deprecated Use /\p{Extended_Pictographic}/ instead
|
|
18
18
|
*/
|
|
19
19
|
export declare const EMOJIS: Set<string_char_emoji>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ExpectationAmount } from '../../types/
|
|
2
|
-
import type { ExpectationUnit } from '../../types/
|
|
1
|
+
import type { ExpectationAmount } from '../../types/PipelineJson/PromptTemplateJson';
|
|
2
|
+
import type { ExpectationUnit } from '../../types/PipelineJson/PromptTemplateJson';
|
|
3
3
|
/**
|
|
4
4
|
* Index of all counter functions
|
|
5
5
|
*/
|
|
@@ -3,7 +3,7 @@ import type { string_name } from '../../types/typeAliases';
|
|
|
3
3
|
/**
|
|
4
4
|
* Add or modify an auto-generated section in a markdown file
|
|
5
5
|
*
|
|
6
|
-
* @private within the
|
|
6
|
+
* @private within the package
|
|
7
7
|
*/
|
|
8
8
|
export declare function addAutoGeneratedSection(content: string_markdown, options: {
|
|
9
9
|
sectionName: string_name;
|
|
@@ -31,7 +31,7 @@ type CreateMarkdownChartOptions = {
|
|
|
31
31
|
/**
|
|
32
32
|
* Function createMarkdownChart will draw a chart in markdown from ⬛+🟦 tiles
|
|
33
33
|
*
|
|
34
|
-
* @private within the
|
|
34
|
+
* @private within the package
|
|
35
35
|
*/
|
|
36
36
|
export declare function createMarkdownChart(options: CreateMarkdownChartOptions): string_markdown;
|
|
37
37
|
export {};
|
|
@@ -3,6 +3,6 @@ import type { string_markdown_text } from '../../types/typeAliases';
|
|
|
3
3
|
/**
|
|
4
4
|
* Create a markdown table from a 2D array of strings
|
|
5
5
|
*
|
|
6
|
-
* @private within the
|
|
6
|
+
* @private within the package
|
|
7
7
|
*/
|
|
8
8
|
export declare function createMarkdownTable(table: Array<Array<string_markdown_text>>): string_markdown;
|
|
@@ -2,6 +2,6 @@ import type { MarkdownStructure } from './MarkdownStructure';
|
|
|
2
2
|
/**
|
|
3
3
|
* Computes the deepness of the markdown structure.
|
|
4
4
|
*
|
|
5
|
-
* @private within the
|
|
5
|
+
* @private within the package
|
|
6
6
|
*/
|
|
7
7
|
export declare function countMarkdownStructureDeepness(markdownStructure: MarkdownStructure): number;
|
|
@@ -8,6 +8,6 @@ import type { MarkdownStructure } from './MarkdownStructure';
|
|
|
8
8
|
* @param markdown The markdown string to parse.
|
|
9
9
|
* @returns The MarkdownStructure object.
|
|
10
10
|
*
|
|
11
|
-
* @private within the
|
|
11
|
+
* @private within the package
|
|
12
12
|
*/
|
|
13
13
|
export declare function markdownToMarkdownStructure(markdown: string): MarkdownStructure;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
|
|
2
|
-
import type { PromptbookString } from '../types/PromptbookString';
|
|
3
|
-
/**
|
|
4
|
-
* Converts promptbook in JSON format to string format
|
|
5
|
-
*
|
|
6
|
-
* @param promptbookJson Promptbook in JSON format (.ptbk.json)
|
|
7
|
-
* @returns Promptbook in string format (.ptbk.md)
|
|
8
|
-
*/
|
|
9
|
-
export declare function promptbookJsonToString(promptbookJson: PromptbookJson): PromptbookString;
|
|
10
|
-
/**
|
|
11
|
-
* TODO: Escape all
|
|
12
|
-
*/
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { LlmExecutionTools } from '../execution/LlmExecutionTools';
|
|
2
|
-
import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
|
|
3
|
-
import type { PromptbookString } from '../types/PromptbookString';
|
|
4
|
-
/**
|
|
5
|
-
* Options for promptbookStringToJson
|
|
6
|
-
*/
|
|
7
|
-
type PromptbookStringToJsonOptions = {
|
|
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
|
-
* - `promptbookStringToJson` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
|
|
18
|
-
* - `promptbookStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
|
|
19
|
-
*
|
|
20
|
-
* @param promptbookString {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 {PromptbookSyntaxError} 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 promptbookStringToJson(promptbookString: PromptbookString, options?: PromptbookStringToJsonOptions): Promise<PromptbookJson>;
|
|
29
|
-
export {};
|
|
30
|
-
/**
|
|
31
|
-
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
32
|
-
*/
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
|
|
2
|
-
import type { PromptbookString } from '../types/PromptbookString';
|
|
3
|
-
/**
|
|
4
|
-
* Compile promptbook from string (markdown) format to JSON format synchronously
|
|
5
|
-
*
|
|
6
|
-
* Note: There are two similar functions:
|
|
7
|
-
* - `promptbookStringToJson` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
|
|
8
|
-
* - `promptbookStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
|
|
9
|
-
*
|
|
10
|
-
* @param promptbookString {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 {PromptbookSyntaxError} 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 promptbookStringToJsonSync(promptbookString: PromptbookString): PromptbookJson;
|
|
19
|
-
/**
|
|
20
|
-
* TODO: Report here line/column of error
|
|
21
|
-
* TODO: Use spaceTrim more effectively
|
|
22
|
-
* TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
|
|
23
|
-
*/
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
|
|
2
|
-
import type { PromptbookString } from '../../types/PromptbookString';
|
|
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 importPromptbook(path: `${string}.ptbk.md`): PromptbookString;
|
|
13
|
-
export declare function importPromptbook(path: `${string}.ptbk.json`): PromptbookJson;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
|
|
2
|
-
/**
|
|
3
|
-
* Validates PromptbookJson 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 promptbook valid or invalid PromptbookJson
|
|
13
|
-
* @returns the same promptbook if it is logically valid
|
|
14
|
-
* @throws {PromptbookLogicError} on logical error in the promptbook
|
|
15
|
-
*/
|
|
16
|
-
export declare function validatePromptbook(promptbook: PromptbookJson): PromptbookJson;
|
|
17
|
-
/**
|
|
18
|
-
* TODO: [🧠] Work with promptbookVersion
|
|
19
|
-
* TODO: Use here some json-schema, Zod or something similar and change it to:
|
|
20
|
-
* > /**
|
|
21
|
-
* > * Validates PromptbookJson if it is logically valid.
|
|
22
|
-
* > *
|
|
23
|
-
* > * It checks:
|
|
24
|
-
* > * - it has a valid structure
|
|
25
|
-
* > * - ...
|
|
26
|
-
* > ex port function validatePromptbook(promptbook: unknown): asserts promptbook is PromptbookJson {
|
|
27
|
-
*/
|