@promptbook/node 0.103.0-1 → 0.103.0-100
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 +186 -116
- package/esm/index.es.js +351 -228
- package/esm/index.es.js.map +1 -1
- package/esm/typings/books/index.d.ts +0 -81
- package/esm/typings/servers.d.ts +9 -7
- package/esm/typings/src/_packages/browser.index.d.ts +6 -0
- package/esm/typings/src/_packages/cli.index.d.ts +4 -0
- package/esm/typings/src/_packages/components.index.d.ts +20 -8
- package/esm/typings/src/_packages/core.index.d.ts +58 -18
- package/esm/typings/src/_packages/node.index.d.ts +2 -2
- package/esm/typings/src/_packages/remote-server.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +58 -8
- package/esm/typings/src/_packages/utils.index.d.ts +6 -0
- package/esm/typings/src/_packages/wizard.index.d.ts +4 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +19 -5
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +17 -1
- package/esm/typings/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +3 -2
- package/esm/typings/src/book-2.0/agent-source/computeAgentHash.d.ts +8 -0
- package/esm/typings/src/book-2.0/agent-source/createCommitmentRegex.d.ts +3 -3
- package/esm/typings/src/book-2.0/agent-source/createDefaultAgentName.d.ts +8 -0
- package/esm/typings/src/book-2.0/agent-source/normalizeAgentName.d.ts +9 -0
- package/esm/typings/src/book-2.0/agent-source/padBook.d.ts +18 -0
- package/esm/typings/src/book-2.0/agent-source/parseAgentSourceWithCommitments.d.ts +1 -1
- package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +3 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +10 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfileTooltip.d.ts +15 -0
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +83 -8
- package/esm/typings/src/book-components/BookEditor/BookEditorActionbar.d.ts +14 -0
- package/esm/typings/src/book-components/BookEditor/BookEditorMonaco.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.d.ts +14 -0
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChatProps.d.ts +13 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +10 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +15 -0
- package/esm/typings/src/book-components/Chat/MockedChat/MockedChat.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +4 -0
- package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +5 -0
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgent.d.ts +29 -0
- package/esm/typings/src/book-components/Qr/BrandedQrCode.d.ts +18 -0
- package/esm/typings/src/book-components/Qr/GenericQrCode.d.ts +10 -0
- package/esm/typings/src/book-components/Qr/PromptbookQrCode.d.ts +18 -0
- package/esm/typings/src/book-components/Qr/useQrCode.d.ts +15 -0
- package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +15 -0
- package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +12 -0
- package/esm/typings/src/book-components/_common/Modal/Modal.d.ts +13 -0
- package/esm/typings/src/book-components/_common/Tooltip/Tooltip.d.ts +47 -0
- package/esm/typings/src/book-components/_common/react-utils/classNames.d.ts +1 -1
- package/esm/typings/src/book-components/icons/AboutIcon.d.ts +9 -0
- package/esm/typings/src/book-components/icons/CloseIcon.d.ts +4 -8
- package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +9 -0
- package/esm/typings/src/book-components/icons/ExitFullscreenIcon.d.ts +7 -0
- package/esm/typings/src/book-components/icons/FullscreenIcon.d.ts +7 -0
- package/esm/typings/src/book-components/icons/MenuIcon.d.ts +12 -0
- package/esm/typings/src/book-components/icons/MicIcon.d.ts +8 -0
- package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/about.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/hello.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/list-models.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/login.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/make.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/run.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/{start-server.d.ts → start-agents-server.d.ts} +3 -2
- package/esm/typings/src/cli/cli-commands/start-pipelines-server.d.ts +15 -0
- package/esm/typings/src/cli/cli-commands/test-command.d.ts +2 -1
- package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +2 -1
- package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +12 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +75 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabaseOptions.d.ts +10 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +154 -0
- package/esm/typings/src/collection/{PipelineCollection.d.ts → pipeline-collection/PipelineCollection.d.ts} +7 -3
- package/esm/typings/src/collection/{SimplePipelineCollection.d.ts → pipeline-collection/SimplePipelineCollection.d.ts} +5 -5
- package/esm/typings/src/collection/{constructors/createCollectionFromDirectory.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts} +8 -11
- package/esm/typings/src/collection/pipeline-collection/constructors/createPipelineCollectionFromJson.d.ts +13 -0
- package/esm/typings/src/collection/{constructors/createCollectionFromPromise.d.ts → pipeline-collection/constructors/createPipelineCollectionFromPromise.d.ts} +6 -5
- package/esm/typings/src/collection/pipeline-collection/constructors/createPipelineCollectionFromPromise.test.d.ts +1 -0
- package/esm/typings/src/collection/{constructors/createCollectionFromUrl.d.ts → pipeline-collection/constructors/createPipelineCollectionFromUrl.d.ts} +3 -3
- package/esm/typings/src/collection/{constructors/createSubcollection.d.ts → pipeline-collection/constructors/createPipelineSubcollection.d.ts} +3 -3
- package/esm/typings/src/collection/pipeline-collection/pipelineCollectionToJson.d.ts +13 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +4 -5
- package/esm/typings/src/{book-2.0/commitments → commitments}/ACTION/ACTION.d.ts +5 -1
- package/esm/typings/src/commitments/CLOSED/CLOSED.d.ts +35 -0
- package/esm/typings/src/commitments/COMPONENT/COMPONENT.d.ts +28 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/DELETE/DELETE.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/FORMAT/FORMAT.d.ts +5 -1
- package/esm/typings/src/commitments/FROM/FROM.d.ts +34 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/GOAL/GOAL.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/KNOWLEDGE/KNOWLEDGE.d.ts +5 -5
- package/esm/typings/src/commitments/LANGUAGE/LANGUAGE.d.ts +35 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/MEMORY/MEMORY.d.ts +5 -1
- package/esm/typings/src/commitments/MESSAGE/AgentMessageCommitmentDefinition.d.ts +32 -0
- package/esm/typings/src/commitments/MESSAGE/InitialMessageCommitmentDefinition.d.ts +32 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/MESSAGE/MESSAGE.d.ts +5 -1
- package/esm/typings/src/commitments/MESSAGE/UserMessageCommitmentDefinition.d.ts +32 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/META/META.d.ts +5 -1
- package/esm/typings/src/commitments/META_COLOR/META_COLOR.d.ts +48 -0
- package/esm/typings/src/commitments/META_FONT/META_FONT.d.ts +42 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/META_IMAGE/META_IMAGE.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/META_LINK/META_LINK.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/MODEL/MODEL.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/NOTE/NOTE.d.ts +5 -1
- package/esm/typings/src/commitments/OPEN/OPEN.d.ts +35 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/PERSONA/PERSONA.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/RULE/RULE.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/SAMPLE/SAMPLE.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/SCENARIO/SCENARIO.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/STYLE/STYLE.d.ts +5 -1
- package/esm/typings/src/commitments/USE/USE.d.ts +53 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +38 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.test.d.ts +1 -0
- package/esm/typings/src/commitments/USE_MCP/USE_MCP.d.ts +37 -0
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +38 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BaseCommitmentDefinition.d.ts +8 -2
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/CommitmentDefinition.d.ts +6 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/NotYetImplementedCommitmentDefinition.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/createEmptyAgentModelRequirements.d.ts +1 -1
- package/esm/typings/src/commitments/index.d.ts +93 -0
- package/esm/typings/src/config.d.ts +24 -3
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +2 -0
- package/esm/typings/src/errors/0-index.d.ts +6 -0
- package/esm/typings/src/errors/DatabaseError.d.ts +12 -0
- package/esm/typings/src/errors/NotAllowed.d.ts +9 -0
- package/esm/typings/src/errors/WrappedError.d.ts +2 -2
- package/esm/typings/src/execution/AvailableModel.d.ts +1 -0
- package/esm/typings/src/execution/Executables.d.ts +3 -0
- package/esm/typings/src/execution/ExecutionTask.d.ts +12 -3
- package/esm/typings/src/execution/ExecutionTools.d.ts +5 -0
- package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +21 -1
- package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +5 -0
- package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +5 -0
- package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +5 -0
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +5 -0
- package/esm/typings/src/execution/utils/usage-constants.d.ts +4 -124
- package/esm/typings/src/execution/utils/validatePromptResult.d.ts +2 -0
- package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +2 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +2 -2
- package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +2 -1
- package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/assertUniqueModels.d.ts +12 -0
- package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +70 -0
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +26 -4
- package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +19 -0
- package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +17 -0
- package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +50 -0
- package/esm/typings/src/llm-providers/agent/RemoteAgentOptions.d.ts +11 -0
- package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -19
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +60 -2
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +7 -1
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.test.d.ts +4 -0
- package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +1 -1
- package/esm/typings/src/pipeline/validatePipelineString.d.ts +2 -0
- package/esm/typings/src/playground/permanent/_boilerplate.d.ts +5 -0
- package/esm/typings/src/playground/permanent/agent-with-browser-playground.d.ts +5 -0
- package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +1 -0
- package/esm/typings/src/remote-server/startAgentServer.d.ts +26 -0
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +4 -1
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +3 -8
- package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -9
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
- package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +2 -1
- package/esm/typings/src/transpilers/_common/BookTranspiler.d.ts +33 -0
- package/esm/typings/src/transpilers/_common/BookTranspilerOptions.d.ts +18 -0
- package/esm/typings/src/transpilers/_common/register/$bookTranspilersRegister.d.ts +15 -0
- package/esm/typings/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.d.ts +16 -0
- package/esm/typings/src/transpilers/formatted-book-in-markdown/register.d.ts +15 -0
- package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.d.ts +16 -0
- package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.test.d.ts +1 -0
- package/esm/typings/src/transpilers/openai-sdk/playground/playground.d.ts +5 -0
- package/esm/typings/src/transpilers/openai-sdk/register.d.ts +15 -0
- package/esm/typings/src/types/LlmCall.d.ts +20 -0
- package/esm/typings/src/types/Updatable.d.ts +19 -0
- package/esm/typings/src/types/typeAliases.d.ts +32 -2
- package/esm/typings/src/utils/color/$randomColor.d.ts +1 -0
- package/esm/typings/src/utils/color/Color.d.ts +15 -0
- package/esm/typings/src/utils/color/Color.test.d.ts +1 -0
- package/esm/typings/src/utils/color/css-colors.d.ts +1 -0
- package/esm/typings/src/utils/color/internal-utils/checkChannelValue.d.ts +0 -3
- package/esm/typings/src/utils/color/operators/darken.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/grayscale.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/lighten.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/saturate.d.ts +1 -1
- package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +16 -0
- package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +2 -2
- package/esm/typings/src/utils/execCommand/$execCommand.d.ts +2 -1
- package/esm/typings/src/utils/execCommand/$execCommands.d.ts +2 -1
- package/esm/typings/src/utils/files/$induceBookDownload.d.ts +13 -0
- package/esm/typings/src/utils/files/$induceFileDownload.d.ts +13 -0
- package/esm/typings/src/utils/files/ObjectUrl.d.ts +46 -0
- package/esm/typings/src/utils/files/listAllFiles.d.ts +2 -3
- package/esm/typings/src/utils/misc/aboutPromptbookInformation.d.ts +27 -0
- package/esm/typings/src/utils/misc/computeHash.d.ts +11 -0
- package/esm/typings/src/utils/misc/computeHash.test.d.ts +1 -0
- package/esm/typings/src/utils/misc/injectCssModuleIntoShadowRoot.d.ts +1 -0
- package/esm/typings/src/utils/misc/xAboutPromptbookInformation.d.ts +13 -0
- package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +2 -0
- package/esm/typings/src/utils/normalization/normalizeMessageText.d.ts +9 -0
- package/esm/typings/src/utils/normalization/normalizeMessageText.test.d.ts +1 -0
- package/esm/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +3 -0
- package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +2 -0
- package/esm/typings/src/utils/normalization/titleToName.d.ts +2 -0
- package/esm/typings/src/utils/organization/$sideEffect.d.ts +2 -2
- package/esm/typings/src/utils/organization/$side_effect.d.ts +7 -0
- package/esm/typings/src/utils/organization/TODO_USE.d.ts +2 -2
- package/esm/typings/src/utils/organization/keepUnused.d.ts +2 -2
- package/esm/typings/src/utils/organization/preserve.d.ts +3 -3
- package/esm/typings/src/utils/organization/really_any.d.ts +7 -0
- package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +25 -0
- package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +9 -0
- package/esm/typings/src/utils/random/$randomFullnameWithColor.d.ts +13 -0
- package/esm/typings/src/utils/random/$randomItem.d.ts +9 -0
- package/esm/typings/src/utils/random/$randomSeed.d.ts +3 -0
- package/esm/typings/src/utils/random/$randomToken.d.ts +2 -0
- package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +2 -1
- package/esm/typings/src/utils/serialization/asSerializable.d.ts +2 -2
- package/esm/typings/src/utils/serialization/serializeToPromptbookJavascript.d.ts +2 -2
- package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +2 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/esm/typings/src/wizard/$getCompiledBook.d.ts +1 -2
- package/package.json +7 -7
- package/umd/index.umd.js +359 -236
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-2.0/commitments/index.d.ts +0 -60
- package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +0 -5
- package/esm/typings/src/book-components/BookEditor/config.d.ts +0 -10
- package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +0 -21
- package/esm/typings/src/collection/collectionToJson.d.ts +0 -13
- package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +0 -13
- /package/esm/typings/src/{book-components/Chat/utils/renderMarkdown.test.d.ts → book-2.0/agent-source/computeAgentHash.test.d.ts} +0 -0
- /package/esm/typings/src/{collection/constructors/createCollectionFromDirectory.test.d.ts → book-2.0/agent-source/normalizeAgentName.test.d.ts} +0 -0
- /package/esm/typings/src/{collection/constructors/createCollectionFromJson.test.d.ts → book-components/Chat/AgentChat/AgentChat.test.d.ts} +0 -0
- /package/esm/typings/src/collection/{constructors/createCollectionFromPromise.test.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.test.d.ts} +0 -0
- /package/esm/typings/src/{commands/_common/parseCommand.test.d.ts → collection/pipeline-collection/constructors/createPipelineCollectionFromJson.test.d.ts} +0 -0
- /package/esm/typings/src/collection/{collectionToJson.test.d.ts → pipeline-collection/pipelineCollectionToJson.test.d.ts} +0 -0
- /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BookCommitment.d.ts +0 -0
- /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/ParsedCommitment.d.ts +0 -0
package/umd/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('colors'), require('fs/promises'), require('path'), require('spacetrim'), require('jszip'), require('crypto'), require('rxjs'), require('waitasecond'), require('papaparse'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('crypto-js'), require('mime-types'), require('child_process'), require('dotenv')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'colors', 'fs/promises', 'path', 'spacetrim', 'jszip', 'crypto', 'rxjs', 'waitasecond', 'papaparse', 'crypto-js/enc-hex', 'crypto-js/sha256', 'crypto-js', 'mime-types', 'child_process', 'dotenv'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-node"] = {}, global.colors, global.promises, global.path, global.spaceTrim, global.JSZip, global.crypto, global.rxjs, global.waitasecond, global.papaparse, global.hexEncoder, global.sha256, global.cryptoJs, global.mimeTypes, global.child_process, global.dotenv));
|
|
5
|
-
})(this, (function (exports, colors, promises, path, spaceTrim, JSZip, crypto, rxjs, waitasecond, papaparse, hexEncoder, sha256, cryptoJs, mimeTypes, child_process, dotenv) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-node"] = {}, global.colors, global.promises, global.path, global.spaceTrim$1, global.JSZip, global.crypto, global.rxjs, global.waitasecond, global.papaparse, global.hexEncoder, global.sha256, global.cryptoJs, global.mimeTypes, global.child_process, global.dotenv));
|
|
5
|
+
})(this, (function (exports, colors, promises, path, spaceTrim$1, JSZip, crypto, rxjs, waitasecond, papaparse, hexEncoder, sha256, cryptoJs, mimeTypes, child_process, dotenv) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
|
|
28
|
-
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
|
|
28
|
+
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
|
|
29
29
|
var JSZip__default = /*#__PURE__*/_interopDefaultLegacy(JSZip);
|
|
30
30
|
var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
|
|
31
31
|
var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
|
|
@@ -38,19 +38,30 @@
|
|
|
38
38
|
* @generated
|
|
39
39
|
* @see https://github.com/webgptorg/book
|
|
40
40
|
*/
|
|
41
|
-
const BOOK_LANGUAGE_VERSION = '
|
|
41
|
+
const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
42
42
|
/**
|
|
43
43
|
* The version of the Promptbook engine
|
|
44
44
|
*
|
|
45
45
|
* @generated
|
|
46
46
|
* @see https://github.com/webgptorg/promptbook
|
|
47
47
|
*/
|
|
48
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
48
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-100';
|
|
49
49
|
/**
|
|
50
50
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
51
51
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
52
52
|
*/
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Trims string from all 4 sides
|
|
56
|
+
*
|
|
57
|
+
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
58
|
+
* Developed by same author @hejny as this package
|
|
59
|
+
*
|
|
60
|
+
* @public exported from `@promptbook/utils`
|
|
61
|
+
* @see https://github.com/hejny/spacetrim#usage
|
|
62
|
+
*/
|
|
63
|
+
const spaceTrim = spaceTrim$1.spaceTrim;
|
|
64
|
+
|
|
54
65
|
/**
|
|
55
66
|
* @private util of `@promptbook/color`
|
|
56
67
|
* @de
|
|
@@ -99,6 +110,7 @@
|
|
|
99
110
|
* @public exported from `@promptbook/color`
|
|
100
111
|
*/
|
|
101
112
|
const CSS_COLORS = {
|
|
113
|
+
promptbook: '#79EAFD',
|
|
102
114
|
transparent: 'rgba(0,0,0,0)',
|
|
103
115
|
aliceblue: '#f0f8ff',
|
|
104
116
|
antiquewhite: '#faebd7',
|
|
@@ -280,9 +292,6 @@
|
|
|
280
292
|
throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
|
|
281
293
|
}
|
|
282
294
|
}
|
|
283
|
-
/**
|
|
284
|
-
* TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
|
|
285
|
-
*/
|
|
286
295
|
|
|
287
296
|
/**
|
|
288
297
|
* Color object represents an RGB color with alpha channel
|
|
@@ -317,6 +326,28 @@
|
|
|
317
326
|
throw new Error(`Can not create color from given object`);
|
|
318
327
|
}
|
|
319
328
|
}
|
|
329
|
+
/**
|
|
330
|
+
* Creates a new Color instance from miscellaneous formats
|
|
331
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
332
|
+
*
|
|
333
|
+
* @param color
|
|
334
|
+
* @returns Color object
|
|
335
|
+
*/
|
|
336
|
+
static fromSafe(color) {
|
|
337
|
+
try {
|
|
338
|
+
return Color.from(color);
|
|
339
|
+
}
|
|
340
|
+
catch (error) {
|
|
341
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
342
|
+
console.warn(spaceTrim((block) => `
|
|
343
|
+
Color.fromSafe error:
|
|
344
|
+
${block(error.message)}
|
|
345
|
+
|
|
346
|
+
Returning default PROMPTBOOK_COLOR.
|
|
347
|
+
`));
|
|
348
|
+
return Color.fromString('promptbook');
|
|
349
|
+
}
|
|
350
|
+
}
|
|
320
351
|
/**
|
|
321
352
|
* Creates a new Color instance from miscellaneous string formats
|
|
322
353
|
*
|
|
@@ -384,6 +415,9 @@
|
|
|
384
415
|
if (hex.length === 3) {
|
|
385
416
|
return Color.fromHex3(hex);
|
|
386
417
|
}
|
|
418
|
+
if (hex.length === 4) {
|
|
419
|
+
return Color.fromHex4(hex);
|
|
420
|
+
}
|
|
387
421
|
if (hex.length === 6) {
|
|
388
422
|
return Color.fromHex6(hex);
|
|
389
423
|
}
|
|
@@ -404,6 +438,19 @@
|
|
|
404
438
|
const b = parseInt(hex.substr(2, 1), 16) * 16;
|
|
405
439
|
return take(new Color(r, g, b));
|
|
406
440
|
}
|
|
441
|
+
/**
|
|
442
|
+
* Creates a new Color instance from color in hex format with 4 digits (with alpha channel)
|
|
443
|
+
*
|
|
444
|
+
* @param color in hex for example `09df`
|
|
445
|
+
* @returns Color object
|
|
446
|
+
*/
|
|
447
|
+
static fromHex4(hex) {
|
|
448
|
+
const r = parseInt(hex.substr(0, 1), 16) * 16;
|
|
449
|
+
const g = parseInt(hex.substr(1, 1), 16) * 16;
|
|
450
|
+
const b = parseInt(hex.substr(2, 1), 16) * 16;
|
|
451
|
+
const a = parseInt(hex.substr(3, 1), 16) * 16;
|
|
452
|
+
return take(new Color(r, g, b, a));
|
|
453
|
+
}
|
|
407
454
|
/**
|
|
408
455
|
* Creates a new Color instance from color in hex format with 6 color digits (without alpha channel)
|
|
409
456
|
*
|
|
@@ -594,7 +641,8 @@
|
|
|
594
641
|
* @returns true if the value is a valid hex color string (e.g., `#009edd`, `#fff`, etc.)
|
|
595
642
|
*/
|
|
596
643
|
static isHexColorString(value) {
|
|
597
|
-
return typeof value === 'string' &&
|
|
644
|
+
return (typeof value === 'string' &&
|
|
645
|
+
/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value));
|
|
598
646
|
}
|
|
599
647
|
/**
|
|
600
648
|
* Creates new Color object
|
|
@@ -709,6 +757,23 @@
|
|
|
709
757
|
* TODO: Maybe connect with textures
|
|
710
758
|
*/
|
|
711
759
|
|
|
760
|
+
/**
|
|
761
|
+
* Makes color transformer which returns a grayscale version of the color
|
|
762
|
+
*
|
|
763
|
+
* @param amount from 0 to 1
|
|
764
|
+
*
|
|
765
|
+
* @public exported from `@promptbook/color`
|
|
766
|
+
*/
|
|
767
|
+
function grayscale(amount) {
|
|
768
|
+
return ({ red, green, blue, alpha }) => {
|
|
769
|
+
const average = (red + green + blue) / 3;
|
|
770
|
+
red = Math.round(average * amount + red * (1 - amount));
|
|
771
|
+
green = Math.round(average * amount + green * (1 - amount));
|
|
772
|
+
blue = Math.round(average * amount + blue * (1 - amount));
|
|
773
|
+
return Color.fromValues(red, green, blue, alpha);
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
|
|
712
777
|
/**
|
|
713
778
|
* Converts HSL values to RGB values
|
|
714
779
|
*
|
|
@@ -824,102 +889,6 @@
|
|
|
824
889
|
* TODO: Maybe implement by mix+hsl
|
|
825
890
|
*/
|
|
826
891
|
|
|
827
|
-
/**
|
|
828
|
-
* Calculates distance between two colors
|
|
829
|
-
*
|
|
830
|
-
* @param color1 first color
|
|
831
|
-
* @param color2 second color
|
|
832
|
-
*
|
|
833
|
-
* Note: This function is inefficient. Use colorDistanceSquared instead if possible.
|
|
834
|
-
*
|
|
835
|
-
* @public exported from `@promptbook/color`
|
|
836
|
-
*/
|
|
837
|
-
/**
|
|
838
|
-
* Calculates distance between two colors without square root
|
|
839
|
-
*
|
|
840
|
-
* @param color1 first color
|
|
841
|
-
* @param color2 second color
|
|
842
|
-
*
|
|
843
|
-
* @public exported from `@promptbook/color`
|
|
844
|
-
*/
|
|
845
|
-
function colorDistanceSquared(color1, color2) {
|
|
846
|
-
const rmean = (color1.red + color2.red) / 2;
|
|
847
|
-
const r = color1.red - color2.red;
|
|
848
|
-
const g = color1.green - color2.green;
|
|
849
|
-
const b = color1.blue - color2.blue;
|
|
850
|
-
const weightR = 2 + rmean / 256;
|
|
851
|
-
const weightG = 4.0;
|
|
852
|
-
const weightB = 2 + (255 - rmean) / 256;
|
|
853
|
-
const distance = weightR * r * r + weightG * g * g + weightB * b * b;
|
|
854
|
-
return distance;
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
/**
|
|
858
|
-
* Makes color transformer which finds the nearest color from the given list
|
|
859
|
-
*
|
|
860
|
-
* @param colors array of colors to choose from
|
|
861
|
-
*
|
|
862
|
-
* @public exported from `@promptbook/color`
|
|
863
|
-
*/
|
|
864
|
-
function nearest(...colors) {
|
|
865
|
-
return (color) => {
|
|
866
|
-
const distances = colors.map((c) => colorDistanceSquared(c, color));
|
|
867
|
-
const minDistance = Math.min(...distances);
|
|
868
|
-
const minIndex = distances.indexOf(minDistance);
|
|
869
|
-
const nearestColor = colors[minIndex];
|
|
870
|
-
return nearestColor;
|
|
871
|
-
};
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
/**
|
|
875
|
-
* Color transformer which returns the negative color
|
|
876
|
-
*
|
|
877
|
-
* @public exported from `@promptbook/color`
|
|
878
|
-
*/
|
|
879
|
-
function negative(color) {
|
|
880
|
-
const r = 255 - color.red;
|
|
881
|
-
const g = 255 - color.green;
|
|
882
|
-
const b = 255 - color.blue;
|
|
883
|
-
return Color.fromValues(r, g, b, color.alpha);
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
/**
|
|
887
|
-
* Makes color transformer which finds the furthest color from the given list
|
|
888
|
-
*
|
|
889
|
-
* @param colors array of colors to choose from
|
|
890
|
-
*
|
|
891
|
-
* @public exported from `@promptbook/color`
|
|
892
|
-
*/
|
|
893
|
-
function furthest(...colors) {
|
|
894
|
-
return (color) => {
|
|
895
|
-
const furthestColor = negative(nearest(...colors.map(negative))(color));
|
|
896
|
-
return furthestColor;
|
|
897
|
-
};
|
|
898
|
-
}
|
|
899
|
-
/**
|
|
900
|
-
* Makes color transformer which finds the best text color (black or white) for the given background color
|
|
901
|
-
*
|
|
902
|
-
* @public exported from `@promptbook/color`
|
|
903
|
-
*/
|
|
904
|
-
furthest(Color.get('white'), Color.from('black'));
|
|
905
|
-
|
|
906
|
-
/**
|
|
907
|
-
* Makes color transformer which returns a grayscale version of the color
|
|
908
|
-
*
|
|
909
|
-
* @param amount from 0 to 1
|
|
910
|
-
*
|
|
911
|
-
* @public exported from `@promptbook/color`
|
|
912
|
-
*/
|
|
913
|
-
function grayscale(amount) {
|
|
914
|
-
return ({ red, green, blue, alpha }) => {
|
|
915
|
-
const average = (red + green + blue) / 3;
|
|
916
|
-
red = Math.round(average * amount + red * (1 - amount));
|
|
917
|
-
green = Math.round(average * amount + green * (1 - amount));
|
|
918
|
-
blue = Math.round(average * amount + blue * (1 - amount));
|
|
919
|
-
return Color.fromValues(red, green, blue, alpha);
|
|
920
|
-
};
|
|
921
|
-
}
|
|
922
|
-
|
|
923
892
|
/**
|
|
924
893
|
* Makes color transformer which saturate the given color
|
|
925
894
|
*
|
|
@@ -988,16 +957,32 @@
|
|
|
988
957
|
*
|
|
989
958
|
* @public exported from `@promptbook/core`
|
|
990
959
|
*/
|
|
991
|
-
const PROMPTBOOK_COLOR = Color.
|
|
992
|
-
// <- TODO: [🧠] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
960
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
961
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
962
|
+
/**
|
|
963
|
+
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
964
|
+
*
|
|
965
|
+
* TODO: [🗽] Unite branding and make single place for it
|
|
966
|
+
*
|
|
967
|
+
* @public exported from `@promptbook/core`
|
|
968
|
+
*/
|
|
969
|
+
({
|
|
970
|
+
TITLE: Color.fromHex('#244EA8'),
|
|
971
|
+
LINE: Color.fromHex('#eeeeee'),
|
|
972
|
+
SEPARATOR: Color.fromHex('#cccccc'),
|
|
973
|
+
COMMITMENT: Color.fromHex('#DA0F78'),
|
|
974
|
+
PARAMETER: Color.fromHex('#8e44ad'),
|
|
975
|
+
});
|
|
976
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
993
977
|
/**
|
|
994
|
-
*
|
|
978
|
+
* Chat color of the Promptbook (in chat)
|
|
995
979
|
*
|
|
996
980
|
* TODO: [🗽] Unite branding and make single place for it
|
|
997
981
|
*
|
|
998
982
|
* @public exported from `@promptbook/core`
|
|
999
983
|
*/
|
|
1000
984
|
PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
|
|
985
|
+
// <- TODO: [🧠][🈵] Using `Color` and `lighten`, `saturate`,... here increases the package size approx 3kb, maybe remove it
|
|
1001
986
|
/**
|
|
1002
987
|
* Color of the user (in chat)
|
|
1003
988
|
*
|
|
@@ -1006,6 +991,7 @@
|
|
|
1006
991
|
* @public exported from `@promptbook/core`
|
|
1007
992
|
*/
|
|
1008
993
|
Color.fromHex('#1D4ED8');
|
|
994
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
1009
995
|
/**
|
|
1010
996
|
* When the title is not provided, the default title is used
|
|
1011
997
|
*
|
|
@@ -1104,7 +1090,7 @@
|
|
|
1104
1090
|
* @public exported from `@promptbook/core`
|
|
1105
1091
|
*/
|
|
1106
1092
|
const DEFAULT_MAX_EXECUTION_ATTEMPTS = 7; // <- TODO: [🤹♂️]
|
|
1107
|
-
// <- TODO: [🕝] Make also `
|
|
1093
|
+
// <- TODO: [🕝] Make also `AGENTS_DIRNAME_ALTERNATIVES`
|
|
1108
1094
|
// TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
|
|
1109
1095
|
/**
|
|
1110
1096
|
* Where to store the temporary downloads
|
|
@@ -1132,7 +1118,7 @@
|
|
|
1132
1118
|
ex-port const WIZARD_APP_ID: string_app_id = 'wizard';
|
|
1133
1119
|
*/
|
|
1134
1120
|
/**
|
|
1135
|
-
* The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `
|
|
1121
|
+
* The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createPipelineCollectionFromDirectory`
|
|
1136
1122
|
*
|
|
1137
1123
|
* @public exported from `@promptbook/core`
|
|
1138
1124
|
*/
|
|
@@ -1239,7 +1225,7 @@
|
|
|
1239
1225
|
*/
|
|
1240
1226
|
class UnexpectedError extends Error {
|
|
1241
1227
|
constructor(message) {
|
|
1242
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1228
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1243
1229
|
${block(message)}
|
|
1244
1230
|
|
|
1245
1231
|
Note: This error should not happen.
|
|
@@ -1343,7 +1329,7 @@
|
|
|
1343
1329
|
constructor(whatWasThrown) {
|
|
1344
1330
|
const tag = `[🤮]`;
|
|
1345
1331
|
console.error(tag, whatWasThrown);
|
|
1346
|
-
super(spaceTrim.spaceTrim(`
|
|
1332
|
+
super(spaceTrim$1.spaceTrim(`
|
|
1347
1333
|
Non-Error object was thrown
|
|
1348
1334
|
|
|
1349
1335
|
Note: Look for ${tag} in the console for more details
|
|
@@ -1536,7 +1522,7 @@
|
|
|
1536
1522
|
TODO: [🧠] Is there a better implementation?
|
|
1537
1523
|
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1538
1524
|
> for (const propertyName of propertyNames) {
|
|
1539
|
-
> const value = (objectValue as
|
|
1525
|
+
> const value = (objectValue as chococake)[propertyName];
|
|
1540
1526
|
> if (value && typeof value === 'object') {
|
|
1541
1527
|
> deepClone(value);
|
|
1542
1528
|
> }
|
|
@@ -1787,6 +1773,8 @@
|
|
|
1787
1773
|
* - if it is valid json
|
|
1788
1774
|
* - if it is meaningful
|
|
1789
1775
|
*
|
|
1776
|
+
* Note: [🔂] This function is idempotent.
|
|
1777
|
+
*
|
|
1790
1778
|
* @param pipeline valid or invalid PipelineJson
|
|
1791
1779
|
* @returns the same pipeline if it is logically valid
|
|
1792
1780
|
* @throws {PipelineLogicError} on logical error in the pipeline
|
|
@@ -1804,7 +1792,7 @@
|
|
|
1804
1792
|
if (!(error instanceof PipelineLogicError)) {
|
|
1805
1793
|
throw error;
|
|
1806
1794
|
}
|
|
1807
|
-
console.error(spaceTrim.spaceTrim((block) => `
|
|
1795
|
+
console.error(spaceTrim$1.spaceTrim((block) => `
|
|
1808
1796
|
Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
|
|
1809
1797
|
|
|
1810
1798
|
${block(error.message)}
|
|
@@ -1831,7 +1819,7 @@
|
|
|
1831
1819
|
})();
|
|
1832
1820
|
if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
|
|
1833
1821
|
// <- Note: [🚲]
|
|
1834
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
1822
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
1835
1823
|
Invalid promptbook URL "${pipeline.pipelineUrl}"
|
|
1836
1824
|
|
|
1837
1825
|
${block(pipelineIdentification)}
|
|
@@ -1839,7 +1827,7 @@
|
|
|
1839
1827
|
}
|
|
1840
1828
|
if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
|
|
1841
1829
|
// <- Note: [🚲]
|
|
1842
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
1830
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
1843
1831
|
Invalid Promptbook Version "${pipeline.bookVersion}"
|
|
1844
1832
|
|
|
1845
1833
|
${block(pipelineIdentification)}
|
|
@@ -1848,7 +1836,7 @@
|
|
|
1848
1836
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
1849
1837
|
if (!Array.isArray(pipeline.parameters)) {
|
|
1850
1838
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
1851
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
1839
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
1852
1840
|
Pipeline is valid JSON but with wrong structure
|
|
1853
1841
|
|
|
1854
1842
|
\`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
|
|
@@ -1859,7 +1847,7 @@
|
|
|
1859
1847
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
1860
1848
|
if (!Array.isArray(pipeline.tasks)) {
|
|
1861
1849
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
1862
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
1850
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
1863
1851
|
Pipeline is valid JSON but with wrong structure
|
|
1864
1852
|
|
|
1865
1853
|
\`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
|
|
@@ -1885,7 +1873,7 @@
|
|
|
1885
1873
|
// Note: Check each parameter individually
|
|
1886
1874
|
for (const parameter of pipeline.parameters) {
|
|
1887
1875
|
if (parameter.isInput && parameter.isOutput) {
|
|
1888
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
1876
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
1889
1877
|
|
|
1890
1878
|
Parameter \`{${parameter.name}}\` can not be both input and output
|
|
1891
1879
|
|
|
@@ -1896,7 +1884,7 @@
|
|
|
1896
1884
|
if (!parameter.isInput &&
|
|
1897
1885
|
!parameter.isOutput &&
|
|
1898
1886
|
!pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
|
|
1899
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
1887
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
1900
1888
|
Parameter \`{${parameter.name}}\` is created but not used
|
|
1901
1889
|
|
|
1902
1890
|
You can declare {${parameter.name}} as output parameter by adding in the header:
|
|
@@ -1908,7 +1896,7 @@
|
|
|
1908
1896
|
}
|
|
1909
1897
|
// Note: Testing that parameter is either input or result of some task
|
|
1910
1898
|
if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
|
|
1911
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
1899
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
1912
1900
|
Parameter \`{${parameter.name}}\` is declared but not defined
|
|
1913
1901
|
|
|
1914
1902
|
You can do one of these:
|
|
@@ -1924,14 +1912,14 @@
|
|
|
1924
1912
|
// Note: Checking each task individually
|
|
1925
1913
|
for (const task of pipeline.tasks) {
|
|
1926
1914
|
if (definedParameters.has(task.resultingParameterName)) {
|
|
1927
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
1915
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
1928
1916
|
Parameter \`{${task.resultingParameterName}}\` is defined multiple times
|
|
1929
1917
|
|
|
1930
1918
|
${block(pipelineIdentification)}
|
|
1931
1919
|
`));
|
|
1932
1920
|
}
|
|
1933
1921
|
if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
|
|
1934
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
1922
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
1935
1923
|
Parameter name {${task.resultingParameterName}} is reserved, please use different name
|
|
1936
1924
|
|
|
1937
1925
|
${block(pipelineIdentification)}
|
|
@@ -1941,7 +1929,7 @@
|
|
|
1941
1929
|
if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
|
|
1942
1930
|
if (!task.format &&
|
|
1943
1931
|
!task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
1944
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
1932
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
1945
1933
|
Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
|
|
1946
1934
|
|
|
1947
1935
|
${block(pipelineIdentification)}
|
|
@@ -1949,7 +1937,7 @@
|
|
|
1949
1937
|
}
|
|
1950
1938
|
for (const joker of task.jokerParameterNames) {
|
|
1951
1939
|
if (!task.dependentParameterNames.includes(joker)) {
|
|
1952
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
1940
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
1953
1941
|
Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
|
|
1954
1942
|
|
|
1955
1943
|
${block(pipelineIdentification)}
|
|
@@ -1960,21 +1948,21 @@
|
|
|
1960
1948
|
if (task.expectations) {
|
|
1961
1949
|
for (const [unit, { min, max }] of Object.entries(task.expectations)) {
|
|
1962
1950
|
if (min !== undefined && max !== undefined && min > max) {
|
|
1963
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
1951
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
1964
1952
|
Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
|
|
1965
1953
|
|
|
1966
1954
|
${block(pipelineIdentification)}
|
|
1967
1955
|
`));
|
|
1968
1956
|
}
|
|
1969
1957
|
if (min !== undefined && min < 0) {
|
|
1970
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
1958
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
1971
1959
|
Min expectation of ${unit} must be zero or positive
|
|
1972
1960
|
|
|
1973
1961
|
${block(pipelineIdentification)}
|
|
1974
1962
|
`));
|
|
1975
1963
|
}
|
|
1976
1964
|
if (max !== undefined && max <= 0) {
|
|
1977
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
1965
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
1978
1966
|
Max expectation of ${unit} must be positive
|
|
1979
1967
|
|
|
1980
1968
|
${block(pipelineIdentification)}
|
|
@@ -1996,7 +1984,7 @@
|
|
|
1996
1984
|
while (unresovedTasks.length > 0) {
|
|
1997
1985
|
if (loopLimit-- < 0) {
|
|
1998
1986
|
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
1999
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
1987
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
2000
1988
|
Loop limit reached during detection of circular dependencies in \`validatePipeline\`
|
|
2001
1989
|
|
|
2002
1990
|
${block(pipelineIdentification)}
|
|
@@ -2006,7 +1994,7 @@
|
|
|
2006
1994
|
if (currentlyResovedTasks.length === 0) {
|
|
2007
1995
|
throw new PipelineLogicError(
|
|
2008
1996
|
// TODO: [🐎] DRY
|
|
2009
|
-
spaceTrim.spaceTrim((block) => `
|
|
1997
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
2010
1998
|
|
|
2011
1999
|
Can not resolve some parameters:
|
|
2012
2000
|
Either you are using a parameter that is not defined, or there are some circular dependencies.
|
|
@@ -2097,7 +2085,7 @@
|
|
|
2097
2085
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
2098
2086
|
*/
|
|
2099
2087
|
|
|
2100
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n```json\n{availableModels}\n```\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book"},{title:"📊 Curriculum Audit",pipelineUrl:"https://promptbook.studio/promptbook//examples/lsvp-asistent.book",formfactorName:"GENERIC",parameters:[{name:"result",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"prompt",title:"Prompt",content:"Asistent pro LŠVP\n\nPERSONA Jsi asistent pro RVP Lyceum v rámci Národního pedagogického institutu České Republiky\nMETA IMAGE https://edulk.cz/getFile/id:475818/type:large/02%20zna%C4%8Dka%20npi.jpg\nRULE Pokud jsi nejsi jistý, napiš nevím\nKNOWLEDGE ./241129_Lyceum_final.pdf\nCONTEXT Obecně dokážeš řešit libovolné ŠVP, aktuálně řešíš {Školní vzdělávací program LYCEUM}\nRULE Z {Porovnání RVP a ŠVP - postup} je nejdůležitější fáze 3\nKNOWLEDGE {Školní vzdělávací program LYCEUM} ./ŠVP Lyceum - Finance v digitální době.pdf\nKNOWLEDGE @Slovník\n\n**Interní slovník - RVP/ŠVP**\n\n**RVP**\n\nRámcový vzdělávací program pro obor vzdělání Lyceum je dokument na národní úrovni, který formuluje požadavky na školní vzdělávací programy ve formě především očekávaných výsledků učení, kterých mají žáci absolvováním tohoto programu na dané škole dosáhnout.\n\n**ŠVP**\n\nŠkolní vzdělávací program pro obor vzdělání Lyceum je dokument každé jednotlivé školy, který popisuje v jakých vyučovacích předmětech/ vzdělávacích modulech a v jakých ročnících budou požadované očekávané výsledky učení naplněny. Zároveň formuluje další očekávané výsledky učení, které naplňují disponibilní část vyučovacího času určeného RVP pro tento obor vzdělání.\n\n**Očekávaný výsledek učení (OVU)**\n\nVyjadřuje jednotlivý požadavek na to, co mají žáci umět na konci vzdělávacího programu, tzn. jejich požadované kompetence. Je vyjádřen formulací, která je uvozena činnostním slovesem a dále obsahuje předmět této činnosti. Formulace je konkretizována resp. doplněna zpravidla formou odrážek vymezením dílčích znalostí, dovedností, postojů, jejichž splnění je předpokladem dosažení OVU jako celku.\n\n_Příklad:_\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th><p><strong>Žák/žákyně řídí realizaci jednoduchého projektu</strong></p></th></tr><tr><td><ul><li>naplánuje aktivity projektu</li></ul></td></tr><tr><td><ul><li>navrhne rozpočet projektu vzhledem k navrženým aktivitám</li></ul></td></tr><tr><td><ul><li>stanoví základní ukazatele a sleduje jejich naplňování</li></ul></td></tr><tr><td><ul><li>vede projektový tým</li></ul></td></tr><tr><td><ul><li>uvede, jak by řešil krizové situace v projektu</li></ul></td></tr><tr><td><ul><li>vyhodnotí úspěšnost projektu</li></ul></td></tr></tbody></table></div>\n\n**Vzdělávací oblasti**\n\nOčekávané výsledky učení jsou v **_RVP členěny do 4 vzdělávacích oblastí_**, které tvoří společný všeobecně vzdělávací základ:\n\n- Osobnostní rozvoj, vzdělávání ke zdraví, bezpečí a produktivnímu pracovnímu životu (kariéře)\n- Komunikační a jazykové vzdělávání\n- Aplikované vzdělávání STEM (Science, Technology, Engeneering, Math), tj. přírodní vědy, informatika, technika, matematika\n- Prakticky orientované vzdělávání společenskovědní a humanitní\n\nKaždá vzdělávací oblast se dále člení na okruhy, v jejichž rámci jsou OVU samostatně číslované.\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th rowspan=\"21\"><ul><li>Prakticky orientované vzdělávání společenskovědní a humanitní</li></ul></th><th rowspan=\"21\"><p><strong>Člověk, ekonomie a podnikání</strong></p></th><th rowspan=\"7\"><p><strong>1</strong></p></th><th><p><strong>zpracuje podklady související s podnikáním</strong></p></th></tr><tr><td><p>připraví podnikatelský záměr</p></td></tr><tr><td><p>sestaví zakladatelský rozpočet</p></td></tr><tr><td><p>zkalkuluje cenu zboží nebo služby</p></td></tr><tr><td><p>vysvětlí na příkladu základní povinnosti podnikatele vůči státu a zaměstnancům</p></td></tr><tr><td><p>vede daňovou evidenci</p></td></tr><tr><td><p>vysvětlí na příkladech etiku v podnikání</p></td></tr><tr><td rowspan=\"7\"><p><strong>2</strong></p></td><td><p><strong>řídí realizaci jednoduchého projektu</strong></p></td></tr><tr><td><p>naplánuje aktivity projektu</p></td></tr><tr><td><p>navrhne rozpočet projektu vzhledem k navrženým aktivitám</p></td></tr><tr><td><p>stanoví základní ukazatele a sleduje jejich naplňování</p></td></tr><tr><td><p>vede projektový tým</p></td></tr><tr><td><p>uvede, jak by řešil krizové situace v projektu</p></td></tr><tr><td><p>vyhodnotí úspěšnost projektu</p></td></tr><tr><td rowspan=\"7\"><p><strong>3</strong></p></td><td><p><strong>aplikuje ekonomické teorie v osobním a profesním životě</strong></p></td></tr><tr><td><p>vysvětlí základní ekonomické otázky</p></td></tr><tr><td><p>vysvětí stanovení rovnovážné ceny na dokonalém i nedokonalém trhu</p></td></tr><tr><td><p>charakterizuje výrobní faktory a vysvětlí hranici produkčních možností a náklady obětované příležitosti</p></td></tr><tr><td><p>uvede nejdůležitější makroekonomické pojmy a vliv jejich výše na kvalitu života a podnikání v daném státě</p></td></tr><tr><td><p>vysvětlí podstatu inflace a její důsledky na finanční situaci obyvatel a na příkladu ukáže jak se bránit jejím nepříznivým důsledkům</p></td></tr><tr><td><p>uvede hlavní výhody a nevýhody mezinárodního obchodu a vliv ochranářských opatření na ekonomickou situaci dané země</p></td></tr><tr><td></td><td></td><td><p><strong>4</strong></p></td><td><p>Atd.</p></td></tr></tbody></table></div>\n\n**Vyučovací předmět / vzdělávací modul**\n\nOčekávané výsledky učení jsou v **ŠVP** členěny do vyučovacích předmětů nebo vzdělávacích modulů, které jsou dále zařazeny do jednoho nebo více ročníků 4letého studia. Vyučovací předmět / vzdělávací modul tvoří vyučovací jednotku, kde jsou očekávané výsledky učení dále rozpracovány pro potřeby výuky podle následující šablony\n\n| **A. VSTUPNÍ ČÁST** |\n| --- |\n| **1\\. Název** |\n| **2\\. Kód** (kódy by měly být navázány na obory vzdělání a výsledky učení) |\n| **2a) Kategorie vzdělání** - v případě, že nebude součástí kódu |\n| **3\\. Typ vyučovací jednotky** (modul, předmět, stáž apod.) |\n| **4\\. Délka** (počet hodin - dělitelný čtyřmi (optimální modul 16, 32 hodin = týden výuky) |\n| **5\\. Platnost** (datum, od kterého platí) |\n| **6\\. Vstupní předpoklady** (vymezení požadované úrovně vstupních vědomostí a dovedností, které jsou předpokladem úspěšného studia) |\n| |\n| **B. JÁDRO VYUČOVACÍ JEDNOTKY** |\n| **1\\. Charakteristika** (stručná anotace popisující obecné cíle a pojetí) |\n| **2\\. Očekávané výsledky učení a jejich indikátory (převzaté z RVP nebo dále konkretizované)** |\n| **3\\. Podpora rozvoje klíčových kompetencí a základních gramotností** (které klíčové kompetence jsou v rozvíjeny) |\n| **4\\. Obsah vzdělávání** (rozpis učiva) |\n| **5\\. Vzdělávací strategie** (strategie výuky, resp. učební činnosti žáků, které jsou doporučené pro dosažení výsledků) |\n| |\n| **C. VÝSTUPNÍ ČÁST** |\n| **1\\. Způsob ověřování dosažených výsledků** (ve vazbě na jednotlivé výsledky učení) |\n| **2\\. Kritéria hodnocení** (co znamená splnění výsledků učení, kdy je splněna celá vyučovací jednotka, kritéria pro známky, příp. procentuální, slovní hodnocení) |\n| **3\\. Doporučená studijní literatura, odkazy na ilustrační zdroje** |\n| **4\\. Poznámky** |\n\n**Soulad OVU RVP a ŠVP**\n\nTento soulad je předmětem zjišťování. Soulad nastává, jestliže jsou očekávané výsledky učení z jednotlivých vzdělávacích oblastí RVP **obsaženy** ve vyučovacích předmětech/ vzdělávacích modulech ŠVP jednotlivých škol, tzn. že v ŠVP se objevuje jejich formulace buď v doslovném nebo podobném znění v jednom nebo více vyučovacích předmětech/ vzdělávacích modulech.\n\n_Příklad souladu:_\n\nRVP ŠVP - komunikace a marketing (SŠ obchodní Č.\n\n| **2** | **řídí realizaci jednoduchého projektu** |\n| --- | --- |\n| naplánuje aktivity projektu |\n| navrhne rozpočet projektu vzhledem k navrženým aktivitám |\n| stanoví základní ukazatele a sleduje jejich naplňování |\n| vede projektový tým |\n| uvede, jak by řešil krizové situace v projektu |\n| vyhodnotí úspěšnost projektu |\n\nKNOWLEDGE {Porovnání RVP a ŠVP - postup}\n\n\n# AUDITNÍ PROTOKOL ŠVP-RVP\n\n# (POPIS KONTROLNÍHO ALGORITMU)\n\nMetodika je určena pro **Kvantifikaci Shody** školního vzdělávacího programu (ŠVP) s Rámcovým vzdělávacím programem (RVP).\n\n## FÁZE 1: VALIDACE DOKUMENTACE\n\n**Cíl:** Ověřit platnost, aktuálnost a strukturu zdrojových dokumentů.\n\n- **RVP Verifikace:** Otevřít aktuální verzi RVP (např. RVP ZV/G/SOŠ).\n- **Typová shoda:** Ověřit, že RVP se vztahuje k danému typu školy.\n- **ŠVP Dimenze:** Identifikovat a izolovat relevantní části ŠVP: Profil absolventa, Klíčové kompetence (KK), Vzdělávací oblasti (VO), případně Učební plán (UP).\n- **Verzování:** Potvrdit, že obě verze (RVP a ŠVP) jsou nejnovější a platné (včetně dodatků RVP).\n\n## FÁZE 2: DATABÁZOVÉ MAPOVÁNÍ VÝSTUPŮ (MASTER MATICE)\n\n**Cíl:** Vytvořit systémovou databázi pro křížové porovnání všech povinných komponent RVP se ŠVP.\n\n- **Dekompozice RVP:** Rozložit RVP na základní povinné komponenty: Klíčové kompetence, Vzdělávací oblasti a obory, Očekávané výstupy (OVU), Průřezová témata (PT).\n- **Přiřazovací mapa:** Vytvořit hlavní kontrolní matici (Master Matice) pro záznam vazeb.\n\n| Oblast RVP | Výstup RVP (OVU) | Odpovídající Část ŠVP (Předmět/Ročník) | Konkrétní Tématický Celek v ŠVP | Stav Shody (Protokol) |\n| --- | --- | --- | --- | --- |\n| ... | ... | ... | ... | ... |\n| --- | --- | --- | --- | --- |\n\n## FÁZE 3: ALGORITMICKÁ KONTROLA POKRYTÍ A HLOUBKY\n\n**Cíl:** Posoudit, zda každý povinný výstup RVP je adekvátně reflektován v obsahu ŠVP, a přidělit bodovou hodnotu pro kvantifikaci.\n\n- **Audit OVU:** Projít každý jednotlivý Očekávaný výstup (OVU) z RVP.\n- **Kódování stavu a bodování:** U každého OVU v matici označit stav pokrytí dle následujícího schématu:\n\n| Kód (Protokol) | Popis (Kvalitativní zjištění) | Bodová hodnota (Kvantifikace) |\n| --- | --- | --- |\n| ✅ | Plná shoda (Výstup pokryt v plném rozsahu, odpovídající úrovni RVP) | 1,0 |\n| --- | --- | --- |\n| ⚠️ | Částečná shoda (Formální pokrytí, omezený rozsah, chybná návaznost) | 0,5 |\n| --- | --- | --- |\n| ❌ | Absence (Výstup zcela chybí v obsahu ŠVP) | 0,0 |\n| --- | --- | --- |\n\n- **Defektologie ŠVP:** Identifikovat a zaznamenat deficity ŠVP: Chybějící výstupy (❌), Sémantické překryvy, Přetížení obsahu.\n- **Kvalitativní posun:** Ověřit, zda je formulace výstupů v ŠVP **aktivní, měřitelná a v souladu** s úrovní RVP.\n\n## FÁZE 4: STRUKTURÁLNÍ VERIFIKACE NÁVAZNOSTI (VERTIKÁLA/HORIZONTÁLA)\n\n**Cíl:** Zkontrolovat logickou posloupnost a provázanost učiva v rámci ŠVP.\n\n- **Vertikální Kontrola:** Ověřit posloupnost OVU a učiva uvnitř jednoho předmětu/oblasti (postup od jednodušších ke složitějším konceptům napříč ročníky).\n- **Horizontální Kontrola:** Zkontrolovat logické provázání napříč vzdělávacími oblastmi a předměty (např. fyzika ↔ matematika).\n- **PT Integrace:** Audit reálné integrace Průřezových témat (PT) do konkrétních částí obsahu, metod a projektů.\n\n## FÁZE 5: ANALÝZA ŠKOLNÍ PROFILACE A ROZŠÍŘENÍ RVP\n\n**Cíl:** Validovat, že profilace školy je **v souladu** s RVP a nejedná se o **rozpor**.\n\n- **Nekonfliktnost:** Porovnat definovaný Profil absolventa školy s Klíčovými kompetencemi RVP. Profil ŠVP musí RVP rozvíjet, nikoli mu odporovat.\n- **Modularita:** Zkontrolovat, zda volitelné předměty a rozšiřující moduly logicky navazují na vzdělávací oblasti RVP.\n- **Implementace specializace:** Popisně uvést, jak je školní profilace (např. STEM zaměření, projektová výuka) integrována do OVU a kompetencí definovaných RVP.\n\n## FÁZE 6: GENERÁTOR ZÁVĚREČNÉ ZPRÁVY A KVANTIFIKACE\n\n**Cíl:** Syntetizovat výsledky, kvantifikovat soulad a generovat závazné návrhy na korekce.\n\n### 6.1 Kvantifikace Souladu\n\nVypočítat Index shody (IS) na základě bodového hodnocení (Fáze 3):\n\n### 6.2 Interpretace Indexu Shody (IS)\n\nKlasifikace souladu pro standardizované vyhodnocení:\n\n| Interval IS | Klasifikace souladu | Popis |\n| --- | --- | --- |\n| 95-100 % | Výborný soulad | ŠVP plně odpovídá RVP, pouze stylistické nebo formální rozdíly. |\n| --- | --- | --- |\n| 85-94 % | Dobrá shoda | ŠVP pokrývá všechny klíčové výstupy, menší korekce nutné. |\n| --- | --- | --- |\n| 70-84 % | Částečná shoda | Významné nedostatky v některých oblastech, nutná revize obsahu. |\n| --- | --- | --- |\n| < 70 % | Kritická neshoda | ŠVP neplní rámcové požadavky, ohrožuje legislativní soulad. |\n| --- | --- | --- |\n\n### 6.3 Doplňkové Indexy\n\nVypočítat následující doplňkové indexy pro detailní kvalitativní analýzu:\n\n- **Index kompetenčního souladu (IKS):** Poměr pokrytí klíčových kompetencí RVP v ŠVP.\n- **Index průřezové integrace (IPI):** Míra reálné integrace průřezových témat do výuky.\n- **Index hloubky pokrytí (IHP):** Procento výstupů, které jsou v ŠVP rozvedeny na konkrétní výukové cíle (měřitelné, aktivní formulace).\n- **Index profilové rozšiřitelnosti (IPR):** Kolik rozšiřujících nebo profilových výstupů přesahuje rámec RVP, aniž by narušily jeho strukturu.\n\n### 6.4 Vizuální výstupy\n\nZajistit generování následujících vizualizací pro Závěrečnou zprávu:\n\n- Graf pokrytí po vzdělávacích oblastech (Sloupcový graf IS pro VO).\n- Pavoukový diagram Klíčových kompetencí (RVP vs. ŠVP).\n- Mapa defektů (Vizualizace ❌ a ⚠️ výstupů).\n\n### 6.5 Struktura Závěrečné Zprávy\n\nZpráva musí být strukturována dle standardizovaného formátu:\n\n| Oddíl | Obsah |\n| --- | --- |\n| A. Identifikace | Název školy, IZO, typ školy, datum revize, zpracovatel, verze ŠVP a RVP. |\n| --- | --- |\n| B. Shrnutí výsledků | Celkový Index Shody (IS), hlavní závěry a doporučení. |\n| --- | --- |\n| C. Kvantitativní analýza | Přehled IS v % dle kategorií OVU / VO / kompetencí. |\n| --- | --- |\n| D. Kvalitativní analýza | Slovní zhodnocení kvality souladu (formulace, obtížnost, integrace PT). |\n| --- | --- |\n| E. Rizikové oblasti | Přehled nalezených defektů (chybějící OVU, přetížení, formální shoda). |\n| --- | --- |\n| F. Návrhy opatření (Korekční plán) | Přesné návrhy změn - **Co, Kde, Kdo** má upravit, včetně termínu. |\n| --- | --- |\n| G. Přílohy | Master Matice (Fáze 2-3), revizní tabulka, výstupní grafy a metriky. |\n| --- | --- |\n\n\n\n\n.",resultingParameterName:"result",dependentParameterNames:[]}],personas:[],preparations:[{id:1,promptbookVersion:"0.103.0-0",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"Asistent pro LŠVP\n\nPERSONA Jsi asistent pro RVP Lyceum v rámci Národního pedagogického institutu České Republiky\nMETA IMAGE https://edulk.cz/getFile/id:475818/type:large/02%20zna%C4%8Dka%20npi.jpg\nRULE Pokud jsi nejsi jistý, napiš nevím\nKNOWLEDGE ./241129_Lyceum_final.pdf\nCONTEXT Obecně dokážeš řešit libovolné ŠVP, aktuálně řešíš {Školní vzdělávací program LYCEUM}\nRULE Z {Porovnání RVP a ŠVP - postup} je nejdůležitější fáze 3\nKNOWLEDGE {Školní vzdělávací program LYCEUM} ./ŠVP Lyceum - Finance v digitální době.pdf\nKNOWLEDGE @Slovník\n\n**Interní slovník - RVP/ŠVP**\n\n**RVP**\n\nRámcový vzdělávací program pro obor vzdělání Lyceum je dokument na národní úrovni, který formuluje požadavky na školní vzdělávací programy ve formě především očekávaných výsledků učení, kterých mají žáci absolvováním tohoto programu na dané škole dosáhnout.\n\n**ŠVP**\n\nŠkolní vzdělávací program pro obor vzdělání Lyceum je dokument každé jednotlivé školy, který popisuje v jakých vyučovacích předmětech/ vzdělávacích modulech a v jakých ročnících budou požadované očekávané výsledky učení naplněny. Zároveň formuluje další očekávané výsledky učení, které naplňují disponibilní část vyučovacího času určeného RVP pro tento obor vzdělání.\n\n**Očekávaný výsledek učení (OVU)**\n\nVyjadřuje jednotlivý požadavek na to, co mají žáci umět na konci vzdělávacího programu, tzn. jejich požadované kompetence. Je vyjádřen formulací, která je uvozena činnostním slovesem a dále obsahuje předmět této činnosti. Formulace je konkretizována resp. doplněna zpravidla formou odrážek vymezením dílčích znalostí, dovedností, postojů, jejichž splnění je předpokladem dosažení OVU jako celku.\n\n_Příklad:_\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th><p><strong>Žák/žákyně řídí realizaci jednoduchého projektu</strong></p></th></tr><tr><td><ul><li>naplánuje aktivity projektu</li></ul></td></tr><tr><td><ul><li>navrhne rozpočet projektu vzhledem k navrženým aktivitám</li></ul></td></tr><tr><td><ul><li>stanoví základní ukazatele a sleduje jejich naplňování</li></ul></td></tr><tr><td><ul><li>vede projektový tým</li></ul></td></tr><tr><td><ul><li>uvede, jak by řešil krizové situace v projektu</li></ul></td></tr><tr><td><ul><li>vyhodnotí úspěšnost projektu</li></ul></td></tr></tbody></table></div>\n\n**Vzdělávací oblasti**\n\nOčekávané výsledky učení jsou v **_RVP členěny do 4 vzdělávacích oblastí_**, které tvoří společný všeobecně vzdělávací základ:\n\n- Osobnostní rozvoj, vzdělávání ke zdraví, bezpečí a produktivnímu pracovnímu životu (kariéře)\n- Komunikační a jazykové vzdělávání\n- Aplikované vzdělávání STEM (Science, Technology, Engeneering, Math), tj. přírodní vědy, informatika, technika, matematika\n- Prakticky orientované vzdělávání společenskovědní a humanitní\n\nKaždá vzdělávací oblast se dále člení na okruhy, v jejichž rámci jsou OVU samostatně číslované.\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th rowspan=\"21\"><ul><li>Prakticky orientované vzdělávání společenskovědní a humanitní</li></ul></th><th rowspan=\"21\"><p><strong>Člověk, ekonomie a podnikání</strong></p></th><th rowspan=\"7\"><p><strong>1</strong></p></th><th><p><strong>zpracuje podklady související s podnikáním</strong></p></th></tr><tr><td><p>připraví podnikatelský záměr</p></td></tr><tr><td><p>sestaví zakladatelský rozpočet</p></td></tr><tr><td><p>zkalkuluje cenu zboží nebo služby</p></td></tr><tr><td><p>vysvětlí na příkladu základní povinnosti podnikatele vůči státu a zaměstnancům</p></td></tr><tr><td><p>vede daňovou evidenci</p></td></tr><tr><td><p>vysvětlí na příkladech etiku v podnikání</p></td></tr><tr><td rowspan=\"7\"><p><strong>2</strong></p></td><td><p><strong>řídí realizaci jednoduchého projektu</strong></p></td></tr><tr><td><p>naplánuje aktivity projektu</p></td></tr><tr><td><p>navrhne rozpočet projektu vzhledem k navrženým aktivitám</p></td></tr><tr><td><p>stanoví základní ukazatele a sleduje jejich naplňování</p></td></tr><tr><td><p>vede projektový tým</p></td></tr><tr><td><p>uvede, jak by řešil krizové situace v projektu</p></td></tr><tr><td><p>vyhodnotí úspěšnost projektu</p></td></tr><tr><td rowspan=\"7\"><p><strong>3</strong></p></td><td><p><strong>aplikuje ekonomické teorie v osobním a profesním životě</strong></p></td></tr><tr><td><p>vysvětlí základní ekonomické otázky</p></td></tr><tr><td><p>vysvětí stanovení rovnovážné ceny na dokonalém i nedokonalém trhu</p></td></tr><tr><td><p>charakterizuje výrobní faktory a vysvětlí hranici produkčních možností a náklady obětované příležitosti</p></td></tr><tr><td><p>uvede nejdůležitější makroekonomické pojmy a vliv jejich výše na kvalitu života a podnikání v daném státě</p></td></tr><tr><td><p>vysvětlí podstatu inflace a její důsledky na finanční situaci obyvatel a na příkladu ukáže jak se bránit jejím nepříznivým důsledkům</p></td></tr><tr><td><p>uvede hlavní výhody a nevýhody mezinárodního obchodu a vliv ochranářských opatření na ekonomickou situaci dané země</p></td></tr><tr><td></td><td></td><td><p><strong>4</strong></p></td><td><p>Atd.</p></td></tr></tbody></table></div>\n\n**Vyučovací předmět / vzdělávací modul**\n\nOčekávané výsledky učení jsou v **ŠVP** členěny do vyučovacích předmětů nebo vzdělávacích modulů, které jsou dále zařazeny do jednoho nebo více ročníků 4letého studia. Vyučovací předmět / vzdělávací modul tvoří vyučovací jednotku, kde jsou očekávané výsledky učení dále rozpracovány pro potřeby výuky podle následující šablony\n\n| **A. VSTUPNÍ ČÁST** |\n| --- |\n| **1\\. Název** |\n| **2\\. Kód** (kódy by měly být navázány na obory vzdělání a výsledky učení) |\n| **2a) Kategorie vzdělání** - v případě, že nebude součástí kódu |\n| **3\\. Typ vyučovací jednotky** (modul, předmět, stáž apod.) |\n| **4\\. Délka** (počet hodin - dělitelný čtyřmi (optimální modul 16, 32 hodin = týden výuky) |\n| **5\\. Platnost** (datum, od kterého platí) |\n| **6\\. Vstupní předpoklady** (vymezení požadované úrovně vstupních vědomostí a dovedností, které jsou předpokladem úspěšného studia) |\n| |\n| **B. JÁDRO VYUČOVACÍ JEDNOTKY** |\n| **1\\. Charakteristika** (stručná anotace popisující obecné cíle a pojetí) |\n| **2\\. Očekávané výsledky učení a jejich indikátory (převzaté z RVP nebo dále konkretizované)** |\n| **3\\. Podpora rozvoje klíčových kompetencí a základních gramotností** (které klíčové kompetence jsou v rozvíjeny) |\n| **4\\. Obsah vzdělávání** (rozpis učiva) |\n| **5\\. Vzdělávací strategie** (strategie výuky, resp. učební činnosti žáků, které jsou doporučené pro dosažení výsledků) |\n| |\n| **C. VÝSTUPNÍ ČÁST** |\n| **1\\. Způsob ověřování dosažených výsledků** (ve vazbě na jednotlivé výsledky učení) |\n| **2\\. Kritéria hodnocení** (co znamená splnění výsledků učení, kdy je splněna celá vyučovací jednotka, kritéria pro známky, příp. procentuální, slovní hodnocení) |\n| **3\\. Doporučená studijní literatura, odkazy na ilustrační zdroje** |\n| **4\\. Poznámky** |\n\n**Soulad OVU RVP a ŠVP**\n\nTento soulad je předmětem zjišťování. Soulad nastává, jestliže jsou očekávané výsledky učení z jednotlivých vzdělávacích oblastí RVP **obsaženy** ve vyučovacích předmětech/ vzdělávacích modulech ŠVP jednotlivých škol, tzn. že v ŠVP se objevuje jejich formulace buď v doslovném nebo podobném znění v jednom nebo více vyučovacích předmětech/ vzdělávacích modulech.\n\n_Příklad souladu:_\n\nRVP ŠVP - komunikace a marketing (SŠ obchodní Č.\n\n| **2** | **řídí realizaci jednoduchého projektu** |\n| --- | --- |\n| naplánuje aktivity projektu |\n| navrhne rozpočet projektu vzhledem k navrženým aktivitám |\n| stanoví základní ukazatele a sleduje jejich naplňování |\n| vede projektový tým |\n| uvede, jak by řešil krizové situace v projektu |\n| vyhodnotí úspěšnost projektu |\n\nKNOWLEDGE {Porovnání RVP a ŠVP - postup}\n\n\n# AUDITNÍ PROTOKOL ŠVP-RVP\n\n# (POPIS KONTROLNÍHO ALGORITMU)\n\nMetodika je určena pro **Kvantifikaci Shody** školního vzdělávacího programu (ŠVP) s Rámcovým vzdělávacím programem (RVP).\n\n## FÁZE 1: VALIDACE DOKUMENTACE\n\n**Cíl:** Ověřit platnost, aktuálnost a strukturu zdrojových dokumentů.\n\n- **RVP Verifikace:** Otevřít aktuální verzi RVP (např. RVP ZV/G/SOŠ).\n- **Typová shoda:** Ověřit, že RVP se vztahuje k danému typu školy.\n- **ŠVP Dimenze:** Identifikovat a izolovat relevantní části ŠVP: Profil absolventa, Klíčové kompetence (KK), Vzdělávací oblasti (VO), případně Učební plán (UP).\n- **Verzování:** Potvrdit, že obě verze (RVP a ŠVP) jsou nejnovější a platné (včetně dodatků RVP).\n\n## FÁZE 2: DATABÁZOVÉ MAPOVÁNÍ VÝSTUPŮ (MASTER MATICE)\n\n**Cíl:** Vytvořit systémovou databázi pro křížové porovnání všech povinných komponent RVP se ŠVP.\n\n- **Dekompozice RVP:** Rozložit RVP na základní povinné komponenty: Klíčové kompetence, Vzdělávací oblasti a obory, Očekávané výstupy (OVU), Průřezová témata (PT).\n- **Přiřazovací mapa:** Vytvořit hlavní kontrolní matici (Master Matice) pro záznam vazeb.\n\n| Oblast RVP | Výstup RVP (OVU) | Odpovídající Část ŠVP (Předmět/Ročník) | Konkrétní Tématický Celek v ŠVP | Stav Shody (Protokol) |\n| --- | --- | --- | --- | --- |\n| ... | ... | ... | ... | ... |\n| --- | --- | --- | --- | --- |\n\n## FÁZE 3: ALGORITMICKÁ KONTROLA POKRYTÍ A HLOUBKY\n\n**Cíl:** Posoudit, zda každý povinný výstup RVP je adekvátně reflektován v obsahu ŠVP, a přidělit bodovou hodnotu pro kvantifikaci.\n\n- **Audit OVU:** Projít každý jednotlivý Očekávaný výstup (OVU) z RVP.\n- **Kódování stavu a bodování:** U každého OVU v matici označit stav pokrytí dle následujícího schématu:\n\n| Kód (Protokol) | Popis (Kvalitativní zjištění) | Bodová hodnota (Kvantifikace) |\n| --- | --- | --- |\n| ✅ | Plná shoda (Výstup pokryt v plném rozsahu, odpovídající úrovni RVP) | 1,0 |\n| --- | --- | --- |\n| ⚠️ | Částečná shoda (Formální pokrytí, omezený rozsah, chybná návaznost) | 0,5 |\n| --- | --- | --- |\n| ❌ | Absence (Výstup zcela chybí v obsahu ŠVP) | 0,0 |\n| --- | --- | --- |\n\n- **Defektologie ŠVP:** Identifikovat a zaznamenat deficity ŠVP: Chybějící výstupy (❌), Sémantické překryvy, Přetížení obsahu.\n- **Kvalitativní posun:** Ověřit, zda je formulace výstupů v ŠVP **aktivní, měřitelná a v souladu** s úrovní RVP.\n\n## FÁZE 4: STRUKTURÁLNÍ VERIFIKACE NÁVAZNOSTI (VERTIKÁLA/HORIZONTÁLA)\n\n**Cíl:** Zkontrolovat logickou posloupnost a provázanost učiva v rámci ŠVP.\n\n- **Vertikální Kontrola:** Ověřit posloupnost OVU a učiva uvnitř jednoho předmětu/oblasti (postup od jednodušších ke složitějším konceptům napříč ročníky).\n- **Horizontální Kontrola:** Zkontrolovat logické provázání napříč vzdělávacími oblastmi a předměty (např. fyzika ↔ matematika).\n- **PT Integrace:** Audit reálné integrace Průřezových témat (PT) do konkrétních částí obsahu, metod a projektů.\n\n## FÁZE 5: ANALÝZA ŠKOLNÍ PROFILACE A ROZŠÍŘENÍ RVP\n\n**Cíl:** Validovat, že profilace školy je **v souladu** s RVP a nejedná se o **rozpor**.\n\n- **Nekonfliktnost:** Porovnat definovaný Profil absolventa školy s Klíčovými kompetencemi RVP. Profil ŠVP musí RVP rozvíjet, nikoli mu odporovat.\n- **Modularita:** Zkontrolovat, zda volitelné předměty a rozšiřující moduly logicky navazují na vzdělávací oblasti RVP.\n- **Implementace specializace:** Popisně uvést, jak je školní profilace (např. STEM zaměření, projektová výuka) integrována do OVU a kompetencí definovaných RVP.\n\n## FÁZE 6: GENERÁTOR ZÁVĚREČNÉ ZPRÁVY A KVANTIFIKACE\n\n**Cíl:** Syntetizovat výsledky, kvantifikovat soulad a generovat závazné návrhy na korekce.\n\n### 6.1 Kvantifikace Souladu\n\nVypočítat Index shody (IS) na základě bodového hodnocení (Fáze 3):\n\n### 6.2 Interpretace Indexu Shody (IS)\n\nKlasifikace souladu pro standardizované vyhodnocení:\n\n| Interval IS | Klasifikace souladu | Popis |\n| --- | --- | --- |\n| 95-100 % | Výborný soulad | ŠVP plně odpovídá RVP, pouze stylistické nebo formální rozdíly. |\n| --- | --- | --- |\n| 85-94 % | Dobrá shoda | ŠVP pokrývá všechny klíčové výstupy, menší korekce nutné. |\n| --- | --- | --- |\n| 70-84 % | Částečná shoda | Významné nedostatky v některých oblastech, nutná revize obsahu. |\n| --- | --- | --- |\n| < 70 % | Kritická neshoda | ŠVP neplní rámcové požadavky, ohrožuje legislativní soulad. |\n| --- | --- | --- |\n\n### 6.3 Doplňkové Indexy\n\nVypočítat následující doplňkové indexy pro detailní kvalitativní analýzu:\n\n- **Index kompetenčního souladu (IKS):** Poměr pokrytí klíčových kompetencí RVP v ŠVP.\n- **Index průřezové integrace (IPI):** Míra reálné integrace průřezových témat do výuky.\n- **Index hloubky pokrytí (IHP):** Procento výstupů, které jsou v ŠVP rozvedeny na konkrétní výukové cíle (měřitelné, aktivní formulace).\n- **Index profilové rozšiřitelnosti (IPR):** Kolik rozšiřujících nebo profilových výstupů přesahuje rámec RVP, aniž by narušily jeho strukturu.\n\n### 6.4 Vizuální výstupy\n\nZajistit generování následujících vizualizací pro Závěrečnou zprávu:\n\n- Graf pokrytí po vzdělávacích oblastech (Sloupcový graf IS pro VO).\n- Pavoukový diagram Klíčových kompetencí (RVP vs. ŠVP).\n- Mapa defektů (Vizualizace ❌ a ⚠️ výstupů).\n\n### 6.5 Struktura Závěrečné Zprávy\n\nZpráva musí být strukturována dle standardizovaného formátu:\n\n| Oddíl | Obsah |\n| --- | --- |\n| A. Identifikace | Název školy, IZO, typ školy, datum revize, zpracovatel, verze ŠVP a RVP. |\n| --- | --- |\n| B. Shrnutí výsledků | Celkový Index Shody (IS), hlavní závěry a doporučení. |\n| --- | --- |\n| C. Kvantitativní analýza | Přehled IS v % dle kategorií OVU / VO / kompetencí. |\n| --- | --- |\n| D. Kvalitativní analýza | Slovní zhodnocení kvality souladu (formulace, obtížnost, integrace PT). |\n| --- | --- |\n| E. Rizikové oblasti | Přehled nalezených defektů (chybějící OVU, přetížení, formální shoda). |\n| --- | --- |\n| F. Návrhy opatření (Korekční plán) | Přesné návrhy změn - **Co, Kde, Kdo** má upravit, včetně termínu. |\n| --- | --- |\n| G. Přílohy | Master Matice (Fáze 2-3), revizní tabulka, výstupní grafy a metriky. |\n| --- | --- |\n\n\n\n\n.\n"}],sourceFile:"./books/examples/lsvp-asistent.book"}];
|
|
2088
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n```json\n{availableModels}\n```\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book"}];
|
|
2101
2089
|
|
|
2102
2090
|
/**
|
|
2103
2091
|
* Checks if value is valid email
|
|
@@ -2196,6 +2184,8 @@
|
|
|
2196
2184
|
* Function `validatePipelineString` will validate the if the string is a valid pipeline string
|
|
2197
2185
|
* It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
|
|
2198
2186
|
*
|
|
2187
|
+
* Note: [🔂] This function is idempotent.
|
|
2188
|
+
*
|
|
2199
2189
|
* @param {string} pipelineString the candidate for a pipeline string
|
|
2200
2190
|
* @returns {PipelineString} the same string as input, but validated as valid
|
|
2201
2191
|
* @throws {ParseError} if the string is not a valid pipeline string
|
|
@@ -2469,7 +2459,7 @@
|
|
|
2469
2459
|
* Library of pipelines that groups together pipelines for an application.
|
|
2470
2460
|
* This implementation is a very thin wrapper around the Array / Map of pipelines.
|
|
2471
2461
|
*
|
|
2472
|
-
* @private internal function of `
|
|
2462
|
+
* @private internal function of `createPipelineCollectionFromJson`, use `createPipelineCollectionFromJson` instead
|
|
2473
2463
|
* @see https://github.com/webgptorg/pipeline#pipeline-collection
|
|
2474
2464
|
*/
|
|
2475
2465
|
class SimplePipelineCollection {
|
|
@@ -2479,14 +2469,14 @@
|
|
|
2479
2469
|
* @param pipelines Array of pipeline JSON objects to include in the collection
|
|
2480
2470
|
*
|
|
2481
2471
|
* Note: During the construction logic of all pipelines are validated
|
|
2482
|
-
* Note: It is not recommended to use this constructor directly, use `
|
|
2472
|
+
* Note: It is not recommended to use this constructor directly, use `createPipelineCollectionFromJson` *(or other variant)* instead
|
|
2483
2473
|
*/
|
|
2484
2474
|
constructor(...pipelines) {
|
|
2485
2475
|
this.collection = new Map();
|
|
2486
2476
|
for (const pipeline of pipelines) {
|
|
2487
2477
|
// TODO: [👠] DRY
|
|
2488
2478
|
if (pipeline.pipelineUrl === undefined) {
|
|
2489
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
2479
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
2490
2480
|
Pipeline with name "${pipeline.title}" does not have defined URL
|
|
2491
2481
|
|
|
2492
2482
|
File:
|
|
@@ -2508,7 +2498,7 @@
|
|
|
2508
2498
|
pipelineJsonToString(unpreparePipeline(pipeline)) !==
|
|
2509
2499
|
pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
|
|
2510
2500
|
const existing = this.collection.get(pipeline.pipelineUrl);
|
|
2511
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
2501
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
2512
2502
|
Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
|
|
2513
2503
|
|
|
2514
2504
|
Conflicting files:
|
|
@@ -2540,13 +2530,13 @@
|
|
|
2540
2530
|
const pipeline = this.collection.get(url);
|
|
2541
2531
|
if (!pipeline) {
|
|
2542
2532
|
if (this.listPipelines().length === 0) {
|
|
2543
|
-
throw new NotFoundError(spaceTrim.spaceTrim(`
|
|
2533
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim(`
|
|
2544
2534
|
Pipeline with url "${url}" not found
|
|
2545
2535
|
|
|
2546
2536
|
No pipelines available
|
|
2547
2537
|
`));
|
|
2548
2538
|
}
|
|
2549
|
-
throw new NotFoundError(spaceTrim.spaceTrim((block) => `
|
|
2539
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
|
|
2550
2540
|
Pipeline with url "${url}" not found
|
|
2551
2541
|
|
|
2552
2542
|
Available pipelines:
|
|
@@ -2567,16 +2557,16 @@
|
|
|
2567
2557
|
}
|
|
2568
2558
|
|
|
2569
2559
|
/**
|
|
2570
|
-
* Creates PipelineCollection from array of PipelineJson or PipelineString
|
|
2560
|
+
* Creates `PipelineCollection` from array of PipelineJson or PipelineString
|
|
2571
2561
|
*
|
|
2572
|
-
* Note: Functions `
|
|
2562
|
+
* Note: Functions `pipelineCollectionToJson` and `createPipelineCollectionFromJson` are complementary
|
|
2573
2563
|
* Note: Syntax, parsing, and logic consistency checks are performed on all sources during build
|
|
2574
2564
|
*
|
|
2575
2565
|
* @param promptbookSources
|
|
2576
2566
|
* @returns PipelineCollection
|
|
2577
2567
|
* @public exported from `@promptbook/core`
|
|
2578
2568
|
*/
|
|
2579
|
-
function
|
|
2569
|
+
function createPipelineCollectionFromJson(...promptbooks) {
|
|
2580
2570
|
return new SimplePipelineCollection(...promptbooks);
|
|
2581
2571
|
}
|
|
2582
2572
|
|
|
@@ -2587,7 +2577,7 @@
|
|
|
2587
2577
|
*/
|
|
2588
2578
|
class MissingToolsError extends Error {
|
|
2589
2579
|
constructor(message) {
|
|
2590
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
2580
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
2591
2581
|
${block(message)}
|
|
2592
2582
|
|
|
2593
2583
|
Note: You have probably forgot to provide some tools for pipeline execution or preparation
|
|
@@ -2694,6 +2684,22 @@
|
|
|
2694
2684
|
}
|
|
2695
2685
|
}
|
|
2696
2686
|
|
|
2687
|
+
/**
|
|
2688
|
+
* This error indicates error from the database
|
|
2689
|
+
*
|
|
2690
|
+
* @public exported from `@promptbook/core`
|
|
2691
|
+
*/
|
|
2692
|
+
class DatabaseError extends Error {
|
|
2693
|
+
constructor(message) {
|
|
2694
|
+
super(message);
|
|
2695
|
+
this.name = 'DatabaseError';
|
|
2696
|
+
Object.setPrototypeOf(this, DatabaseError.prototype);
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
/**
|
|
2700
|
+
* TODO: [🐱🚀] Explain that NotFoundError ([🐱🚀] and other specific errors) has priority over DatabaseError in some contexts
|
|
2701
|
+
*/
|
|
2702
|
+
|
|
2697
2703
|
/**
|
|
2698
2704
|
* This error type indicates that you try to use a feature that is not available in the current environment
|
|
2699
2705
|
*
|
|
@@ -2749,6 +2755,19 @@
|
|
|
2749
2755
|
}
|
|
2750
2756
|
}
|
|
2751
2757
|
|
|
2758
|
+
/**
|
|
2759
|
+
* This error indicates that promptbook operation is not allowed
|
|
2760
|
+
*
|
|
2761
|
+
* @public exported from `@promptbook/core`
|
|
2762
|
+
*/
|
|
2763
|
+
class NotAllowed extends Error {
|
|
2764
|
+
constructor(message) {
|
|
2765
|
+
super(message);
|
|
2766
|
+
this.name = 'NotAllowed';
|
|
2767
|
+
Object.setPrototypeOf(this, NotAllowed.prototype);
|
|
2768
|
+
}
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2752
2771
|
/**
|
|
2753
2772
|
* This error type indicates that some part of the code is not implemented yet
|
|
2754
2773
|
*
|
|
@@ -2756,7 +2775,7 @@
|
|
|
2756
2775
|
*/
|
|
2757
2776
|
class NotYetImplementedError extends Error {
|
|
2758
2777
|
constructor(message) {
|
|
2759
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
2778
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
2760
2779
|
${block(message)}
|
|
2761
2780
|
|
|
2762
2781
|
Note: This feature is not implemented yet but it will be soon.
|
|
@@ -2775,6 +2794,7 @@
|
|
|
2775
2794
|
/**
|
|
2776
2795
|
* Generates random token
|
|
2777
2796
|
*
|
|
2797
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
2778
2798
|
* Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
|
|
2779
2799
|
*
|
|
2780
2800
|
* @private internal helper function
|
|
@@ -2784,6 +2804,7 @@
|
|
|
2784
2804
|
return crypto.randomBytes(randomness).toString('hex');
|
|
2785
2805
|
}
|
|
2786
2806
|
/**
|
|
2807
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
2787
2808
|
* TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
2788
2809
|
*/
|
|
2789
2810
|
|
|
@@ -2843,6 +2864,8 @@
|
|
|
2843
2864
|
PromptbookFetchError,
|
|
2844
2865
|
UnexpectedError,
|
|
2845
2866
|
WrappedError,
|
|
2867
|
+
NotAllowed,
|
|
2868
|
+
DatabaseError,
|
|
2846
2869
|
// TODO: [🪑]> VersionMismatchError,
|
|
2847
2870
|
};
|
|
2848
2871
|
/**
|
|
@@ -2991,11 +3014,11 @@
|
|
|
2991
3014
|
throw deserializeError(errors[0]);
|
|
2992
3015
|
}
|
|
2993
3016
|
else {
|
|
2994
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
3017
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
2995
3018
|
Multiple errors occurred during Promptbook execution
|
|
2996
3019
|
|
|
2997
3020
|
${block(errors
|
|
2998
|
-
.map(({ name, stack, message }, index) => spaceTrim.spaceTrim((block) => `
|
|
3021
|
+
.map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
|
|
2999
3022
|
${name} ${index + 1}:
|
|
3000
3023
|
${block(stack || message)}
|
|
3001
3024
|
`))
|
|
@@ -3022,6 +3045,7 @@
|
|
|
3022
3045
|
let updatedAt = createdAt;
|
|
3023
3046
|
const errors = [];
|
|
3024
3047
|
const warnings = [];
|
|
3048
|
+
const llmCalls = [];
|
|
3025
3049
|
let currentValue = {};
|
|
3026
3050
|
let customTldr = null;
|
|
3027
3051
|
const partialResultSubject = new rxjs.Subject();
|
|
@@ -3037,6 +3061,9 @@
|
|
|
3037
3061
|
}, (tldrInfo) => {
|
|
3038
3062
|
customTldr = tldrInfo;
|
|
3039
3063
|
updatedAt = new Date();
|
|
3064
|
+
}, (llmCall) => {
|
|
3065
|
+
llmCalls.push(llmCall);
|
|
3066
|
+
updatedAt = new Date();
|
|
3040
3067
|
});
|
|
3041
3068
|
finalResultPromise
|
|
3042
3069
|
.catch((error) => {
|
|
@@ -3159,7 +3186,7 @@
|
|
|
3159
3186
|
}
|
|
3160
3187
|
return {
|
|
3161
3188
|
percent: percent,
|
|
3162
|
-
message,
|
|
3189
|
+
message: message + ' (!!!fallback)',
|
|
3163
3190
|
};
|
|
3164
3191
|
},
|
|
3165
3192
|
get createdAt() {
|
|
@@ -3182,6 +3209,10 @@
|
|
|
3182
3209
|
return warnings;
|
|
3183
3210
|
// <- Note: [1] --||--
|
|
3184
3211
|
},
|
|
3212
|
+
get llmCalls() {
|
|
3213
|
+
return [...llmCalls, { foo: '!!! bar' }];
|
|
3214
|
+
// <- Note: [1] --||--
|
|
3215
|
+
},
|
|
3185
3216
|
get currentValue() {
|
|
3186
3217
|
return currentValue;
|
|
3187
3218
|
// <- Note: [1] --||--
|
|
@@ -3441,7 +3472,7 @@
|
|
|
3441
3472
|
}
|
|
3442
3473
|
catch (error) {
|
|
3443
3474
|
assertsError(error);
|
|
3444
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
3475
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
3445
3476
|
Can not extract variables from the script
|
|
3446
3477
|
${block(error.stack || error.message)}
|
|
3447
3478
|
|
|
@@ -4134,6 +4165,7 @@
|
|
|
4134
4165
|
return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
|
|
4135
4166
|
}
|
|
4136
4167
|
/**
|
|
4168
|
+
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
4137
4169
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
4138
4170
|
*/
|
|
4139
4171
|
|
|
@@ -4150,6 +4182,7 @@
|
|
|
4150
4182
|
return llmTools;
|
|
4151
4183
|
}
|
|
4152
4184
|
/**
|
|
4185
|
+
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
4153
4186
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
4154
4187
|
*/
|
|
4155
4188
|
|
|
@@ -4387,10 +4420,13 @@
|
|
|
4387
4420
|
* @public exported from `@promptbook/utils`
|
|
4388
4421
|
*/
|
|
4389
4422
|
function countLines(text) {
|
|
4423
|
+
if (text === '') {
|
|
4424
|
+
return 0;
|
|
4425
|
+
}
|
|
4390
4426
|
text = text.replace('\r\n', '\n');
|
|
4391
4427
|
text = text.replace('\r', '\n');
|
|
4392
4428
|
const lines = text.split('\n');
|
|
4393
|
-
return lines.reduce((count, line) => count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 0);
|
|
4429
|
+
return lines.reduce((count, line) => count + Math.max(Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 1), 0);
|
|
4394
4430
|
}
|
|
4395
4431
|
/**
|
|
4396
4432
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
@@ -4778,6 +4814,8 @@
|
|
|
4778
4814
|
* This function provides a common abstraction for result validation that can be used
|
|
4779
4815
|
* by both execution logic and caching logic to ensure consistency.
|
|
4780
4816
|
*
|
|
4817
|
+
* Note: [🔂] This function is idempotent.
|
|
4818
|
+
*
|
|
4781
4819
|
* @param options - The validation options including result string, expectations, and format
|
|
4782
4820
|
* @returns Validation result with processed string and validity status
|
|
4783
4821
|
* @private internal function of `createPipelineExecutor` and `cacheLlmTools`
|
|
@@ -4797,7 +4835,7 @@
|
|
|
4797
4835
|
}
|
|
4798
4836
|
catch (error) {
|
|
4799
4837
|
keepUnused(error);
|
|
4800
|
-
throw new ExpectError(spaceTrim.spaceTrim((block) => `
|
|
4838
|
+
throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
|
|
4801
4839
|
Expected valid JSON string
|
|
4802
4840
|
|
|
4803
4841
|
The expected JSON text:
|
|
@@ -4846,7 +4884,7 @@
|
|
|
4846
4884
|
*/
|
|
4847
4885
|
async function executeAttempts(options) {
|
|
4848
4886
|
const { jokerParameterNames, priority, maxAttempts, // <- Note: [💂]
|
|
4849
|
-
preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, } = options;
|
|
4887
|
+
preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, logLlmCall, } = options;
|
|
4850
4888
|
const $ongoingTaskResult = {
|
|
4851
4889
|
$result: null,
|
|
4852
4890
|
$resultString: null,
|
|
@@ -4860,7 +4898,7 @@
|
|
|
4860
4898
|
const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
|
|
4861
4899
|
// TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
|
|
4862
4900
|
if (isJokerAttempt && !jokerParameterName) {
|
|
4863
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
4901
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
4864
4902
|
Joker not found in attempt ${attemptIndex}
|
|
4865
4903
|
|
|
4866
4904
|
${block(pipelineIdentification)}
|
|
@@ -4871,7 +4909,7 @@
|
|
|
4871
4909
|
$ongoingTaskResult.$expectError = null;
|
|
4872
4910
|
if (isJokerAttempt) {
|
|
4873
4911
|
if (parameters[jokerParameterName] === undefined) {
|
|
4874
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
4912
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
4875
4913
|
Joker parameter {${jokerParameterName}} not defined
|
|
4876
4914
|
|
|
4877
4915
|
${block(pipelineIdentification)}
|
|
@@ -4929,7 +4967,7 @@
|
|
|
4929
4967
|
$ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
|
|
4930
4968
|
break variant;
|
|
4931
4969
|
case 'EMBEDDING':
|
|
4932
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
4970
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
4933
4971
|
Embedding model can not be used in pipeline
|
|
4934
4972
|
|
|
4935
4973
|
This should be catched during parsing
|
|
@@ -4940,7 +4978,7 @@
|
|
|
4940
4978
|
break variant;
|
|
4941
4979
|
// <- case [🤖]:
|
|
4942
4980
|
default:
|
|
4943
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
4981
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
4944
4982
|
Unknown model variant "${task.modelRequirements.modelVariant}"
|
|
4945
4983
|
|
|
4946
4984
|
${block(pipelineIdentification)}
|
|
@@ -4951,14 +4989,14 @@
|
|
|
4951
4989
|
break;
|
|
4952
4990
|
case 'SCRIPT_TASK':
|
|
4953
4991
|
if (arrayableToArray(tools.script).length === 0) {
|
|
4954
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
4992
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
4955
4993
|
No script execution tools are available
|
|
4956
4994
|
|
|
4957
4995
|
${block(pipelineIdentification)}
|
|
4958
4996
|
`));
|
|
4959
4997
|
}
|
|
4960
4998
|
if (!task.contentLanguage) {
|
|
4961
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
4999
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
4962
5000
|
Script language is not defined for SCRIPT TASK "${task.name}"
|
|
4963
5001
|
|
|
4964
5002
|
${block(pipelineIdentification)}
|
|
@@ -4989,7 +5027,7 @@
|
|
|
4989
5027
|
throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
|
|
4990
5028
|
}
|
|
4991
5029
|
else {
|
|
4992
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
5030
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
4993
5031
|
Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
|
|
4994
5032
|
|
|
4995
5033
|
${block(pipelineIdentification)}
|
|
@@ -5003,7 +5041,7 @@
|
|
|
5003
5041
|
break taskType;
|
|
5004
5042
|
case 'DIALOG_TASK':
|
|
5005
5043
|
if (tools.userInterface === undefined) {
|
|
5006
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
5044
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
5007
5045
|
User interface tools are not available
|
|
5008
5046
|
|
|
5009
5047
|
${block(pipelineIdentification)}
|
|
@@ -5021,7 +5059,7 @@
|
|
|
5021
5059
|
break taskType;
|
|
5022
5060
|
// <- case: [🅱]
|
|
5023
5061
|
default:
|
|
5024
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
5062
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
5025
5063
|
Unknown execution type "${task.taskType}"
|
|
5026
5064
|
|
|
5027
5065
|
${block(pipelineIdentification)}
|
|
@@ -5094,14 +5132,10 @@
|
|
|
5094
5132
|
});
|
|
5095
5133
|
}
|
|
5096
5134
|
finally {
|
|
5097
|
-
if (!isJokerAttempt &&
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
// In that case we don’t want to make a report about it because it’s not a llm execution error
|
|
5102
|
-
) {
|
|
5103
|
-
// TODO: [🧠] Maybe put other taskTypes into report
|
|
5104
|
-
$executionReport.promptExecutions.push({
|
|
5135
|
+
if (!isJokerAttempt && task.taskType === 'PROMPT_TASK' && $ongoingTaskResult.$prompt) {
|
|
5136
|
+
// Note: [2] When some expected parameter is not defined, error will occur in templateParameters
|
|
5137
|
+
// In that case we don’t want to make a report about it because it’s not a llm execution error
|
|
5138
|
+
const executionPromptReport = {
|
|
5105
5139
|
prompt: {
|
|
5106
5140
|
...$ongoingTaskResult.$prompt,
|
|
5107
5141
|
// <- TODO: [🧠] How to pick everyhing except `pipelineUrl`
|
|
@@ -5110,13 +5144,20 @@
|
|
|
5110
5144
|
error: $ongoingTaskResult.$expectError === null
|
|
5111
5145
|
? undefined
|
|
5112
5146
|
: serializeError($ongoingTaskResult.$expectError),
|
|
5113
|
-
}
|
|
5147
|
+
};
|
|
5148
|
+
$executionReport.promptExecutions.push(executionPromptReport);
|
|
5149
|
+
if (logLlmCall) {
|
|
5150
|
+
logLlmCall({
|
|
5151
|
+
modelName: 'model' /* <- TODO: How to get model name from the report */,
|
|
5152
|
+
report: executionPromptReport,
|
|
5153
|
+
});
|
|
5154
|
+
}
|
|
5114
5155
|
}
|
|
5115
5156
|
}
|
|
5116
5157
|
if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
|
|
5117
5158
|
// Note: Create a summary of all failures
|
|
5118
5159
|
const failuresSummary = $ongoingTaskResult.$failedResults
|
|
5119
|
-
.map((failure) => spaceTrim.spaceTrim((block) => {
|
|
5160
|
+
.map((failure) => spaceTrim$1.spaceTrim((block) => {
|
|
5120
5161
|
var _a, _b;
|
|
5121
5162
|
return `
|
|
5122
5163
|
Attempt ${failure.attemptIndex + 1}:
|
|
@@ -5126,14 +5167,14 @@
|
|
|
5126
5167
|
Result:
|
|
5127
5168
|
${block(failure.result === null
|
|
5128
5169
|
? 'null'
|
|
5129
|
-
: spaceTrim.spaceTrim(failure.result)
|
|
5170
|
+
: spaceTrim$1.spaceTrim(failure.result)
|
|
5130
5171
|
.split('\n')
|
|
5131
5172
|
.map((line) => `> ${line}`)
|
|
5132
5173
|
.join('\n'))}
|
|
5133
5174
|
`;
|
|
5134
5175
|
}))
|
|
5135
5176
|
.join('\n\n---\n\n');
|
|
5136
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
|
|
5177
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
|
|
5137
5178
|
var _a;
|
|
5138
5179
|
return `
|
|
5139
5180
|
LLM execution failed ${maxExecutionAttempts}x
|
|
@@ -5153,7 +5194,7 @@
|
|
|
5153
5194
|
}
|
|
5154
5195
|
}
|
|
5155
5196
|
if ($ongoingTaskResult.$resultString === null) {
|
|
5156
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
5197
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
5157
5198
|
Something went wrong and prompt result is null
|
|
5158
5199
|
|
|
5159
5200
|
${block(pipelineIdentification)}
|
|
@@ -5175,9 +5216,9 @@
|
|
|
5175
5216
|
* @private internal utility of `createPipelineExecutor`
|
|
5176
5217
|
*/
|
|
5177
5218
|
async function executeFormatSubvalues(options) {
|
|
5178
|
-
const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, pipelineIdentification } = options;
|
|
5219
|
+
const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, logLlmCall, pipelineIdentification, } = options;
|
|
5179
5220
|
if (task.foreach === undefined) {
|
|
5180
|
-
return /* not await */ executeAttempts(options);
|
|
5221
|
+
return /* not await */ executeAttempts({ ...options, logLlmCall });
|
|
5181
5222
|
}
|
|
5182
5223
|
if (jokerParameterNames.length !== 0) {
|
|
5183
5224
|
throw new UnexpectedError(spaceTrim__default["default"]((block) => `
|
|
@@ -5383,7 +5424,7 @@
|
|
|
5383
5424
|
},
|
|
5384
5425
|
content: task.content,
|
|
5385
5426
|
parameters,
|
|
5386
|
-
};
|
|
5427
|
+
}; /* <- Note: [🤛] */
|
|
5387
5428
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
5388
5429
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
5389
5430
|
const { index } = knowledgePiece;
|
|
@@ -5459,7 +5500,7 @@
|
|
|
5459
5500
|
// Note: Doublecheck that ALL reserved parameters are defined:
|
|
5460
5501
|
for (const parameterName of RESERVED_PARAMETER_NAMES) {
|
|
5461
5502
|
if (reservedParameters[parameterName] === undefined) {
|
|
5462
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
5503
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
5463
5504
|
Reserved parameter {${parameterName}} is not defined
|
|
5464
5505
|
|
|
5465
5506
|
${block(pipelineIdentification)}
|
|
@@ -5478,14 +5519,14 @@
|
|
|
5478
5519
|
* @private internal utility of `createPipelineExecutor`
|
|
5479
5520
|
*/
|
|
5480
5521
|
async function executeTask(options) {
|
|
5481
|
-
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
|
|
5522
|
+
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, logLlmCall, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
|
|
5482
5523
|
const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
5483
5524
|
// Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
|
|
5484
5525
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
5485
5526
|
const dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
5486
5527
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
5487
5528
|
if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
|
|
5488
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
5529
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
5489
5530
|
Dependent parameters are not consistent with used parameters:
|
|
5490
5531
|
|
|
5491
5532
|
Dependent parameters:
|
|
@@ -5529,7 +5570,7 @@
|
|
|
5529
5570
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
5530
5571
|
// Houston, we have a problem
|
|
5531
5572
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
5532
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
5573
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
5533
5574
|
Parameter \`{${parameterName}}\` is NOT defined
|
|
5534
5575
|
BUT used in task "${currentTask.title || currentTask.name}"
|
|
5535
5576
|
|
|
@@ -5557,6 +5598,7 @@
|
|
|
5557
5598
|
tools,
|
|
5558
5599
|
$executionReport,
|
|
5559
5600
|
onProgress,
|
|
5601
|
+
logLlmCall,
|
|
5560
5602
|
pipelineIdentification,
|
|
5561
5603
|
maxExecutionAttempts,
|
|
5562
5604
|
maxParallelCount,
|
|
@@ -5597,9 +5639,32 @@
|
|
|
5597
5639
|
for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
|
|
5598
5640
|
if (parametersToPass[parameter.name] === undefined) {
|
|
5599
5641
|
// [4]
|
|
5600
|
-
$warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
5642
|
+
$warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
5601
5643
|
Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
|
|
5602
5644
|
|
|
5645
|
+
Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
|
|
5646
|
+
|
|
5647
|
+
All parameters:
|
|
5648
|
+
${block(preparedPipeline.parameters
|
|
5649
|
+
.map(({ name, isInput, isOutput, description }) => {
|
|
5650
|
+
let line = `\`{${name}}\``;
|
|
5651
|
+
if (isInput) {
|
|
5652
|
+
line += ' `[input parameter]`';
|
|
5653
|
+
}
|
|
5654
|
+
if (isOutput) {
|
|
5655
|
+
line += ' `[output parameter]`';
|
|
5656
|
+
}
|
|
5657
|
+
if (parametersToPass[name] === undefined) {
|
|
5658
|
+
line += ` <- Warning: Should be in the output but its not |`;
|
|
5659
|
+
}
|
|
5660
|
+
if (description) {
|
|
5661
|
+
line += ` ${description}`;
|
|
5662
|
+
}
|
|
5663
|
+
return line;
|
|
5664
|
+
})
|
|
5665
|
+
.map((line, index) => `${index + 1}) ${line}`)
|
|
5666
|
+
.join('\n'))}
|
|
5667
|
+
|
|
5603
5668
|
${block(pipelineIdentification)}
|
|
5604
5669
|
`)));
|
|
5605
5670
|
continue;
|
|
@@ -5620,7 +5685,7 @@
|
|
|
5620
5685
|
* @private internal utility of `createPipelineExecutor`
|
|
5621
5686
|
*/
|
|
5622
5687
|
async function executePipeline(options) {
|
|
5623
|
-
const { inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
|
|
5688
|
+
const { inputParameters, tools, onProgress, logLlmCall, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
|
|
5624
5689
|
let { preparedPipeline } = options;
|
|
5625
5690
|
if (preparedPipeline === undefined) {
|
|
5626
5691
|
preparedPipeline = await preparePipeline(pipeline, tools, {
|
|
@@ -5682,7 +5747,7 @@
|
|
|
5682
5747
|
for (const parameterName of Object.keys(inputParameters)) {
|
|
5683
5748
|
const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
|
|
5684
5749
|
if (parameter === undefined) {
|
|
5685
|
-
warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
5750
|
+
warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
5686
5751
|
Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
|
|
5687
5752
|
|
|
5688
5753
|
${block(pipelineIdentification)}
|
|
@@ -5697,7 +5762,7 @@
|
|
|
5697
5762
|
// TODO: [🧠] This should be also non-critical error
|
|
5698
5763
|
return exportJson({
|
|
5699
5764
|
name: 'pipelineExecutorResult',
|
|
5700
|
-
message: spaceTrim.spaceTrim((block) => `
|
|
5765
|
+
message: spaceTrim$1.spaceTrim((block) => `
|
|
5701
5766
|
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
5702
5767
|
|
|
5703
5768
|
${block(pipelineIdentification)}
|
|
@@ -5706,7 +5771,7 @@
|
|
|
5706
5771
|
value: {
|
|
5707
5772
|
isSuccessful: false,
|
|
5708
5773
|
errors: [
|
|
5709
|
-
new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
5774
|
+
new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
5710
5775
|
Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
|
|
5711
5776
|
|
|
5712
5777
|
${block(pipelineIdentification)}
|
|
@@ -5733,7 +5798,7 @@
|
|
|
5733
5798
|
while (unresovedTasks.length > 0) {
|
|
5734
5799
|
if (loopLimit-- < 0) {
|
|
5735
5800
|
// Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
|
|
5736
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
5801
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
5737
5802
|
Loop limit reached during resolving parameters pipeline execution
|
|
5738
5803
|
|
|
5739
5804
|
${block(pipelineIdentification)}
|
|
@@ -5743,7 +5808,7 @@
|
|
|
5743
5808
|
if (!currentTask && resolving.length === 0) {
|
|
5744
5809
|
throw new UnexpectedError(
|
|
5745
5810
|
// TODO: [🐎] DRY
|
|
5746
|
-
spaceTrim.spaceTrim((block) => `
|
|
5811
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
5747
5812
|
Can not resolve some parameters:
|
|
5748
5813
|
|
|
5749
5814
|
${block(pipelineIdentification)}
|
|
@@ -5783,7 +5848,7 @@
|
|
|
5783
5848
|
tools,
|
|
5784
5849
|
onProgress(newOngoingResult) {
|
|
5785
5850
|
if (isReturned) {
|
|
5786
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
5851
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
5787
5852
|
Can not call \`onProgress\` after pipeline execution is finished
|
|
5788
5853
|
|
|
5789
5854
|
${block(pipelineIdentification)}
|
|
@@ -5798,8 +5863,9 @@
|
|
|
5798
5863
|
onProgress(newOngoingResult);
|
|
5799
5864
|
}
|
|
5800
5865
|
},
|
|
5866
|
+
logLlmCall,
|
|
5801
5867
|
$executionReport: executionReport,
|
|
5802
|
-
pipelineIdentification: spaceTrim.spaceTrim((block) => `
|
|
5868
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
5803
5869
|
${block(pipelineIdentification)}
|
|
5804
5870
|
Task name: ${currentTask.name}
|
|
5805
5871
|
Task title: ${currentTask.title}
|
|
@@ -5908,7 +5974,7 @@
|
|
|
5908
5974
|
preparedPipeline = pipeline;
|
|
5909
5975
|
}
|
|
5910
5976
|
else if (isNotPreparedWarningSuppressed !== true) {
|
|
5911
|
-
console.warn(spaceTrim.spaceTrim((block) => `
|
|
5977
|
+
console.warn(spaceTrim$1.spaceTrim((block) => `
|
|
5912
5978
|
Pipeline is not prepared
|
|
5913
5979
|
|
|
5914
5980
|
${block(pipelineIdentification)}
|
|
@@ -5921,7 +5987,7 @@
|
|
|
5921
5987
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
5922
5988
|
}
|
|
5923
5989
|
let runCount = 0;
|
|
5924
|
-
const pipelineExecutorWithCallback = async (inputParameters, onProgress) => {
|
|
5990
|
+
const pipelineExecutorWithCallback = async (inputParameters, onProgress, logLlmCall) => {
|
|
5925
5991
|
runCount++;
|
|
5926
5992
|
return /* not await */ executePipeline({
|
|
5927
5993
|
pipeline,
|
|
@@ -5932,7 +5998,8 @@
|
|
|
5932
5998
|
inputParameters,
|
|
5933
5999
|
tools,
|
|
5934
6000
|
onProgress,
|
|
5935
|
-
|
|
6001
|
+
logLlmCall,
|
|
6002
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
5936
6003
|
${block(pipelineIdentification)}
|
|
5937
6004
|
${runCount === 1 ? '' : `Run #${runCount}`}
|
|
5938
6005
|
`),
|
|
@@ -6149,7 +6216,7 @@
|
|
|
6149
6216
|
throw new MissingToolsError('LLM tools are required for preparing persona');
|
|
6150
6217
|
}
|
|
6151
6218
|
// TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
|
|
6152
|
-
const collection =
|
|
6219
|
+
const collection = createPipelineCollectionFromJson(...PipelineCollection);
|
|
6153
6220
|
const preparePersonaExecutor = createPipelineExecutor({
|
|
6154
6221
|
pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book'),
|
|
6155
6222
|
tools,
|
|
@@ -6452,6 +6519,8 @@
|
|
|
6452
6519
|
/**
|
|
6453
6520
|
* Converts a given text to kebab-case format.
|
|
6454
6521
|
*
|
|
6522
|
+
* Note: [🔂] This function is idempotent.
|
|
6523
|
+
*
|
|
6455
6524
|
* @param text The text to be converted.
|
|
6456
6525
|
* @returns The kebab-case formatted string.
|
|
6457
6526
|
* @example 'hello-world'
|
|
@@ -6607,6 +6676,8 @@
|
|
|
6607
6676
|
/**
|
|
6608
6677
|
* Converts a title string into a normalized name.
|
|
6609
6678
|
*
|
|
6679
|
+
* Note: [🔂] This function is idempotent.
|
|
6680
|
+
*
|
|
6610
6681
|
* @param value The title string to be converted to a name.
|
|
6611
6682
|
* @returns A normalized name derived from the input title.
|
|
6612
6683
|
* @example 'Hello World!' -> 'hello-world'
|
|
@@ -6995,7 +7066,7 @@
|
|
|
6995
7066
|
if (task.taskType === 'PROMPT_TASK' &&
|
|
6996
7067
|
knowledgePiecesCount > 0 &&
|
|
6997
7068
|
!dependentParameterNames.includes('knowledge')) {
|
|
6998
|
-
preparedContent = spaceTrim.spaceTrim(`
|
|
7069
|
+
preparedContent = spaceTrim$1.spaceTrim(`
|
|
6999
7070
|
{content}
|
|
7000
7071
|
|
|
7001
7072
|
## Knowledge
|
|
@@ -7081,7 +7152,7 @@
|
|
|
7081
7152
|
let title = pipeline.title;
|
|
7082
7153
|
if (title === undefined || title === '' || title === DEFAULT_BOOK_TITLE) {
|
|
7083
7154
|
// TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
|
|
7084
|
-
const collection =
|
|
7155
|
+
const collection = createPipelineCollectionFromJson(...PipelineCollection);
|
|
7085
7156
|
const prepareTitleExecutor = createPipelineExecutor({
|
|
7086
7157
|
pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book'),
|
|
7087
7158
|
tools,
|
|
@@ -7889,6 +7960,8 @@
|
|
|
7889
7960
|
/**
|
|
7890
7961
|
* Normalizes a given text to camelCase format.
|
|
7891
7962
|
*
|
|
7963
|
+
* Note: [🔂] This function is idempotent.
|
|
7964
|
+
*
|
|
7892
7965
|
* @param text The text to be normalized.
|
|
7893
7966
|
* @param _isFirstLetterCapital Whether the first letter should be capitalized.
|
|
7894
7967
|
* @returns The camelCase formatted string.
|
|
@@ -7966,6 +8039,8 @@
|
|
|
7966
8039
|
* Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
|
|
7967
8040
|
* It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
|
|
7968
8041
|
*
|
|
8042
|
+
* Note: [🔂] This function is idempotent.
|
|
8043
|
+
*
|
|
7969
8044
|
* @param parameterName The parameter name to validate and normalize.
|
|
7970
8045
|
* @returns The validated and normalized parameter name.
|
|
7971
8046
|
* @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
|
|
@@ -9508,7 +9583,7 @@
|
|
|
9508
9583
|
function getParserForCommand(command) {
|
|
9509
9584
|
const commandParser = COMMANDS.find((commandParser) => commandParser.name === command.type);
|
|
9510
9585
|
if (commandParser === undefined) {
|
|
9511
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
9586
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
9512
9587
|
Command ${command.type} parser is not found
|
|
9513
9588
|
|
|
9514
9589
|
${block(JSON.stringify(command, null, 4)
|
|
@@ -9584,7 +9659,7 @@
|
|
|
9584
9659
|
.map(removeMarkdownFormatting)
|
|
9585
9660
|
.map((item) => item.trim());
|
|
9586
9661
|
if (items.length === 0 || items[0] === '') {
|
|
9587
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
9662
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
9588
9663
|
Malformed command:
|
|
9589
9664
|
- ${raw}
|
|
9590
9665
|
|
|
@@ -9620,7 +9695,7 @@
|
|
|
9620
9695
|
return command;
|
|
9621
9696
|
}
|
|
9622
9697
|
}
|
|
9623
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
9698
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
9624
9699
|
Malformed or unknown command:
|
|
9625
9700
|
- ${raw}
|
|
9626
9701
|
|
|
@@ -9671,7 +9746,7 @@
|
|
|
9671
9746
|
if (!(error instanceof ParseError)) {
|
|
9672
9747
|
throw error;
|
|
9673
9748
|
}
|
|
9674
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
9749
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
9675
9750
|
Invalid ${commandName} command:
|
|
9676
9751
|
|
|
9677
9752
|
Your command:
|
|
@@ -9937,6 +10012,48 @@
|
|
|
9937
10012
|
const SUPPORTED_SCRIPT_LANGUAGES = ['javascript', 'typescript', 'python'];
|
|
9938
10013
|
// <- TODO: [🏥] DRY
|
|
9939
10014
|
|
|
10015
|
+
/**
|
|
10016
|
+
* Number of padding lines to add at the end of the book content
|
|
10017
|
+
*
|
|
10018
|
+
* @public exported from `@promptbook/core`
|
|
10019
|
+
*/
|
|
10020
|
+
const PADDING_LINES = 11;
|
|
10021
|
+
/**
|
|
10022
|
+
* A function that adds padding to the book content
|
|
10023
|
+
*
|
|
10024
|
+
* Note: [🔂] This function is idempotent.
|
|
10025
|
+
*
|
|
10026
|
+
* @public exported from `@promptbook/core`
|
|
10027
|
+
*/
|
|
10028
|
+
function padBook(content) {
|
|
10029
|
+
if (!content) {
|
|
10030
|
+
return '\n'.repeat(PADDING_LINES);
|
|
10031
|
+
}
|
|
10032
|
+
const lines = content.split('\n');
|
|
10033
|
+
let trailingEmptyLines = 0;
|
|
10034
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
10035
|
+
const line = lines[i];
|
|
10036
|
+
if (line === undefined) {
|
|
10037
|
+
// Note: This should not happen in reality, but it's here to satisfy TypeScript's noUncheckedIndexedAccess option
|
|
10038
|
+
continue;
|
|
10039
|
+
}
|
|
10040
|
+
if (line.trim() === '') {
|
|
10041
|
+
trailingEmptyLines++;
|
|
10042
|
+
}
|
|
10043
|
+
else {
|
|
10044
|
+
break;
|
|
10045
|
+
}
|
|
10046
|
+
}
|
|
10047
|
+
if (trailingEmptyLines >= PADDING_LINES) {
|
|
10048
|
+
return content;
|
|
10049
|
+
}
|
|
10050
|
+
const linesToAdd = PADDING_LINES - trailingEmptyLines;
|
|
10051
|
+
return (content + '\n'.repeat(linesToAdd));
|
|
10052
|
+
}
|
|
10053
|
+
/**
|
|
10054
|
+
* TODO: [🧠] Maybe export
|
|
10055
|
+
*/
|
|
10056
|
+
|
|
9940
10057
|
/**
|
|
9941
10058
|
* Removes Markdown (or HTML) comments
|
|
9942
10059
|
*
|
|
@@ -9945,7 +10062,7 @@
|
|
|
9945
10062
|
* @public exported from `@promptbook/markdown-utils`
|
|
9946
10063
|
*/
|
|
9947
10064
|
function removeMarkdownComments(content) {
|
|
9948
|
-
return spaceTrim.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
|
|
10065
|
+
return spaceTrim$1.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
|
|
9949
10066
|
}
|
|
9950
10067
|
|
|
9951
10068
|
/**
|
|
@@ -9982,6 +10099,7 @@
|
|
|
9982
10099
|
if (!isFlatPipeline(pipelineString)) {
|
|
9983
10100
|
return pipelineString;
|
|
9984
10101
|
}
|
|
10102
|
+
pipelineString = spaceTrim__default["default"](pipelineString);
|
|
9985
10103
|
const pipelineStringLines = pipelineString.split('\n');
|
|
9986
10104
|
const potentialReturnStatement = pipelineStringLines.pop();
|
|
9987
10105
|
let returnStatement;
|
|
@@ -10016,7 +10134,7 @@
|
|
|
10016
10134
|
${returnStatement}
|
|
10017
10135
|
`));
|
|
10018
10136
|
// <- TODO: Maybe use book` notation
|
|
10019
|
-
return pipelineString;
|
|
10137
|
+
return padBook(pipelineString);
|
|
10020
10138
|
}
|
|
10021
10139
|
/**
|
|
10022
10140
|
* TODO: Unit test
|
|
@@ -10260,7 +10378,7 @@
|
|
|
10260
10378
|
if (pipelineString.startsWith('#!')) {
|
|
10261
10379
|
const [shebangLine, ...restLines] = pipelineString.split('\n');
|
|
10262
10380
|
if (!(shebangLine || '').includes('ptbk')) {
|
|
10263
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
10381
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
10264
10382
|
It seems that you try to parse a book file which has non-standard shebang line for book files:
|
|
10265
10383
|
Shebang line must contain 'ptbk'
|
|
10266
10384
|
|
|
@@ -10276,7 +10394,7 @@
|
|
|
10276
10394
|
pipelineString = validatePipelineString(restLines.join('\n'));
|
|
10277
10395
|
}
|
|
10278
10396
|
pipelineString = removeMarkdownComments(pipelineString);
|
|
10279
|
-
pipelineString = spaceTrim.spaceTrim(pipelineString);
|
|
10397
|
+
pipelineString = spaceTrim$1.spaceTrim(pipelineString);
|
|
10280
10398
|
// <- TODO: [😧] `spaceTrim` should preserve discriminated type *(or at lease `PipelineString`)*
|
|
10281
10399
|
pipelineString = deflatePipeline(pipelineString);
|
|
10282
10400
|
// ==============
|
|
@@ -10288,7 +10406,7 @@
|
|
|
10288
10406
|
// ==============
|
|
10289
10407
|
// Note: 1️⃣◽4️⃣ Check markdown structure
|
|
10290
10408
|
if (pipelineHead === undefined) {
|
|
10291
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
10409
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
10292
10410
|
Pipeline head is not defined
|
|
10293
10411
|
|
|
10294
10412
|
${block(getPipelineIdentification())}
|
|
@@ -10297,7 +10415,7 @@
|
|
|
10297
10415
|
`));
|
|
10298
10416
|
}
|
|
10299
10417
|
if (pipelineHead.level !== 1) {
|
|
10300
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
10418
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
10301
10419
|
Pipeline head is not h1
|
|
10302
10420
|
|
|
10303
10421
|
${block(getPipelineIdentification())}
|
|
@@ -10306,7 +10424,7 @@
|
|
|
10306
10424
|
`));
|
|
10307
10425
|
}
|
|
10308
10426
|
if (!pipelineSections.every((section) => section.level === 2)) {
|
|
10309
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
10427
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
10310
10428
|
Not every pipeline section is h2
|
|
10311
10429
|
|
|
10312
10430
|
${block(getPipelineIdentification())}
|
|
@@ -10319,7 +10437,7 @@
|
|
|
10319
10437
|
const defineParam = (parameterCommand) => {
|
|
10320
10438
|
const { parameterName, parameterDescription, isInput, isOutput } = parameterCommand;
|
|
10321
10439
|
if (RESERVED_PARAMETER_NAMES.includes(parameterName)) {
|
|
10322
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
10440
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
10323
10441
|
Parameter name {${parameterName}} is reserved and cannot be used as resulting parameter name
|
|
10324
10442
|
|
|
10325
10443
|
${block(getPipelineIdentification())}
|
|
@@ -10330,7 +10448,7 @@
|
|
|
10330
10448
|
existingParameter.description &&
|
|
10331
10449
|
existingParameter.description !== parameterDescription &&
|
|
10332
10450
|
parameterDescription) {
|
|
10333
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
10451
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
10334
10452
|
Parameter \`{${parameterName}}\` is defined multiple times with different description:
|
|
10335
10453
|
|
|
10336
10454
|
${block(getPipelineIdentification())}
|
|
@@ -10368,7 +10486,7 @@
|
|
|
10368
10486
|
description = description.split(/^>.*$/gm).join('');
|
|
10369
10487
|
//Note: Remove lists and return statement - TODO: [🎾] Make util (exported from `@promptbool/utils`)
|
|
10370
10488
|
description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
|
|
10371
|
-
description = spaceTrim.spaceTrim(description);
|
|
10489
|
+
description = spaceTrim$1.spaceTrim(description);
|
|
10372
10490
|
if (description === '') {
|
|
10373
10491
|
description = undefined;
|
|
10374
10492
|
}
|
|
@@ -10379,7 +10497,7 @@
|
|
|
10379
10497
|
const command = parseCommand(listItem, 'PIPELINE_HEAD');
|
|
10380
10498
|
const commandParser = getParserForCommand(command);
|
|
10381
10499
|
if (commandParser.isUsedInPipelineHead !== true /* <- Note: [🦦][4] */) {
|
|
10382
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
10500
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
10383
10501
|
Command \`${command.type}\` is not allowed in the head of the pipeline ONLY at the pipeline task
|
|
10384
10502
|
|
|
10385
10503
|
${block(getPipelineIdentification())}
|
|
@@ -10393,7 +10511,7 @@
|
|
|
10393
10511
|
if (!(error instanceof ParseError)) {
|
|
10394
10512
|
throw error;
|
|
10395
10513
|
}
|
|
10396
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
10514
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
10397
10515
|
Command ${command.type} failed to apply to the pipeline
|
|
10398
10516
|
|
|
10399
10517
|
The error:
|
|
@@ -10446,7 +10564,7 @@
|
|
|
10446
10564
|
description = description.split(/^>.*$/gm).join('');
|
|
10447
10565
|
//Note: Remove lists and return statement - TODO: [🎾]
|
|
10448
10566
|
description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
|
|
10449
|
-
description = spaceTrim.spaceTrim(description);
|
|
10567
|
+
description = spaceTrim$1.spaceTrim(description);
|
|
10450
10568
|
if (description === '') {
|
|
10451
10569
|
description = undefined;
|
|
10452
10570
|
}
|
|
@@ -10480,7 +10598,7 @@
|
|
|
10480
10598
|
for (const { listItem, command } of commands) {
|
|
10481
10599
|
const commandParser = getParserForCommand(command);
|
|
10482
10600
|
if (commandParser.isUsedInPipelineTask !== true /* <- Note: [🦦][4] */) {
|
|
10483
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
10601
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
10484
10602
|
Command \`${command.type}\` is not allowed in the task of the promptbook ONLY at the pipeline head
|
|
10485
10603
|
|
|
10486
10604
|
${block(getPipelineIdentification())}
|
|
@@ -10495,7 +10613,7 @@
|
|
|
10495
10613
|
if (!(error instanceof ParseError)) {
|
|
10496
10614
|
throw error;
|
|
10497
10615
|
}
|
|
10498
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
10616
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
10499
10617
|
Command \`${command.type}\` failed to apply to the task
|
|
10500
10618
|
|
|
10501
10619
|
The error:
|
|
@@ -10526,14 +10644,14 @@
|
|
|
10526
10644
|
// TODO: [🍧] Should be done in SECTION command
|
|
10527
10645
|
if ($taskJson.taskType === 'SCRIPT_TASK') {
|
|
10528
10646
|
if (!language) {
|
|
10529
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
10647
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
10530
10648
|
You must specify the language of the script in the \`SCRIPT\` task
|
|
10531
10649
|
|
|
10532
10650
|
${block(getPipelineIdentification())}
|
|
10533
10651
|
`));
|
|
10534
10652
|
}
|
|
10535
10653
|
if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
|
|
10536
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
10654
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
10537
10655
|
Script language ${language} is not supported.
|
|
10538
10656
|
|
|
10539
10657
|
Supported languages are:
|
|
@@ -10829,11 +10947,11 @@
|
|
|
10829
10947
|
console.warn(`Command "${humanReadableCommand}" exited with code ${code}`);
|
|
10830
10948
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
10831
10949
|
}
|
|
10832
|
-
resolve(spaceTrim.spaceTrim(output.join('\n')));
|
|
10950
|
+
resolve(spaceTrim$1.spaceTrim(output.join('\n')));
|
|
10833
10951
|
}
|
|
10834
10952
|
}
|
|
10835
10953
|
else {
|
|
10836
|
-
resolve(spaceTrim.spaceTrim(output.join('\n')));
|
|
10954
|
+
resolve(spaceTrim$1.spaceTrim(output.join('\n')));
|
|
10837
10955
|
}
|
|
10838
10956
|
};
|
|
10839
10957
|
commandProcess.on('close', finishWithCode);
|
|
@@ -10851,7 +10969,7 @@
|
|
|
10851
10969
|
console.warn(error);
|
|
10852
10970
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
10853
10971
|
}
|
|
10854
|
-
resolve(spaceTrim.spaceTrim(output.join('\n')));
|
|
10972
|
+
resolve(spaceTrim$1.spaceTrim(output.join('\n')));
|
|
10855
10973
|
}
|
|
10856
10974
|
});
|
|
10857
10975
|
}
|
|
@@ -10904,6 +11022,7 @@
|
|
|
10904
11022
|
writeFile: promises.writeFile,
|
|
10905
11023
|
readdir: promises.readdir,
|
|
10906
11024
|
mkdir: promises.mkdir,
|
|
11025
|
+
watch: promises.watch,
|
|
10907
11026
|
};
|
|
10908
11027
|
}
|
|
10909
11028
|
/**
|
|
@@ -11191,10 +11310,10 @@
|
|
|
11191
11310
|
var _a, _b;
|
|
11192
11311
|
const isMetadataAviailable = $llmToolsMetadataRegister
|
|
11193
11312
|
.list()
|
|
11194
|
-
.
|
|
11313
|
+
.some(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
|
|
11195
11314
|
const isInstalled = $llmToolsRegister
|
|
11196
11315
|
.list()
|
|
11197
|
-
.
|
|
11316
|
+
.some(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
|
|
11198
11317
|
const isFullyConfigured = ((_a = metadata.envVariables) === null || _a === void 0 ? void 0 : _a.every((envVariableName) => env[envVariableName] !== undefined)) || false;
|
|
11199
11318
|
const isPartiallyConfigured = ((_b = metadata.envVariables) === null || _b === void 0 ? void 0 : _b.some((envVariableName) => env[envVariableName] !== undefined)) || false;
|
|
11200
11319
|
// <- Note: [🗨]
|
|
@@ -11622,6 +11741,9 @@
|
|
|
11622
11741
|
}
|
|
11623
11742
|
|
|
11624
11743
|
/**
|
|
11744
|
+
* Normalizes a given text to PascalCase format.
|
|
11745
|
+
*
|
|
11746
|
+
* Note: [🔂] This function is idempotent.
|
|
11625
11747
|
*
|
|
11626
11748
|
* @param text @public exported from `@promptbook/utils`
|
|
11627
11749
|
* @returns
|
|
@@ -11662,7 +11784,7 @@
|
|
|
11662
11784
|
let trimmedText = text;
|
|
11663
11785
|
// Remove leading and trailing spaces and newlines
|
|
11664
11786
|
if (isTrimmed) {
|
|
11665
|
-
trimmedText = spaceTrim.spaceTrim(trimmedText);
|
|
11787
|
+
trimmedText = spaceTrim$1.spaceTrim(trimmedText);
|
|
11666
11788
|
}
|
|
11667
11789
|
let processedText = trimmedText;
|
|
11668
11790
|
if (isIntroduceSentenceRemoved) {
|
|
@@ -11671,7 +11793,7 @@
|
|
|
11671
11793
|
// Remove the introduce sentence and quotes by replacing it with an empty string
|
|
11672
11794
|
processedText = processedText.replace(introduceSentenceRegex, '');
|
|
11673
11795
|
}
|
|
11674
|
-
processedText = spaceTrim.spaceTrim(processedText);
|
|
11796
|
+
processedText = spaceTrim$1.spaceTrim(processedText);
|
|
11675
11797
|
}
|
|
11676
11798
|
if (processedText.length < 3) {
|
|
11677
11799
|
return trimmedText;
|
|
@@ -11778,13 +11900,13 @@
|
|
|
11778
11900
|
* @public exported from `@promptbook/markdown-utils`
|
|
11779
11901
|
*/
|
|
11780
11902
|
function trimCodeBlock(value) {
|
|
11781
|
-
value = spaceTrim.spaceTrim(value);
|
|
11903
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
11782
11904
|
if (!/^```[a-z]*(.*)```$/is.test(value)) {
|
|
11783
11905
|
return value;
|
|
11784
11906
|
}
|
|
11785
11907
|
value = value.replace(/^```[a-z]*/i, '');
|
|
11786
11908
|
value = value.replace(/```$/i, '');
|
|
11787
|
-
value = spaceTrim.spaceTrim(value);
|
|
11909
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
11788
11910
|
return value;
|
|
11789
11911
|
}
|
|
11790
11912
|
|
|
@@ -11797,9 +11919,9 @@
|
|
|
11797
11919
|
* @public exported from `@promptbook/markdown-utils`
|
|
11798
11920
|
*/
|
|
11799
11921
|
function trimEndOfCodeBlock(value) {
|
|
11800
|
-
value = spaceTrim.spaceTrim(value);
|
|
11922
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
11801
11923
|
value = value.replace(/```$/g, '');
|
|
11802
|
-
value = spaceTrim.spaceTrim(value);
|
|
11924
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
11803
11925
|
return value;
|
|
11804
11926
|
}
|
|
11805
11927
|
|
|
@@ -12088,7 +12210,7 @@
|
|
|
12088
12210
|
* @param path
|
|
12089
12211
|
* @param isRecursive
|
|
12090
12212
|
* @returns List of all files in the directory
|
|
12091
|
-
* @private internal function of `
|
|
12213
|
+
* @private internal function of `AgentCollectionInDirectory` and `createPipelineCollectionFromDirectory`
|
|
12092
12214
|
*/
|
|
12093
12215
|
async function listAllFiles(path$1, isRecursive, fs) {
|
|
12094
12216
|
if (!(await isDirectoryExisting(path$1, fs))) {
|
|
@@ -12116,26 +12238,27 @@
|
|
|
12116
12238
|
*/
|
|
12117
12239
|
|
|
12118
12240
|
/**
|
|
12119
|
-
* Constructs
|
|
12241
|
+
* Constructs `PipelineCollection` from async sources
|
|
12242
|
+
*
|
|
12120
12243
|
* It can be one of the following:
|
|
12121
12244
|
* - Promise of array of PipelineJson or PipelineString
|
|
12122
12245
|
* - Factory function that returns Promise of array of PipelineJson or PipelineString
|
|
12123
12246
|
*
|
|
12124
12247
|
* Note: This is useful as internal tool for other constructor functions like
|
|
12125
|
-
* `
|
|
12248
|
+
* `createPipelineCollectionFromUrl` or `createPipelineCollectionFromDirectory`
|
|
12126
12249
|
* Consider using those functions instead of this one
|
|
12127
12250
|
*
|
|
12128
12251
|
* Note: The function does NOT return promise it returns the collection directly which waits for the sources to be resolved
|
|
12129
12252
|
* when error occurs in given promise or factory function, it is thrown during `listPipelines` or `getPipelineByUrl` call
|
|
12130
12253
|
*
|
|
12131
|
-
* Note: Consider using `
|
|
12254
|
+
* Note: Consider using `createPipelineCollectionFromDirectory` or `createPipelineCollectionFromUrl`
|
|
12132
12255
|
*
|
|
12133
12256
|
* @param promptbookSourcesPromiseOrFactory
|
|
12134
12257
|
* @returns PipelineCollection
|
|
12135
12258
|
* @deprecated Do not use, it will became internal tool for other constructor functions
|
|
12136
12259
|
* @public exported from `@promptbook/core`
|
|
12137
12260
|
*/
|
|
12138
|
-
function
|
|
12261
|
+
function createPipelineCollectionFromPromise(promptbookSourcesPromiseOrFactory) {
|
|
12139
12262
|
let collection = null;
|
|
12140
12263
|
async function load() {
|
|
12141
12264
|
if (collection !== null) {
|
|
@@ -12146,7 +12269,7 @@
|
|
|
12146
12269
|
promptbookSourcesPromiseOrFactory = promptbookSourcesPromiseOrFactory();
|
|
12147
12270
|
}
|
|
12148
12271
|
const promptbookSources = await promptbookSourcesPromiseOrFactory;
|
|
12149
|
-
collection =
|
|
12272
|
+
collection = createPipelineCollectionFromJson(...promptbookSources);
|
|
12150
12273
|
}
|
|
12151
12274
|
async function listPipelines() {
|
|
12152
12275
|
await load();
|
|
@@ -12168,7 +12291,7 @@
|
|
|
12168
12291
|
}
|
|
12169
12292
|
|
|
12170
12293
|
/**
|
|
12171
|
-
* Constructs
|
|
12294
|
+
* Constructs `PipelineCollection` from given directory
|
|
12172
12295
|
*
|
|
12173
12296
|
* Note: Works only in Node.js environment because it reads the file system
|
|
12174
12297
|
*
|
|
@@ -12178,7 +12301,7 @@
|
|
|
12178
12301
|
* @returns PipelineCollection
|
|
12179
12302
|
* @public exported from `@promptbook/node`
|
|
12180
12303
|
*/
|
|
12181
|
-
async function
|
|
12304
|
+
async function createPipelineCollectionFromDirectory(rootPath, tools, options) {
|
|
12182
12305
|
if (tools === undefined) {
|
|
12183
12306
|
tools = await $provideExecutionToolsForNode();
|
|
12184
12307
|
}
|
|
@@ -12197,7 +12320,7 @@
|
|
|
12197
12320
|
// TODO: [🌗]
|
|
12198
12321
|
}
|
|
12199
12322
|
const { isRecursive = true, isVerbose = DEFAULT_IS_VERBOSE, isLazyLoaded = false, isCrashedOnError = true, rootUrl, } = options || {};
|
|
12200
|
-
const collection =
|
|
12323
|
+
const collection = createPipelineCollectionFromPromise(async () => {
|
|
12201
12324
|
if (isVerbose) {
|
|
12202
12325
|
console.info(colors__default["default"].cyan(`Creating pipeline collection from path ${rootPath.split('\\').join('/')}`));
|
|
12203
12326
|
}
|
|
@@ -12360,7 +12483,7 @@
|
|
|
12360
12483
|
return collection;
|
|
12361
12484
|
}
|
|
12362
12485
|
/**
|
|
12363
|
-
* TODO: [🖇] What about symlinks? Maybe option isSymlinksFollowed
|
|
12486
|
+
* TODO: [🖇] What about symlinks? Maybe option `isSymlinksFollowed`
|
|
12364
12487
|
* TODO: Maybe move from `@promptbook/node` to `@promptbook/core` as we removes direct dependency on `fs`
|
|
12365
12488
|
*/
|
|
12366
12489
|
|
|
@@ -12537,7 +12660,7 @@
|
|
|
12537
12660
|
exports.BOOK_LANGUAGE_VERSION = BOOK_LANGUAGE_VERSION;
|
|
12538
12661
|
exports.FileCacheStorage = FileCacheStorage;
|
|
12539
12662
|
exports.PROMPTBOOK_ENGINE_VERSION = PROMPTBOOK_ENGINE_VERSION;
|
|
12540
|
-
exports.
|
|
12663
|
+
exports.createPipelineCollectionFromDirectory = createPipelineCollectionFromDirectory;
|
|
12541
12664
|
|
|
12542
12665
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
12543
12666
|
|