@promptbook/node 0.103.0-9 → 0.103.0
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 +92 -66
- package/esm/index.es.js +373 -232
- 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 +22 -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 +70 -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 +20 -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 +6 -1
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +85 -14
- package/esm/typings/src/book-components/BookEditor/BookEditorActionbar.d.ts +18 -0
- package/esm/typings/src/book-components/BookEditor/BookEditorMonaco.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.d.ts +17 -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 +16 -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 +1 -1
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentIntegration.d.ts +52 -0
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentSeamlessIntegration.d.ts +14 -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 +2 -2
- package/esm/typings/src/book-components/_common/Tooltip/Tooltip.d.ts +47 -0
- package/esm/typings/src/book-components/icons/AboutIcon.d.ts +9 -0
- package/esm/typings/src/book-components/icons/CameraIcon.d.ts +11 -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/book-components/icons/SendIcon.d.ts +3 -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 +39 -0
- package/esm/typings/src/commitments/CLOSED/CLOSED.test.d.ts +4 -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 +42 -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 +14 -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 +26 -2
- package/esm/typings/src/execution/PromptResult.d.ts +7 -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 +72 -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/ollama/OllamaExecutionTools.d.ts +4 -0
- 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/OpenAiCompatibleExecutionTools.d.ts +13 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +4 -0
- package/esm/typings/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +6 -6
- 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/ModelRequirements.d.ts +13 -1
- package/esm/typings/src/types/ModelVariant.d.ts +1 -1
- package/esm/typings/src/types/Prompt.d.ts +13 -1
- package/esm/typings/src/types/Updatable.d.ts +19 -0
- package/esm/typings/src/types/typeAliases.d.ts +38 -2
- package/esm/typings/src/utils/color/$randomColor.d.ts +1 -0
- package/esm/typings/src/utils/color/Color.d.ts +16 -1
- 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 +31 -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/random/CzechNamePool.d.ts +7 -0
- package/esm/typings/src/utils/random/EnglishNamePool.d.ts +7 -0
- package/esm/typings/src/utils/random/NamePool.d.ts +17 -0
- package/esm/typings/src/utils/random/getNamePool.d.ts +10 -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 +8 -8
- package/umd/index.umd.js +381 -240
- 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/BookEditorWrapper.d.ts +0 -9
- 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/esm/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import colors from 'colors';
|
|
2
|
-
import { stat, access, constants, readFile, writeFile, readdir, mkdir, unlink } from 'fs/promises';
|
|
2
|
+
import { stat, access, constants, readFile, writeFile, readdir, mkdir, watch, unlink } from 'fs/promises';
|
|
3
3
|
import { basename, join, dirname, isAbsolute, relative } from 'path';
|
|
4
|
-
import spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
4
|
+
import spaceTrim$2, { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
5
5
|
import JSZip from 'jszip';
|
|
6
6
|
import { randomBytes } from 'crypto';
|
|
7
7
|
import { Subject } from 'rxjs';
|
|
@@ -21,19 +21,30 @@ import * as dotenv from 'dotenv';
|
|
|
21
21
|
* @generated
|
|
22
22
|
* @see https://github.com/webgptorg/book
|
|
23
23
|
*/
|
|
24
|
-
const BOOK_LANGUAGE_VERSION = '
|
|
24
|
+
const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
25
25
|
/**
|
|
26
26
|
* The version of the Promptbook engine
|
|
27
27
|
*
|
|
28
28
|
* @generated
|
|
29
29
|
* @see https://github.com/webgptorg/promptbook
|
|
30
30
|
*/
|
|
31
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0
|
|
31
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0';
|
|
32
32
|
/**
|
|
33
33
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
34
34
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Trims string from all 4 sides
|
|
39
|
+
*
|
|
40
|
+
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
41
|
+
* Developed by same author @hejny as this package
|
|
42
|
+
*
|
|
43
|
+
* @public exported from `@promptbook/utils`
|
|
44
|
+
* @see https://github.com/hejny/spacetrim#usage
|
|
45
|
+
*/
|
|
46
|
+
const spaceTrim = spaceTrim$1;
|
|
47
|
+
|
|
37
48
|
/**
|
|
38
49
|
* @private util of `@promptbook/color`
|
|
39
50
|
* @de
|
|
@@ -82,6 +93,7 @@ function take(initialValue) {
|
|
|
82
93
|
* @public exported from `@promptbook/color`
|
|
83
94
|
*/
|
|
84
95
|
const CSS_COLORS = {
|
|
96
|
+
promptbook: '#79EAFD',
|
|
85
97
|
transparent: 'rgba(0,0,0,0)',
|
|
86
98
|
aliceblue: '#f0f8ff',
|
|
87
99
|
antiquewhite: '#faebd7',
|
|
@@ -263,9 +275,6 @@ function checkChannelValue(channelName, value) {
|
|
|
263
275
|
throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
|
|
264
276
|
}
|
|
265
277
|
}
|
|
266
|
-
/**
|
|
267
|
-
* TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
|
|
268
|
-
*/
|
|
269
278
|
|
|
270
279
|
/**
|
|
271
280
|
* Color object represents an RGB color with alpha channel
|
|
@@ -285,21 +294,61 @@ class Color {
|
|
|
285
294
|
* @param color
|
|
286
295
|
* @returns Color object
|
|
287
296
|
*/
|
|
288
|
-
static from(color) {
|
|
289
|
-
if (color
|
|
297
|
+
static from(color, _isSingleValue = false) {
|
|
298
|
+
if (color === '') {
|
|
299
|
+
throw new Error(`Can not create color from empty string`);
|
|
300
|
+
}
|
|
301
|
+
else if (color instanceof Color) {
|
|
290
302
|
return take(color);
|
|
291
303
|
}
|
|
292
304
|
else if (Color.isColor(color)) {
|
|
293
305
|
return take(color);
|
|
294
306
|
}
|
|
295
307
|
else if (typeof color === 'string') {
|
|
296
|
-
|
|
308
|
+
try {
|
|
309
|
+
return Color.fromString(color);
|
|
310
|
+
}
|
|
311
|
+
catch (error) {
|
|
312
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
313
|
+
if (_isSingleValue) {
|
|
314
|
+
throw error;
|
|
315
|
+
}
|
|
316
|
+
const parts = color.split(/[\s+,;|]/);
|
|
317
|
+
if (parts.length > 0) {
|
|
318
|
+
return Color.from(parts[0].trim(), true);
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
throw new Error(`Can not create color from given string "${color}"`);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
297
324
|
}
|
|
298
325
|
else {
|
|
299
326
|
console.error({ color });
|
|
300
327
|
throw new Error(`Can not create color from given object`);
|
|
301
328
|
}
|
|
302
329
|
}
|
|
330
|
+
/**
|
|
331
|
+
* Creates a new Color instance from miscellaneous formats
|
|
332
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
333
|
+
*
|
|
334
|
+
* @param color
|
|
335
|
+
* @returns Color object
|
|
336
|
+
*/
|
|
337
|
+
static fromSafe(color) {
|
|
338
|
+
try {
|
|
339
|
+
return Color.from(color);
|
|
340
|
+
}
|
|
341
|
+
catch (error) {
|
|
342
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
343
|
+
console.warn(spaceTrim((block) => `
|
|
344
|
+
Color.fromSafe error:
|
|
345
|
+
${block(error.message)}
|
|
346
|
+
|
|
347
|
+
Returning default PROMPTBOOK_COLOR.
|
|
348
|
+
`));
|
|
349
|
+
return Color.fromString('promptbook');
|
|
350
|
+
}
|
|
351
|
+
}
|
|
303
352
|
/**
|
|
304
353
|
* Creates a new Color instance from miscellaneous string formats
|
|
305
354
|
*
|
|
@@ -367,6 +416,9 @@ class Color {
|
|
|
367
416
|
if (hex.length === 3) {
|
|
368
417
|
return Color.fromHex3(hex);
|
|
369
418
|
}
|
|
419
|
+
if (hex.length === 4) {
|
|
420
|
+
return Color.fromHex4(hex);
|
|
421
|
+
}
|
|
370
422
|
if (hex.length === 6) {
|
|
371
423
|
return Color.fromHex6(hex);
|
|
372
424
|
}
|
|
@@ -387,6 +439,19 @@ class Color {
|
|
|
387
439
|
const b = parseInt(hex.substr(2, 1), 16) * 16;
|
|
388
440
|
return take(new Color(r, g, b));
|
|
389
441
|
}
|
|
442
|
+
/**
|
|
443
|
+
* Creates a new Color instance from color in hex format with 4 digits (with alpha channel)
|
|
444
|
+
*
|
|
445
|
+
* @param color in hex for example `09df`
|
|
446
|
+
* @returns Color object
|
|
447
|
+
*/
|
|
448
|
+
static fromHex4(hex) {
|
|
449
|
+
const r = parseInt(hex.substr(0, 1), 16) * 16;
|
|
450
|
+
const g = parseInt(hex.substr(1, 1), 16) * 16;
|
|
451
|
+
const b = parseInt(hex.substr(2, 1), 16) * 16;
|
|
452
|
+
const a = parseInt(hex.substr(3, 1), 16) * 16;
|
|
453
|
+
return take(new Color(r, g, b, a));
|
|
454
|
+
}
|
|
390
455
|
/**
|
|
391
456
|
* Creates a new Color instance from color in hex format with 6 color digits (without alpha channel)
|
|
392
457
|
*
|
|
@@ -577,7 +642,8 @@ class Color {
|
|
|
577
642
|
* @returns true if the value is a valid hex color string (e.g., `#009edd`, `#fff`, etc.)
|
|
578
643
|
*/
|
|
579
644
|
static isHexColorString(value) {
|
|
580
|
-
return typeof value === 'string' &&
|
|
645
|
+
return (typeof value === 'string' &&
|
|
646
|
+
/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value));
|
|
581
647
|
}
|
|
582
648
|
/**
|
|
583
649
|
* Creates new Color object
|
|
@@ -692,6 +758,23 @@ class Color {
|
|
|
692
758
|
* TODO: Maybe connect with textures
|
|
693
759
|
*/
|
|
694
760
|
|
|
761
|
+
/**
|
|
762
|
+
* Makes color transformer which returns a grayscale version of the color
|
|
763
|
+
*
|
|
764
|
+
* @param amount from 0 to 1
|
|
765
|
+
*
|
|
766
|
+
* @public exported from `@promptbook/color`
|
|
767
|
+
*/
|
|
768
|
+
function grayscale(amount) {
|
|
769
|
+
return ({ red, green, blue, alpha }) => {
|
|
770
|
+
const average = (red + green + blue) / 3;
|
|
771
|
+
red = Math.round(average * amount + red * (1 - amount));
|
|
772
|
+
green = Math.round(average * amount + green * (1 - amount));
|
|
773
|
+
blue = Math.round(average * amount + blue * (1 - amount));
|
|
774
|
+
return Color.fromValues(red, green, blue, alpha);
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
|
|
695
778
|
/**
|
|
696
779
|
* Converts HSL values to RGB values
|
|
697
780
|
*
|
|
@@ -807,102 +890,6 @@ function lighten(amount) {
|
|
|
807
890
|
* TODO: Maybe implement by mix+hsl
|
|
808
891
|
*/
|
|
809
892
|
|
|
810
|
-
/**
|
|
811
|
-
* Calculates distance between two colors
|
|
812
|
-
*
|
|
813
|
-
* @param color1 first color
|
|
814
|
-
* @param color2 second color
|
|
815
|
-
*
|
|
816
|
-
* Note: This function is inefficient. Use colorDistanceSquared instead if possible.
|
|
817
|
-
*
|
|
818
|
-
* @public exported from `@promptbook/color`
|
|
819
|
-
*/
|
|
820
|
-
/**
|
|
821
|
-
* Calculates distance between two colors without square root
|
|
822
|
-
*
|
|
823
|
-
* @param color1 first color
|
|
824
|
-
* @param color2 second color
|
|
825
|
-
*
|
|
826
|
-
* @public exported from `@promptbook/color`
|
|
827
|
-
*/
|
|
828
|
-
function colorDistanceSquared(color1, color2) {
|
|
829
|
-
const rmean = (color1.red + color2.red) / 2;
|
|
830
|
-
const r = color1.red - color2.red;
|
|
831
|
-
const g = color1.green - color2.green;
|
|
832
|
-
const b = color1.blue - color2.blue;
|
|
833
|
-
const weightR = 2 + rmean / 256;
|
|
834
|
-
const weightG = 4.0;
|
|
835
|
-
const weightB = 2 + (255 - rmean) / 256;
|
|
836
|
-
const distance = weightR * r * r + weightG * g * g + weightB * b * b;
|
|
837
|
-
return distance;
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
/**
|
|
841
|
-
* Makes color transformer which finds the nearest color from the given list
|
|
842
|
-
*
|
|
843
|
-
* @param colors array of colors to choose from
|
|
844
|
-
*
|
|
845
|
-
* @public exported from `@promptbook/color`
|
|
846
|
-
*/
|
|
847
|
-
function nearest(...colors) {
|
|
848
|
-
return (color) => {
|
|
849
|
-
const distances = colors.map((c) => colorDistanceSquared(c, color));
|
|
850
|
-
const minDistance = Math.min(...distances);
|
|
851
|
-
const minIndex = distances.indexOf(minDistance);
|
|
852
|
-
const nearestColor = colors[minIndex];
|
|
853
|
-
return nearestColor;
|
|
854
|
-
};
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
/**
|
|
858
|
-
* Color transformer which returns the negative color
|
|
859
|
-
*
|
|
860
|
-
* @public exported from `@promptbook/color`
|
|
861
|
-
*/
|
|
862
|
-
function negative(color) {
|
|
863
|
-
const r = 255 - color.red;
|
|
864
|
-
const g = 255 - color.green;
|
|
865
|
-
const b = 255 - color.blue;
|
|
866
|
-
return Color.fromValues(r, g, b, color.alpha);
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
/**
|
|
870
|
-
* Makes color transformer which finds the furthest color from the given list
|
|
871
|
-
*
|
|
872
|
-
* @param colors array of colors to choose from
|
|
873
|
-
*
|
|
874
|
-
* @public exported from `@promptbook/color`
|
|
875
|
-
*/
|
|
876
|
-
function furthest(...colors) {
|
|
877
|
-
return (color) => {
|
|
878
|
-
const furthestColor = negative(nearest(...colors.map(negative))(color));
|
|
879
|
-
return furthestColor;
|
|
880
|
-
};
|
|
881
|
-
}
|
|
882
|
-
/**
|
|
883
|
-
* Makes color transformer which finds the best text color (black or white) for the given background color
|
|
884
|
-
*
|
|
885
|
-
* @public exported from `@promptbook/color`
|
|
886
|
-
*/
|
|
887
|
-
furthest(Color.get('white'), Color.from('black'));
|
|
888
|
-
|
|
889
|
-
/**
|
|
890
|
-
* Makes color transformer which returns a grayscale version of the color
|
|
891
|
-
*
|
|
892
|
-
* @param amount from 0 to 1
|
|
893
|
-
*
|
|
894
|
-
* @public exported from `@promptbook/color`
|
|
895
|
-
*/
|
|
896
|
-
function grayscale(amount) {
|
|
897
|
-
return ({ red, green, blue, alpha }) => {
|
|
898
|
-
const average = (red + green + blue) / 3;
|
|
899
|
-
red = Math.round(average * amount + red * (1 - amount));
|
|
900
|
-
green = Math.round(average * amount + green * (1 - amount));
|
|
901
|
-
blue = Math.round(average * amount + blue * (1 - amount));
|
|
902
|
-
return Color.fromValues(red, green, blue, alpha);
|
|
903
|
-
};
|
|
904
|
-
}
|
|
905
|
-
|
|
906
893
|
/**
|
|
907
894
|
* Makes color transformer which saturate the given color
|
|
908
895
|
*
|
|
@@ -971,16 +958,32 @@ const ADMIN_GITHUB_NAME = 'hejny';
|
|
|
971
958
|
*
|
|
972
959
|
* @public exported from `@promptbook/core`
|
|
973
960
|
*/
|
|
974
|
-
const PROMPTBOOK_COLOR = Color.
|
|
975
|
-
// <- TODO: [🧠] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
961
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
962
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
963
|
+
/**
|
|
964
|
+
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
965
|
+
*
|
|
966
|
+
* TODO: [🗽] Unite branding and make single place for it
|
|
967
|
+
*
|
|
968
|
+
* @public exported from `@promptbook/core`
|
|
969
|
+
*/
|
|
970
|
+
({
|
|
971
|
+
TITLE: Color.fromHex('#244EA8'),
|
|
972
|
+
LINE: Color.fromHex('#eeeeee'),
|
|
973
|
+
SEPARATOR: Color.fromHex('#cccccc'),
|
|
974
|
+
COMMITMENT: Color.fromHex('#DA0F78'),
|
|
975
|
+
PARAMETER: Color.fromHex('#8e44ad'),
|
|
976
|
+
});
|
|
977
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
976
978
|
/**
|
|
977
|
-
*
|
|
979
|
+
* Chat color of the Promptbook (in chat)
|
|
978
980
|
*
|
|
979
981
|
* TODO: [🗽] Unite branding and make single place for it
|
|
980
982
|
*
|
|
981
983
|
* @public exported from `@promptbook/core`
|
|
982
984
|
*/
|
|
983
985
|
PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
|
|
986
|
+
// <- TODO: [🧠][🈵] Using `Color` and `lighten`, `saturate`,... here increases the package size approx 3kb, maybe remove it
|
|
984
987
|
/**
|
|
985
988
|
* Color of the user (in chat)
|
|
986
989
|
*
|
|
@@ -989,6 +992,7 @@ PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
|
|
|
989
992
|
* @public exported from `@promptbook/core`
|
|
990
993
|
*/
|
|
991
994
|
Color.fromHex('#1D4ED8');
|
|
995
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
992
996
|
/**
|
|
993
997
|
* When the title is not provided, the default title is used
|
|
994
998
|
*
|
|
@@ -1087,7 +1091,7 @@ const DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [🤹♂️]
|
|
|
1087
1091
|
* @public exported from `@promptbook/core`
|
|
1088
1092
|
*/
|
|
1089
1093
|
const DEFAULT_MAX_EXECUTION_ATTEMPTS = 7; // <- TODO: [🤹♂️]
|
|
1090
|
-
// <- TODO: [🕝] Make also `
|
|
1094
|
+
// <- TODO: [🕝] Make also `AGENTS_DIRNAME_ALTERNATIVES`
|
|
1091
1095
|
// TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
|
|
1092
1096
|
/**
|
|
1093
1097
|
* Where to store the temporary downloads
|
|
@@ -1115,7 +1119,7 @@ TODO: [🌃]
|
|
|
1115
1119
|
ex-port const WIZARD_APP_ID: string_app_id = 'wizard';
|
|
1116
1120
|
*/
|
|
1117
1121
|
/**
|
|
1118
|
-
* The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `
|
|
1122
|
+
* The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createPipelineCollectionFromDirectory`
|
|
1119
1123
|
*
|
|
1120
1124
|
* @public exported from `@promptbook/core`
|
|
1121
1125
|
*/
|
|
@@ -1179,7 +1183,7 @@ true);
|
|
|
1179
1183
|
function getErrorReportUrl(error) {
|
|
1180
1184
|
const report = {
|
|
1181
1185
|
title: `🐜 Error report from ${NAME}`,
|
|
1182
|
-
body: spaceTrim((block) => `
|
|
1186
|
+
body: spaceTrim$2((block) => `
|
|
1183
1187
|
|
|
1184
1188
|
|
|
1185
1189
|
\`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
|
|
@@ -1252,7 +1256,7 @@ function jsonParse(value) {
|
|
|
1252
1256
|
}
|
|
1253
1257
|
else if (typeof value !== 'string') {
|
|
1254
1258
|
console.error('Can not parse JSON from non-string value.', { text: value });
|
|
1255
|
-
throw new Error(spaceTrim(`
|
|
1259
|
+
throw new Error(spaceTrim$2(`
|
|
1256
1260
|
Can not parse JSON from non-string value.
|
|
1257
1261
|
|
|
1258
1262
|
The value type: ${typeof value}
|
|
@@ -1266,7 +1270,7 @@ function jsonParse(value) {
|
|
|
1266
1270
|
if (!(error instanceof Error)) {
|
|
1267
1271
|
throw error;
|
|
1268
1272
|
}
|
|
1269
|
-
throw new Error(spaceTrim((block) => `
|
|
1273
|
+
throw new Error(spaceTrim$2((block) => `
|
|
1270
1274
|
${block(error.message)}
|
|
1271
1275
|
|
|
1272
1276
|
The expected JSON text:
|
|
@@ -1415,7 +1419,7 @@ function checkSerializableAsJson(options) {
|
|
|
1415
1419
|
}
|
|
1416
1420
|
else if (typeof value === 'object') {
|
|
1417
1421
|
if (value instanceof Date) {
|
|
1418
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
1422
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
1419
1423
|
\`${name}\` is Date
|
|
1420
1424
|
|
|
1421
1425
|
Use \`string_date_iso8601\` instead
|
|
@@ -1434,7 +1438,7 @@ function checkSerializableAsJson(options) {
|
|
|
1434
1438
|
throw new UnexpectedError(`${name} is RegExp`);
|
|
1435
1439
|
}
|
|
1436
1440
|
else if (value instanceof Error) {
|
|
1437
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
1441
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
1438
1442
|
\`${name}\` is unserialized Error
|
|
1439
1443
|
|
|
1440
1444
|
Use function \`serializeError\`
|
|
@@ -1457,7 +1461,7 @@ function checkSerializableAsJson(options) {
|
|
|
1457
1461
|
}
|
|
1458
1462
|
catch (error) {
|
|
1459
1463
|
assertsError(error);
|
|
1460
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
1464
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
1461
1465
|
\`${name}\` is not serializable
|
|
1462
1466
|
|
|
1463
1467
|
${block(error.stack || error.message)}
|
|
@@ -1489,7 +1493,7 @@ function checkSerializableAsJson(options) {
|
|
|
1489
1493
|
}
|
|
1490
1494
|
}
|
|
1491
1495
|
else {
|
|
1492
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
1496
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
1493
1497
|
\`${name}\` is unknown type
|
|
1494
1498
|
|
|
1495
1499
|
Additional message for \`${name}\`:
|
|
@@ -1519,7 +1523,7 @@ function deepClone(objectValue) {
|
|
|
1519
1523
|
TODO: [🧠] Is there a better implementation?
|
|
1520
1524
|
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1521
1525
|
> for (const propertyName of propertyNames) {
|
|
1522
|
-
> const value = (objectValue as
|
|
1526
|
+
> const value = (objectValue as chococake)[propertyName];
|
|
1523
1527
|
> if (value && typeof value === 'object') {
|
|
1524
1528
|
> deepClone(value);
|
|
1525
1529
|
> }
|
|
@@ -1770,6 +1774,8 @@ function isValidPipelineUrl(url) {
|
|
|
1770
1774
|
* - if it is valid json
|
|
1771
1775
|
* - if it is meaningful
|
|
1772
1776
|
*
|
|
1777
|
+
* Note: [🔂] This function is idempotent.
|
|
1778
|
+
*
|
|
1773
1779
|
* @param pipeline valid or invalid PipelineJson
|
|
1774
1780
|
* @returns the same pipeline if it is logically valid
|
|
1775
1781
|
* @throws {PipelineLogicError} on logical error in the pipeline
|
|
@@ -2080,7 +2086,7 @@ async function loadArchive(filePath, fs) {
|
|
|
2080
2086
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
2081
2087
|
*/
|
|
2082
2088
|
|
|
2083
|
-
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-8",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"}];
|
|
2089
|
+
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"}];
|
|
2084
2090
|
|
|
2085
2091
|
/**
|
|
2086
2092
|
* Checks if value is valid email
|
|
@@ -2179,6 +2185,8 @@ function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
|
2179
2185
|
* Function `validatePipelineString` will validate the if the string is a valid pipeline string
|
|
2180
2186
|
* 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.
|
|
2181
2187
|
*
|
|
2188
|
+
* Note: [🔂] This function is idempotent.
|
|
2189
|
+
*
|
|
2182
2190
|
* @param {string} pipelineString the candidate for a pipeline string
|
|
2183
2191
|
* @returns {PipelineString} the same string as input, but validated as valid
|
|
2184
2192
|
* @throws {ParseError} if the string is not a valid pipeline string
|
|
@@ -2338,7 +2346,7 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
2338
2346
|
pipelineString += '\n\n';
|
|
2339
2347
|
pipelineString += '```' + contentLanguage;
|
|
2340
2348
|
pipelineString += '\n';
|
|
2341
|
-
pipelineString += spaceTrim(content);
|
|
2349
|
+
pipelineString += spaceTrim$2(content);
|
|
2342
2350
|
// <- TODO: [main] !!3 Escape
|
|
2343
2351
|
// <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
|
|
2344
2352
|
pipelineString += '\n';
|
|
@@ -2452,7 +2460,7 @@ function unpreparePipeline(pipeline) {
|
|
|
2452
2460
|
* Library of pipelines that groups together pipelines for an application.
|
|
2453
2461
|
* This implementation is a very thin wrapper around the Array / Map of pipelines.
|
|
2454
2462
|
*
|
|
2455
|
-
* @private internal function of `
|
|
2463
|
+
* @private internal function of `createPipelineCollectionFromJson`, use `createPipelineCollectionFromJson` instead
|
|
2456
2464
|
* @see https://github.com/webgptorg/pipeline#pipeline-collection
|
|
2457
2465
|
*/
|
|
2458
2466
|
class SimplePipelineCollection {
|
|
@@ -2462,7 +2470,7 @@ class SimplePipelineCollection {
|
|
|
2462
2470
|
* @param pipelines Array of pipeline JSON objects to include in the collection
|
|
2463
2471
|
*
|
|
2464
2472
|
* Note: During the construction logic of all pipelines are validated
|
|
2465
|
-
* Note: It is not recommended to use this constructor directly, use `
|
|
2473
|
+
* Note: It is not recommended to use this constructor directly, use `createPipelineCollectionFromJson` *(or other variant)* instead
|
|
2466
2474
|
*/
|
|
2467
2475
|
constructor(...pipelines) {
|
|
2468
2476
|
this.collection = new Map();
|
|
@@ -2550,16 +2558,16 @@ class SimplePipelineCollection {
|
|
|
2550
2558
|
}
|
|
2551
2559
|
|
|
2552
2560
|
/**
|
|
2553
|
-
* Creates PipelineCollection from array of PipelineJson or PipelineString
|
|
2561
|
+
* Creates `PipelineCollection` from array of PipelineJson or PipelineString
|
|
2554
2562
|
*
|
|
2555
|
-
* Note: Functions `
|
|
2563
|
+
* Note: Functions `pipelineCollectionToJson` and `createPipelineCollectionFromJson` are complementary
|
|
2556
2564
|
* Note: Syntax, parsing, and logic consistency checks are performed on all sources during build
|
|
2557
2565
|
*
|
|
2558
2566
|
* @param promptbookSources
|
|
2559
2567
|
* @returns PipelineCollection
|
|
2560
2568
|
* @public exported from `@promptbook/core`
|
|
2561
2569
|
*/
|
|
2562
|
-
function
|
|
2570
|
+
function createPipelineCollectionFromJson(...promptbooks) {
|
|
2563
2571
|
return new SimplePipelineCollection(...promptbooks);
|
|
2564
2572
|
}
|
|
2565
2573
|
|
|
@@ -2677,6 +2685,22 @@ class CollectionError extends Error {
|
|
|
2677
2685
|
}
|
|
2678
2686
|
}
|
|
2679
2687
|
|
|
2688
|
+
/**
|
|
2689
|
+
* This error indicates error from the database
|
|
2690
|
+
*
|
|
2691
|
+
* @public exported from `@promptbook/core`
|
|
2692
|
+
*/
|
|
2693
|
+
class DatabaseError extends Error {
|
|
2694
|
+
constructor(message) {
|
|
2695
|
+
super(message);
|
|
2696
|
+
this.name = 'DatabaseError';
|
|
2697
|
+
Object.setPrototypeOf(this, DatabaseError.prototype);
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
/**
|
|
2701
|
+
* TODO: [🐱🚀] Explain that NotFoundError ([🐱🚀] and other specific errors) has priority over DatabaseError in some contexts
|
|
2702
|
+
*/
|
|
2703
|
+
|
|
2680
2704
|
/**
|
|
2681
2705
|
* This error type indicates that you try to use a feature that is not available in the current environment
|
|
2682
2706
|
*
|
|
@@ -2732,6 +2756,19 @@ class LimitReachedError extends Error {
|
|
|
2732
2756
|
}
|
|
2733
2757
|
}
|
|
2734
2758
|
|
|
2759
|
+
/**
|
|
2760
|
+
* This error indicates that promptbook operation is not allowed
|
|
2761
|
+
*
|
|
2762
|
+
* @public exported from `@promptbook/core`
|
|
2763
|
+
*/
|
|
2764
|
+
class NotAllowed extends Error {
|
|
2765
|
+
constructor(message) {
|
|
2766
|
+
super(message);
|
|
2767
|
+
this.name = 'NotAllowed';
|
|
2768
|
+
Object.setPrototypeOf(this, NotAllowed.prototype);
|
|
2769
|
+
}
|
|
2770
|
+
}
|
|
2771
|
+
|
|
2735
2772
|
/**
|
|
2736
2773
|
* This error type indicates that some part of the code is not implemented yet
|
|
2737
2774
|
*
|
|
@@ -2758,6 +2795,7 @@ class NotYetImplementedError extends Error {
|
|
|
2758
2795
|
/**
|
|
2759
2796
|
* Generates random token
|
|
2760
2797
|
*
|
|
2798
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
2761
2799
|
* Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
|
|
2762
2800
|
*
|
|
2763
2801
|
* @private internal helper function
|
|
@@ -2767,6 +2805,7 @@ function $randomToken(randomness) {
|
|
|
2767
2805
|
return randomBytes(randomness).toString('hex');
|
|
2768
2806
|
}
|
|
2769
2807
|
/**
|
|
2808
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
2770
2809
|
* TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
2771
2810
|
*/
|
|
2772
2811
|
|
|
@@ -2826,6 +2865,8 @@ const PROMPTBOOK_ERRORS = {
|
|
|
2826
2865
|
PromptbookFetchError,
|
|
2827
2866
|
UnexpectedError,
|
|
2828
2867
|
WrappedError,
|
|
2868
|
+
NotAllowed,
|
|
2869
|
+
DatabaseError,
|
|
2829
2870
|
// TODO: [🪑]> VersionMismatchError,
|
|
2830
2871
|
};
|
|
2831
2872
|
/**
|
|
@@ -2873,7 +2914,7 @@ function serializeError(error) {
|
|
|
2873
2914
|
const { name, message, stack } = error;
|
|
2874
2915
|
const { id } = error;
|
|
2875
2916
|
if (!Object.keys(ALL_ERRORS).includes(name)) {
|
|
2876
|
-
console.error(spaceTrim((block) => `
|
|
2917
|
+
console.error(spaceTrim$2((block) => `
|
|
2877
2918
|
|
|
2878
2919
|
Cannot serialize error with name "${name}"
|
|
2879
2920
|
|
|
@@ -2937,7 +2978,7 @@ function deserializeError(error) {
|
|
|
2937
2978
|
message = `${name}: ${message}`;
|
|
2938
2979
|
}
|
|
2939
2980
|
if (stack !== undefined && stack !== '') {
|
|
2940
|
-
message = spaceTrim((block) => `
|
|
2981
|
+
message = spaceTrim$2((block) => `
|
|
2941
2982
|
${block(message)}
|
|
2942
2983
|
|
|
2943
2984
|
Original stack trace:
|
|
@@ -3005,6 +3046,7 @@ function createTask(options) {
|
|
|
3005
3046
|
let updatedAt = createdAt;
|
|
3006
3047
|
const errors = [];
|
|
3007
3048
|
const warnings = [];
|
|
3049
|
+
const llmCalls = [];
|
|
3008
3050
|
let currentValue = {};
|
|
3009
3051
|
let customTldr = null;
|
|
3010
3052
|
const partialResultSubject = new Subject();
|
|
@@ -3020,6 +3062,9 @@ function createTask(options) {
|
|
|
3020
3062
|
}, (tldrInfo) => {
|
|
3021
3063
|
customTldr = tldrInfo;
|
|
3022
3064
|
updatedAt = new Date();
|
|
3065
|
+
}, (llmCall) => {
|
|
3066
|
+
llmCalls.push(llmCall);
|
|
3067
|
+
updatedAt = new Date();
|
|
3023
3068
|
});
|
|
3024
3069
|
finalResultPromise
|
|
3025
3070
|
.catch((error) => {
|
|
@@ -3142,7 +3187,7 @@ function createTask(options) {
|
|
|
3142
3187
|
}
|
|
3143
3188
|
return {
|
|
3144
3189
|
percent: percent,
|
|
3145
|
-
message,
|
|
3190
|
+
message: message + ' (!!!fallback)',
|
|
3146
3191
|
};
|
|
3147
3192
|
},
|
|
3148
3193
|
get createdAt() {
|
|
@@ -3165,6 +3210,10 @@ function createTask(options) {
|
|
|
3165
3210
|
return warnings;
|
|
3166
3211
|
// <- Note: [1] --||--
|
|
3167
3212
|
},
|
|
3213
|
+
get llmCalls() {
|
|
3214
|
+
return [...llmCalls, { foo: '!!! bar' }];
|
|
3215
|
+
// <- Note: [1] --||--
|
|
3216
|
+
},
|
|
3168
3217
|
get currentValue() {
|
|
3169
3218
|
return currentValue;
|
|
3170
3219
|
// <- Note: [1] --||--
|
|
@@ -3607,7 +3656,7 @@ const CsvFormatParser = {
|
|
|
3607
3656
|
const { value, outputParameterName, settings, mapCallback, onProgress } = options;
|
|
3608
3657
|
const csv = csvParse(value, settings);
|
|
3609
3658
|
if (csv.errors.length !== 0) {
|
|
3610
|
-
throw new CsvFormatError(spaceTrim((block) => `
|
|
3659
|
+
throw new CsvFormatError(spaceTrim$2((block) => `
|
|
3611
3660
|
CSV parsing error
|
|
3612
3661
|
|
|
3613
3662
|
Error(s) from CSV parsing:
|
|
@@ -3652,7 +3701,7 @@ const CsvFormatParser = {
|
|
|
3652
3701
|
const { value, settings, mapCallback, onProgress } = options;
|
|
3653
3702
|
const csv = csvParse(value, settings);
|
|
3654
3703
|
if (csv.errors.length !== 0) {
|
|
3655
|
-
throw new CsvFormatError(spaceTrim((block) => `
|
|
3704
|
+
throw new CsvFormatError(spaceTrim$2((block) => `
|
|
3656
3705
|
CSV parsing error
|
|
3657
3706
|
|
|
3658
3707
|
Error(s) from CSV parsing:
|
|
@@ -3862,7 +3911,7 @@ function mapAvailableToExpectedParameters(options) {
|
|
|
3862
3911
|
}
|
|
3863
3912
|
// Phase 2️⃣: Non-matching mapping
|
|
3864
3913
|
if (expectedParameterNames.size !== availableParametersNames.size) {
|
|
3865
|
-
throw new PipelineExecutionError(spaceTrim((block) => `
|
|
3914
|
+
throw new PipelineExecutionError(spaceTrim$2((block) => `
|
|
3866
3915
|
Can not map available parameters to expected parameters
|
|
3867
3916
|
|
|
3868
3917
|
Mapped parameters:
|
|
@@ -3940,14 +3989,14 @@ class MultipleLlmExecutionTools {
|
|
|
3940
3989
|
if (description === undefined) {
|
|
3941
3990
|
return headLine;
|
|
3942
3991
|
}
|
|
3943
|
-
return spaceTrim((block) => `
|
|
3992
|
+
return spaceTrim$2((block) => `
|
|
3944
3993
|
${headLine}
|
|
3945
3994
|
|
|
3946
3995
|
${ /* <- Note: Indenting the description: */block(description)}
|
|
3947
3996
|
`);
|
|
3948
3997
|
})
|
|
3949
3998
|
.join('\n\n');
|
|
3950
|
-
return spaceTrim((block) => `
|
|
3999
|
+
return spaceTrim$2((block) => `
|
|
3951
4000
|
Multiple LLM Providers:
|
|
3952
4001
|
|
|
3953
4002
|
${block(innerModelsTitlesAndDescriptions)}
|
|
@@ -4038,7 +4087,7 @@ class MultipleLlmExecutionTools {
|
|
|
4038
4087
|
// 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
4039
4088
|
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
4040
4089
|
// 3) ...
|
|
4041
|
-
spaceTrim((block) => `
|
|
4090
|
+
spaceTrim$2((block) => `
|
|
4042
4091
|
All execution tools of ${this.title} failed:
|
|
4043
4092
|
|
|
4044
4093
|
${block(errors
|
|
@@ -4051,7 +4100,7 @@ class MultipleLlmExecutionTools {
|
|
|
4051
4100
|
throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
|
|
4052
4101
|
}
|
|
4053
4102
|
else {
|
|
4054
|
-
throw new PipelineExecutionError(spaceTrim((block) => `
|
|
4103
|
+
throw new PipelineExecutionError(spaceTrim$2((block) => `
|
|
4055
4104
|
You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
|
|
4056
4105
|
|
|
4057
4106
|
Available \`LlmExecutionTools\`:
|
|
@@ -4084,7 +4133,7 @@ class MultipleLlmExecutionTools {
|
|
|
4084
4133
|
*/
|
|
4085
4134
|
function joinLlmExecutionTools(title, ...llmExecutionTools) {
|
|
4086
4135
|
if (llmExecutionTools.length === 0) {
|
|
4087
|
-
const warningMessage = spaceTrim(`
|
|
4136
|
+
const warningMessage = spaceTrim$2(`
|
|
4088
4137
|
You have not provided any \`LlmExecutionTools\`
|
|
4089
4138
|
This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.
|
|
4090
4139
|
|
|
@@ -4117,6 +4166,7 @@ function joinLlmExecutionTools(title, ...llmExecutionTools) {
|
|
|
4117
4166
|
return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
|
|
4118
4167
|
}
|
|
4119
4168
|
/**
|
|
4169
|
+
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
4120
4170
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
4121
4171
|
*/
|
|
4122
4172
|
|
|
@@ -4133,6 +4183,7 @@ function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools) {
|
|
|
4133
4183
|
return llmTools;
|
|
4134
4184
|
}
|
|
4135
4185
|
/**
|
|
4186
|
+
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
4136
4187
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
4137
4188
|
*/
|
|
4138
4189
|
|
|
@@ -4370,10 +4421,13 @@ const LINES_PER_STANDARD_PAGE = 44;
|
|
|
4370
4421
|
* @public exported from `@promptbook/utils`
|
|
4371
4422
|
*/
|
|
4372
4423
|
function countLines(text) {
|
|
4424
|
+
if (text === '') {
|
|
4425
|
+
return 0;
|
|
4426
|
+
}
|
|
4373
4427
|
text = text.replace('\r\n', '\n');
|
|
4374
4428
|
text = text.replace('\r', '\n');
|
|
4375
4429
|
const lines = text.split('\n');
|
|
4376
|
-
return lines.reduce((count, line) => count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 0);
|
|
4430
|
+
return lines.reduce((count, line) => count + Math.max(Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 1), 0);
|
|
4377
4431
|
}
|
|
4378
4432
|
/**
|
|
4379
4433
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
@@ -4761,6 +4815,8 @@ function checkExpectations(expectations, value) {
|
|
|
4761
4815
|
* This function provides a common abstraction for result validation that can be used
|
|
4762
4816
|
* by both execution logic and caching logic to ensure consistency.
|
|
4763
4817
|
*
|
|
4818
|
+
* Note: [🔂] This function is idempotent.
|
|
4819
|
+
*
|
|
4764
4820
|
* @param options - The validation options including result string, expectations, and format
|
|
4765
4821
|
* @returns Validation result with processed string and validity status
|
|
4766
4822
|
* @private internal function of `createPipelineExecutor` and `cacheLlmTools`
|
|
@@ -4829,7 +4885,7 @@ function validatePromptResult(options) {
|
|
|
4829
4885
|
*/
|
|
4830
4886
|
async function executeAttempts(options) {
|
|
4831
4887
|
const { jokerParameterNames, priority, maxAttempts, // <- Note: [💂]
|
|
4832
|
-
preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, } = options;
|
|
4888
|
+
preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, logLlmCall, } = options;
|
|
4833
4889
|
const $ongoingTaskResult = {
|
|
4834
4890
|
$result: null,
|
|
4835
4891
|
$resultString: null,
|
|
@@ -5077,14 +5133,10 @@ async function executeAttempts(options) {
|
|
|
5077
5133
|
});
|
|
5078
5134
|
}
|
|
5079
5135
|
finally {
|
|
5080
|
-
if (!isJokerAttempt &&
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
// In that case we don’t want to make a report about it because it’s not a llm execution error
|
|
5085
|
-
) {
|
|
5086
|
-
// TODO: [🧠] Maybe put other taskTypes into report
|
|
5087
|
-
$executionReport.promptExecutions.push({
|
|
5136
|
+
if (!isJokerAttempt && task.taskType === 'PROMPT_TASK' && $ongoingTaskResult.$prompt) {
|
|
5137
|
+
// Note: [2] When some expected parameter is not defined, error will occur in templateParameters
|
|
5138
|
+
// In that case we don’t want to make a report about it because it’s not a llm execution error
|
|
5139
|
+
const executionPromptReport = {
|
|
5088
5140
|
prompt: {
|
|
5089
5141
|
...$ongoingTaskResult.$prompt,
|
|
5090
5142
|
// <- TODO: [🧠] How to pick everyhing except `pipelineUrl`
|
|
@@ -5093,7 +5145,14 @@ async function executeAttempts(options) {
|
|
|
5093
5145
|
error: $ongoingTaskResult.$expectError === null
|
|
5094
5146
|
? undefined
|
|
5095
5147
|
: serializeError($ongoingTaskResult.$expectError),
|
|
5096
|
-
}
|
|
5148
|
+
};
|
|
5149
|
+
$executionReport.promptExecutions.push(executionPromptReport);
|
|
5150
|
+
if (logLlmCall) {
|
|
5151
|
+
logLlmCall({
|
|
5152
|
+
modelName: 'model' /* <- TODO: How to get model name from the report */,
|
|
5153
|
+
report: executionPromptReport,
|
|
5154
|
+
});
|
|
5155
|
+
}
|
|
5097
5156
|
}
|
|
5098
5157
|
}
|
|
5099
5158
|
if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
|
|
@@ -5158,12 +5217,12 @@ async function executeAttempts(options) {
|
|
|
5158
5217
|
* @private internal utility of `createPipelineExecutor`
|
|
5159
5218
|
*/
|
|
5160
5219
|
async function executeFormatSubvalues(options) {
|
|
5161
|
-
const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, pipelineIdentification } = options;
|
|
5220
|
+
const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, logLlmCall, pipelineIdentification, } = options;
|
|
5162
5221
|
if (task.foreach === undefined) {
|
|
5163
|
-
return /* not await */ executeAttempts(options);
|
|
5222
|
+
return /* not await */ executeAttempts({ ...options, logLlmCall });
|
|
5164
5223
|
}
|
|
5165
5224
|
if (jokerParameterNames.length !== 0) {
|
|
5166
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
5225
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
5167
5226
|
JOKER parameters are not supported together with FOREACH command
|
|
5168
5227
|
|
|
5169
5228
|
[🧞♀️] This should be prevented in \`validatePipeline\`
|
|
@@ -5176,7 +5235,7 @@ async function executeFormatSubvalues(options) {
|
|
|
5176
5235
|
if (formatDefinition === undefined) {
|
|
5177
5236
|
throw new UnexpectedError(
|
|
5178
5237
|
// <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
|
|
5179
|
-
spaceTrim((block) => `
|
|
5238
|
+
spaceTrim$2((block) => `
|
|
5180
5239
|
Unsupported format "${task.foreach.formatName}"
|
|
5181
5240
|
|
|
5182
5241
|
Available formats:
|
|
@@ -5193,7 +5252,7 @@ async function executeFormatSubvalues(options) {
|
|
|
5193
5252
|
if (subvalueParser === undefined) {
|
|
5194
5253
|
throw new UnexpectedError(
|
|
5195
5254
|
// <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
|
|
5196
|
-
spaceTrim((block) => `
|
|
5255
|
+
spaceTrim$2((block) => `
|
|
5197
5256
|
Unsupported subformat name "${task.foreach.subformatName}" for format "${task.foreach.formatName}"
|
|
5198
5257
|
|
|
5199
5258
|
Available subformat names for format "${formatDefinition.formatName}":
|
|
@@ -5233,7 +5292,7 @@ async function executeFormatSubvalues(options) {
|
|
|
5233
5292
|
if (!(error instanceof PipelineExecutionError)) {
|
|
5234
5293
|
throw error;
|
|
5235
5294
|
}
|
|
5236
|
-
const highLevelError = new PipelineExecutionError(spaceTrim((block) => `
|
|
5295
|
+
const highLevelError = new PipelineExecutionError(spaceTrim$2((block) => `
|
|
5237
5296
|
${error.message}
|
|
5238
5297
|
|
|
5239
5298
|
This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
@@ -5257,7 +5316,7 @@ async function executeFormatSubvalues(options) {
|
|
|
5257
5316
|
...options,
|
|
5258
5317
|
priority: priority + index,
|
|
5259
5318
|
parameters: allSubparameters,
|
|
5260
|
-
pipelineIdentification: spaceTrim((block) => `
|
|
5319
|
+
pipelineIdentification: spaceTrim$2((block) => `
|
|
5261
5320
|
${block(pipelineIdentification)}
|
|
5262
5321
|
Subparameter index: ${index}
|
|
5263
5322
|
`),
|
|
@@ -5266,7 +5325,7 @@ async function executeFormatSubvalues(options) {
|
|
|
5266
5325
|
}
|
|
5267
5326
|
catch (error) {
|
|
5268
5327
|
if (length > BIG_DATASET_TRESHOLD) {
|
|
5269
|
-
console.error(spaceTrim((block) => `
|
|
5328
|
+
console.error(spaceTrim$2((block) => `
|
|
5270
5329
|
${error.message}
|
|
5271
5330
|
|
|
5272
5331
|
This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
@@ -5366,7 +5425,7 @@ async function getKnowledgeForTask(options) {
|
|
|
5366
5425
|
},
|
|
5367
5426
|
content: task.content,
|
|
5368
5427
|
parameters,
|
|
5369
|
-
};
|
|
5428
|
+
}; /* <- Note: [🤛] */
|
|
5370
5429
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
5371
5430
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
5372
5431
|
const { index } = knowledgePiece;
|
|
@@ -5461,7 +5520,7 @@ async function getReservedParametersForTask(options) {
|
|
|
5461
5520
|
* @private internal utility of `createPipelineExecutor`
|
|
5462
5521
|
*/
|
|
5463
5522
|
async function executeTask(options) {
|
|
5464
|
-
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
|
|
5523
|
+
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, logLlmCall, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
|
|
5465
5524
|
const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
5466
5525
|
// Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
|
|
5467
5526
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
@@ -5540,6 +5599,7 @@ async function executeTask(options) {
|
|
|
5540
5599
|
tools,
|
|
5541
5600
|
$executionReport,
|
|
5542
5601
|
onProgress,
|
|
5602
|
+
logLlmCall,
|
|
5543
5603
|
pipelineIdentification,
|
|
5544
5604
|
maxExecutionAttempts,
|
|
5545
5605
|
maxParallelCount,
|
|
@@ -5583,6 +5643,29 @@ function filterJustOutputParameters(options) {
|
|
|
5583
5643
|
$warnings.push(new PipelineExecutionError(spaceTrim$1((block) => `
|
|
5584
5644
|
Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
|
|
5585
5645
|
|
|
5646
|
+
Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
|
|
5647
|
+
|
|
5648
|
+
All parameters:
|
|
5649
|
+
${block(preparedPipeline.parameters
|
|
5650
|
+
.map(({ name, isInput, isOutput, description }) => {
|
|
5651
|
+
let line = `\`{${name}}\``;
|
|
5652
|
+
if (isInput) {
|
|
5653
|
+
line += ' `[input parameter]`';
|
|
5654
|
+
}
|
|
5655
|
+
if (isOutput) {
|
|
5656
|
+
line += ' `[output parameter]`';
|
|
5657
|
+
}
|
|
5658
|
+
if (parametersToPass[name] === undefined) {
|
|
5659
|
+
line += ` <- Warning: Should be in the output but its not |`;
|
|
5660
|
+
}
|
|
5661
|
+
if (description) {
|
|
5662
|
+
line += ` ${description}`;
|
|
5663
|
+
}
|
|
5664
|
+
return line;
|
|
5665
|
+
})
|
|
5666
|
+
.map((line, index) => `${index + 1}) ${line}`)
|
|
5667
|
+
.join('\n'))}
|
|
5668
|
+
|
|
5586
5669
|
${block(pipelineIdentification)}
|
|
5587
5670
|
`)));
|
|
5588
5671
|
continue;
|
|
@@ -5603,7 +5686,7 @@ function filterJustOutputParameters(options) {
|
|
|
5603
5686
|
* @private internal utility of `createPipelineExecutor`
|
|
5604
5687
|
*/
|
|
5605
5688
|
async function executePipeline(options) {
|
|
5606
|
-
const { inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
|
|
5689
|
+
const { inputParameters, tools, onProgress, logLlmCall, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
|
|
5607
5690
|
let { preparedPipeline } = options;
|
|
5608
5691
|
if (preparedPipeline === undefined) {
|
|
5609
5692
|
preparedPipeline = await preparePipeline(pipeline, tools, {
|
|
@@ -5781,6 +5864,7 @@ async function executePipeline(options) {
|
|
|
5781
5864
|
onProgress(newOngoingResult);
|
|
5782
5865
|
}
|
|
5783
5866
|
},
|
|
5867
|
+
logLlmCall,
|
|
5784
5868
|
$executionReport: executionReport,
|
|
5785
5869
|
pipelineIdentification: spaceTrim$1((block) => `
|
|
5786
5870
|
${block(pipelineIdentification)}
|
|
@@ -5904,7 +5988,7 @@ function createPipelineExecutor(options) {
|
|
|
5904
5988
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
5905
5989
|
}
|
|
5906
5990
|
let runCount = 0;
|
|
5907
|
-
const pipelineExecutorWithCallback = async (inputParameters, onProgress) => {
|
|
5991
|
+
const pipelineExecutorWithCallback = async (inputParameters, onProgress, logLlmCall) => {
|
|
5908
5992
|
runCount++;
|
|
5909
5993
|
return /* not await */ executePipeline({
|
|
5910
5994
|
pipeline,
|
|
@@ -5915,6 +5999,7 @@ function createPipelineExecutor(options) {
|
|
|
5915
5999
|
inputParameters,
|
|
5916
6000
|
tools,
|
|
5917
6001
|
onProgress,
|
|
6002
|
+
logLlmCall,
|
|
5918
6003
|
pipelineIdentification: spaceTrim$1((block) => `
|
|
5919
6004
|
${block(pipelineIdentification)}
|
|
5920
6005
|
${runCount === 1 ? '' : `Run #${runCount}`}
|
|
@@ -6132,7 +6217,7 @@ async function preparePersona(personaDescription, tools, options) {
|
|
|
6132
6217
|
throw new MissingToolsError('LLM tools are required for preparing persona');
|
|
6133
6218
|
}
|
|
6134
6219
|
// TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
|
|
6135
|
-
const collection =
|
|
6220
|
+
const collection = createPipelineCollectionFromJson(...PipelineCollection);
|
|
6136
6221
|
const preparePersonaExecutor = createPipelineExecutor({
|
|
6137
6222
|
pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book'),
|
|
6138
6223
|
tools,
|
|
@@ -6383,14 +6468,14 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
6383
6468
|
return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
|
|
6384
6469
|
});
|
|
6385
6470
|
if (metadata.length === 0) {
|
|
6386
|
-
return spaceTrim(`
|
|
6471
|
+
return spaceTrim$2(`
|
|
6387
6472
|
**No scrapers are available**
|
|
6388
6473
|
|
|
6389
6474
|
This is a unexpected behavior, you are probably using some broken version of Promptbook
|
|
6390
6475
|
At least there should be available the metadata of the scrapers
|
|
6391
6476
|
`);
|
|
6392
6477
|
}
|
|
6393
|
-
return spaceTrim((block) => `
|
|
6478
|
+
return spaceTrim$2((block) => `
|
|
6394
6479
|
Available scrapers are:
|
|
6395
6480
|
${block(metadata
|
|
6396
6481
|
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
|
|
@@ -6435,6 +6520,8 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
6435
6520
|
/**
|
|
6436
6521
|
* Converts a given text to kebab-case format.
|
|
6437
6522
|
*
|
|
6523
|
+
* Note: [🔂] This function is idempotent.
|
|
6524
|
+
*
|
|
6438
6525
|
* @param text The text to be converted.
|
|
6439
6526
|
* @returns The kebab-case formatted string.
|
|
6440
6527
|
* @example 'hello-world'
|
|
@@ -6590,6 +6677,8 @@ function removeEmojis(text) {
|
|
|
6590
6677
|
/**
|
|
6591
6678
|
* Converts a title string into a normalized name.
|
|
6592
6679
|
*
|
|
6680
|
+
* Note: [🔂] This function is idempotent.
|
|
6681
|
+
*
|
|
6593
6682
|
* @param value The title string to be converted to a name.
|
|
6594
6683
|
* @returns A normalized name derived from the input title.
|
|
6595
6684
|
* @example 'Hello World!' -> 'hello-world'
|
|
@@ -6629,7 +6718,7 @@ const promptbookFetch = async (urlOrRequest, init) => {
|
|
|
6629
6718
|
else if (urlOrRequest instanceof Request) {
|
|
6630
6719
|
url = urlOrRequest.url;
|
|
6631
6720
|
}
|
|
6632
|
-
throw new PromptbookFetchError(spaceTrim((block) => `
|
|
6721
|
+
throw new PromptbookFetchError(spaceTrim$2((block) => `
|
|
6633
6722
|
Can not fetch "${url}"
|
|
6634
6723
|
|
|
6635
6724
|
Fetch error:
|
|
@@ -6790,7 +6879,7 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
6790
6879
|
const fileExtension = getFileExtension(filename);
|
|
6791
6880
|
const mimeType = extensionToMimeType(fileExtension || '');
|
|
6792
6881
|
if (!(await isFileExisting(filename, tools.fs))) {
|
|
6793
|
-
throw new NotFoundError(spaceTrim((block) => `
|
|
6882
|
+
throw new NotFoundError(spaceTrim$2((block) => `
|
|
6794
6883
|
Can not make source handler for file which does not exist:
|
|
6795
6884
|
|
|
6796
6885
|
File:
|
|
@@ -6883,7 +6972,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
6883
6972
|
// <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
|
|
6884
6973
|
break;
|
|
6885
6974
|
}
|
|
6886
|
-
console.warn(spaceTrim((block) => `
|
|
6975
|
+
console.warn(spaceTrim$2((block) => `
|
|
6887
6976
|
Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
|
|
6888
6977
|
|
|
6889
6978
|
The source:
|
|
@@ -6899,7 +6988,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
6899
6988
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
6900
6989
|
}
|
|
6901
6990
|
if (partialPieces === null) {
|
|
6902
|
-
throw new KnowledgeScrapeError(spaceTrim((block) => `
|
|
6991
|
+
throw new KnowledgeScrapeError(spaceTrim$2((block) => `
|
|
6903
6992
|
Cannot scrape knowledge
|
|
6904
6993
|
|
|
6905
6994
|
The source:
|
|
@@ -7064,7 +7153,7 @@ async function preparePipeline(pipeline, tools, options) {
|
|
|
7064
7153
|
let title = pipeline.title;
|
|
7065
7154
|
if (title === undefined || title === '' || title === DEFAULT_BOOK_TITLE) {
|
|
7066
7155
|
// TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
|
|
7067
|
-
const collection =
|
|
7156
|
+
const collection = createPipelineCollectionFromJson(...PipelineCollection);
|
|
7068
7157
|
const prepareTitleExecutor = createPipelineExecutor({
|
|
7069
7158
|
pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book'),
|
|
7070
7159
|
tools,
|
|
@@ -7235,7 +7324,7 @@ const knowledgeCommandParser = {
|
|
|
7235
7324
|
*/
|
|
7236
7325
|
parse(input) {
|
|
7237
7326
|
const { args } = input;
|
|
7238
|
-
const knowledgeSourceContent = spaceTrim(args[0] || '');
|
|
7327
|
+
const knowledgeSourceContent = spaceTrim$2(args[0] || '');
|
|
7239
7328
|
if (knowledgeSourceContent === '') {
|
|
7240
7329
|
throw new ParseError(`Source is not defined`);
|
|
7241
7330
|
}
|
|
@@ -7379,7 +7468,7 @@ const sectionCommandParser = {
|
|
|
7379
7468
|
normalized = normalized.split('DIALOGUE').join('DIALOG');
|
|
7380
7469
|
const taskTypes = SectionTypes.filter((sectionType) => normalized.includes(sectionType.split('_TASK').join('')));
|
|
7381
7470
|
if (taskTypes.length !== 1) {
|
|
7382
|
-
throw new ParseError(spaceTrim((block) => `
|
|
7471
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
7383
7472
|
Unknown section type "${normalized}"
|
|
7384
7473
|
|
|
7385
7474
|
Supported section types are:
|
|
@@ -7399,7 +7488,7 @@ const sectionCommandParser = {
|
|
|
7399
7488
|
*/
|
|
7400
7489
|
$applyToTaskJson(command, $taskJson, $pipelineJson) {
|
|
7401
7490
|
if ($taskJson.isSectionTypeSet === true) {
|
|
7402
|
-
throw new ParseError(spaceTrim(`
|
|
7491
|
+
throw new ParseError(spaceTrim$2(`
|
|
7403
7492
|
Section type is already defined in the section.
|
|
7404
7493
|
It can be defined only once.
|
|
7405
7494
|
`));
|
|
@@ -7748,7 +7837,7 @@ const expectCommandParser = {
|
|
|
7748
7837
|
/**
|
|
7749
7838
|
* Description of the FORMAT command
|
|
7750
7839
|
*/
|
|
7751
|
-
description: spaceTrim(`
|
|
7840
|
+
description: spaceTrim$2(`
|
|
7752
7841
|
Expect command describes the desired output of the task *(after post-processing)*
|
|
7753
7842
|
It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.
|
|
7754
7843
|
`),
|
|
@@ -7822,7 +7911,7 @@ const expectCommandParser = {
|
|
|
7822
7911
|
}
|
|
7823
7912
|
catch (error) {
|
|
7824
7913
|
assertsError(error);
|
|
7825
|
-
throw new ParseError(spaceTrim((block) => `
|
|
7914
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
7826
7915
|
Invalid FORMAT command
|
|
7827
7916
|
${block(error.message)}:
|
|
7828
7917
|
`));
|
|
@@ -7872,6 +7961,8 @@ const expectCommandParser = {
|
|
|
7872
7961
|
/**
|
|
7873
7962
|
* Normalizes a given text to camelCase format.
|
|
7874
7963
|
*
|
|
7964
|
+
* Note: [🔂] This function is idempotent.
|
|
7965
|
+
*
|
|
7875
7966
|
* @param text The text to be normalized.
|
|
7876
7967
|
* @param _isFirstLetterCapital Whether the first letter should be capitalized.
|
|
7877
7968
|
* @returns The camelCase formatted string.
|
|
@@ -7949,6 +8040,8 @@ function removeQuotes(text) {
|
|
|
7949
8040
|
* Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
|
|
7950
8041
|
* It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
|
|
7951
8042
|
*
|
|
8043
|
+
* Note: [🔂] This function is idempotent.
|
|
8044
|
+
*
|
|
7952
8045
|
* @param parameterName The parameter name to validate and normalize.
|
|
7953
8046
|
* @returns The validated and normalized parameter name.
|
|
7954
8047
|
* @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
|
|
@@ -8008,7 +8101,7 @@ function validateParameterName(parameterName) {
|
|
|
8008
8101
|
if (!(error instanceof ParseError)) {
|
|
8009
8102
|
throw error;
|
|
8010
8103
|
}
|
|
8011
|
-
throw new ParseError(spaceTrim((block) => `
|
|
8104
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
8012
8105
|
${block(error.message)}
|
|
8013
8106
|
|
|
8014
8107
|
Tried to validate parameter name:
|
|
@@ -8067,7 +8160,7 @@ const foreachCommandParser = {
|
|
|
8067
8160
|
const assignSign = args[3];
|
|
8068
8161
|
const formatDefinition = FORMAT_DEFINITIONS.find((formatDefinition) => [formatDefinition.formatName, ...(formatDefinition.aliases || [])].includes(formatName));
|
|
8069
8162
|
if (formatDefinition === undefined) {
|
|
8070
|
-
throw new ParseError(spaceTrim((block) => `
|
|
8163
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
8071
8164
|
Unsupported format "${formatName}"
|
|
8072
8165
|
|
|
8073
8166
|
Available formats:
|
|
@@ -8079,7 +8172,7 @@ const foreachCommandParser = {
|
|
|
8079
8172
|
}
|
|
8080
8173
|
const subvalueParser = formatDefinition.subvalueParsers.find((subvalueParser) => [subvalueParser.subvalueName, ...(subvalueParser.aliases || [])].includes(subformatName));
|
|
8081
8174
|
if (subvalueParser === undefined) {
|
|
8082
|
-
throw new ParseError(spaceTrim((block) => `
|
|
8175
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
8083
8176
|
Unsupported subformat name "${subformatName}" for format "${formatName}"
|
|
8084
8177
|
|
|
8085
8178
|
Available subformat names for format "${formatDefinition.formatName}":
|
|
@@ -8127,7 +8220,7 @@ const foreachCommandParser = {
|
|
|
8127
8220
|
outputSubparameterName = 'newLine';
|
|
8128
8221
|
}
|
|
8129
8222
|
else {
|
|
8130
|
-
throw new ParseError(spaceTrim(`
|
|
8223
|
+
throw new ParseError(spaceTrim$2(`
|
|
8131
8224
|
FOREACH ${formatName} ${subformatName} must specify output subparameter
|
|
8132
8225
|
|
|
8133
8226
|
Correct example:
|
|
@@ -8203,7 +8296,7 @@ const formatCommandParser = {
|
|
|
8203
8296
|
/**
|
|
8204
8297
|
* Description of the FORMAT command
|
|
8205
8298
|
*/
|
|
8206
|
-
description: spaceTrim(`
|
|
8299
|
+
description: spaceTrim$2(`
|
|
8207
8300
|
Format command describes the desired output of the task (after post-processing)
|
|
8208
8301
|
It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.
|
|
8209
8302
|
`),
|
|
@@ -8575,7 +8668,7 @@ const formfactorCommandParser = {
|
|
|
8575
8668
|
const formfactorNameCandidate = args[0].toUpperCase();
|
|
8576
8669
|
const formfactor = FORMFACTOR_DEFINITIONS.find((definition) => [definition.name, ...{ aliasNames: [], ...definition }.aliasNames].includes(formfactorNameCandidate));
|
|
8577
8670
|
if (formfactor === undefined) {
|
|
8578
|
-
throw new ParseError(spaceTrim((block) => `
|
|
8671
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
8579
8672
|
Unknown formfactor name "${formfactorNameCandidate}"
|
|
8580
8673
|
|
|
8581
8674
|
Available formfactors:
|
|
@@ -8594,7 +8687,7 @@ const formfactorCommandParser = {
|
|
|
8594
8687
|
*/
|
|
8595
8688
|
$applyToPipelineJson(command, $pipelineJson) {
|
|
8596
8689
|
if ($pipelineJson.formfactorName !== undefined && $pipelineJson.formfactorName !== command.formfactorName) {
|
|
8597
|
-
throw new ParseError(spaceTrim(`
|
|
8690
|
+
throw new ParseError(spaceTrim$2(`
|
|
8598
8691
|
Redefinition of \`FORMFACTOR\` in the pipeline head
|
|
8599
8692
|
|
|
8600
8693
|
You have used:
|
|
@@ -8701,7 +8794,7 @@ const jokerCommandParser = {
|
|
|
8701
8794
|
* @see {@link ModelVariant}
|
|
8702
8795
|
* @public exported from `@promptbook/core`
|
|
8703
8796
|
*/
|
|
8704
|
-
const MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
|
|
8797
|
+
const MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'IMAGE_GENERATION', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
|
|
8705
8798
|
|
|
8706
8799
|
/**
|
|
8707
8800
|
* Parses the model command
|
|
@@ -8737,7 +8830,7 @@ const modelCommandParser = {
|
|
|
8737
8830
|
*/
|
|
8738
8831
|
parse(input) {
|
|
8739
8832
|
const { args, normalized } = input;
|
|
8740
|
-
const availableVariantsMessage = spaceTrim((block) => `
|
|
8833
|
+
const availableVariantsMessage = spaceTrim$2((block) => `
|
|
8741
8834
|
Available variants are:
|
|
8742
8835
|
${block(MODEL_VARIANTS.map((variantName) => `- ${variantName}${variantName !== 'EMBEDDING' ? '' : ' (Not available in pipeline)'}`).join('\n'))}
|
|
8743
8836
|
`);
|
|
@@ -8759,14 +8852,14 @@ const modelCommandParser = {
|
|
|
8759
8852
|
// <- Note: [🤖]
|
|
8760
8853
|
}
|
|
8761
8854
|
else if (normalized.startsWith('MODEL_VARIANT_EMBED')) {
|
|
8762
|
-
spaceTrim((block) => `
|
|
8855
|
+
spaceTrim$2((block) => `
|
|
8763
8856
|
Embedding model can not be used in pipeline
|
|
8764
8857
|
|
|
8765
8858
|
${block(availableVariantsMessage)}
|
|
8766
8859
|
`);
|
|
8767
8860
|
}
|
|
8768
8861
|
else {
|
|
8769
|
-
throw new ParseError(spaceTrim((block) => `
|
|
8862
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
8770
8863
|
Unknown model variant in command:
|
|
8771
8864
|
|
|
8772
8865
|
${block(availableVariantsMessage)}
|
|
@@ -8781,7 +8874,7 @@ const modelCommandParser = {
|
|
|
8781
8874
|
};
|
|
8782
8875
|
}
|
|
8783
8876
|
else {
|
|
8784
|
-
throw new ParseError(spaceTrim((block) => `
|
|
8877
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
8785
8878
|
Unknown model key in command.
|
|
8786
8879
|
|
|
8787
8880
|
Supported model keys are:
|
|
@@ -8808,7 +8901,7 @@ const modelCommandParser = {
|
|
|
8808
8901
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
8809
8902
|
}
|
|
8810
8903
|
else {
|
|
8811
|
-
throw new ParseError(spaceTrim(`
|
|
8904
|
+
throw new ParseError(spaceTrim$2(`
|
|
8812
8905
|
Redefinition of \`MODEL ${command.key}\` in the pipeline head
|
|
8813
8906
|
|
|
8814
8907
|
You have used:
|
|
@@ -8840,7 +8933,7 @@ const modelCommandParser = {
|
|
|
8840
8933
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
8841
8934
|
}
|
|
8842
8935
|
else {
|
|
8843
|
-
throw new ParseError(spaceTrim(`
|
|
8936
|
+
throw new ParseError(spaceTrim$2(`
|
|
8844
8937
|
Redefinition of MODEL \`${command.key}\` in the task "${$taskJson.title || $taskJson.name}"
|
|
8845
8938
|
|
|
8846
8939
|
You have used:
|
|
@@ -8850,7 +8943,7 @@ const modelCommandParser = {
|
|
|
8850
8943
|
}
|
|
8851
8944
|
}
|
|
8852
8945
|
if (command.value === ($pipelineJson.defaultModelRequirements || {})[command.key]) {
|
|
8853
|
-
console.log(spaceTrim(`
|
|
8946
|
+
console.log(spaceTrim$2(`
|
|
8854
8947
|
Setting MODEL \`${command.key}\` in the task "${$taskJson.title || $taskJson.name}" to the same value as in the pipeline head
|
|
8855
8948
|
|
|
8856
8949
|
In pipeline head:
|
|
@@ -8933,7 +9026,7 @@ const parameterCommandParser = {
|
|
|
8933
9026
|
// <- TODO: When [🥶] fixed, change to:
|
|
8934
9027
|
// > const parameterDescriptionRaw = rawArgs.split(parameterNameRaw).join('').trim();
|
|
8935
9028
|
if (parameterDescriptionRaw && parameterDescriptionRaw.match(/\{(?<embeddedParameterName>[a-z0-9_]+)\}/im)) {
|
|
8936
|
-
throw new ParseError(spaceTrim((block) => `
|
|
9029
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
8937
9030
|
Parameter \`{${parameterNameRaw}}\` can not contain another parameter in description
|
|
8938
9031
|
|
|
8939
9032
|
The description:
|
|
@@ -9115,7 +9208,7 @@ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
|
|
|
9115
9208
|
persona.description = personaDescription;
|
|
9116
9209
|
return;
|
|
9117
9210
|
}
|
|
9118
|
-
console.warn(spaceTrim(`
|
|
9211
|
+
console.warn(spaceTrim$2(`
|
|
9119
9212
|
|
|
9120
9213
|
Persona "${personaName}" is defined multiple times with different description:
|
|
9121
9214
|
|
|
@@ -9126,7 +9219,7 @@ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
|
|
|
9126
9219
|
${personaDescription}
|
|
9127
9220
|
|
|
9128
9221
|
`));
|
|
9129
|
-
persona.description += spaceTrim('\n\n' + personaDescription);
|
|
9222
|
+
persona.description += spaceTrim$2('\n\n' + personaDescription);
|
|
9130
9223
|
}
|
|
9131
9224
|
|
|
9132
9225
|
/**
|
|
@@ -9920,6 +10013,48 @@ const HIGH_LEVEL_ABSTRACTIONS = [
|
|
|
9920
10013
|
const SUPPORTED_SCRIPT_LANGUAGES = ['javascript', 'typescript', 'python'];
|
|
9921
10014
|
// <- TODO: [🏥] DRY
|
|
9922
10015
|
|
|
10016
|
+
/**
|
|
10017
|
+
* Number of padding lines to add at the end of the book content
|
|
10018
|
+
*
|
|
10019
|
+
* @public exported from `@promptbook/core`
|
|
10020
|
+
*/
|
|
10021
|
+
const PADDING_LINES = 11;
|
|
10022
|
+
/**
|
|
10023
|
+
* A function that adds padding to the book content
|
|
10024
|
+
*
|
|
10025
|
+
* Note: [🔂] This function is idempotent.
|
|
10026
|
+
*
|
|
10027
|
+
* @public exported from `@promptbook/core`
|
|
10028
|
+
*/
|
|
10029
|
+
function padBook(content) {
|
|
10030
|
+
if (!content) {
|
|
10031
|
+
return '\n'.repeat(PADDING_LINES);
|
|
10032
|
+
}
|
|
10033
|
+
const lines = content.split('\n');
|
|
10034
|
+
let trailingEmptyLines = 0;
|
|
10035
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
10036
|
+
const line = lines[i];
|
|
10037
|
+
if (line === undefined) {
|
|
10038
|
+
// Note: This should not happen in reality, but it's here to satisfy TypeScript's noUncheckedIndexedAccess option
|
|
10039
|
+
continue;
|
|
10040
|
+
}
|
|
10041
|
+
if (line.trim() === '') {
|
|
10042
|
+
trailingEmptyLines++;
|
|
10043
|
+
}
|
|
10044
|
+
else {
|
|
10045
|
+
break;
|
|
10046
|
+
}
|
|
10047
|
+
}
|
|
10048
|
+
if (trailingEmptyLines >= PADDING_LINES) {
|
|
10049
|
+
return content;
|
|
10050
|
+
}
|
|
10051
|
+
const linesToAdd = PADDING_LINES - trailingEmptyLines;
|
|
10052
|
+
return (content + '\n'.repeat(linesToAdd));
|
|
10053
|
+
}
|
|
10054
|
+
/**
|
|
10055
|
+
* TODO: [🧠] Maybe export
|
|
10056
|
+
*/
|
|
10057
|
+
|
|
9923
10058
|
/**
|
|
9924
10059
|
* Removes Markdown (or HTML) comments
|
|
9925
10060
|
*
|
|
@@ -9939,7 +10074,7 @@ function removeMarkdownComments(content) {
|
|
|
9939
10074
|
*/
|
|
9940
10075
|
function isFlatPipeline(pipelineString) {
|
|
9941
10076
|
pipelineString = removeMarkdownComments(pipelineString);
|
|
9942
|
-
pipelineString = spaceTrim(pipelineString);
|
|
10077
|
+
pipelineString = spaceTrim$2(pipelineString);
|
|
9943
10078
|
const isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
|
|
9944
10079
|
//const isLastLineReturnStatement = pipelineString.split('\n').pop()!.split('`').join('').startsWith('->');
|
|
9945
10080
|
const isBacktickBlockUsed = pipelineString.includes('```');
|
|
@@ -9965,6 +10100,7 @@ function deflatePipeline(pipelineString) {
|
|
|
9965
10100
|
if (!isFlatPipeline(pipelineString)) {
|
|
9966
10101
|
return pipelineString;
|
|
9967
10102
|
}
|
|
10103
|
+
pipelineString = spaceTrim$2(pipelineString);
|
|
9968
10104
|
const pipelineStringLines = pipelineString.split('\n');
|
|
9969
10105
|
const potentialReturnStatement = pipelineStringLines.pop();
|
|
9970
10106
|
let returnStatement;
|
|
@@ -9977,19 +10113,19 @@ function deflatePipeline(pipelineString) {
|
|
|
9977
10113
|
returnStatement = `-> {${DEFAULT_BOOK_OUTPUT_PARAMETER_NAME}}`;
|
|
9978
10114
|
pipelineStringLines.push(potentialReturnStatement);
|
|
9979
10115
|
}
|
|
9980
|
-
const prompt = spaceTrim(pipelineStringLines.join('\n'));
|
|
10116
|
+
const prompt = spaceTrim$2(pipelineStringLines.join('\n'));
|
|
9981
10117
|
let quotedPrompt;
|
|
9982
10118
|
if (prompt.split('\n').length <= 1) {
|
|
9983
10119
|
quotedPrompt = `> ${prompt}`;
|
|
9984
10120
|
}
|
|
9985
10121
|
else {
|
|
9986
|
-
quotedPrompt = spaceTrim((block) => `
|
|
10122
|
+
quotedPrompt = spaceTrim$2((block) => `
|
|
9987
10123
|
\`\`\`
|
|
9988
10124
|
${block(prompt.split('`').join('\\`'))}
|
|
9989
10125
|
\`\`\`
|
|
9990
10126
|
`);
|
|
9991
10127
|
}
|
|
9992
|
-
pipelineString = validatePipelineString(spaceTrim((block) => `
|
|
10128
|
+
pipelineString = validatePipelineString(spaceTrim$2((block) => `
|
|
9993
10129
|
# ${DEFAULT_BOOK_TITLE}
|
|
9994
10130
|
|
|
9995
10131
|
## Prompt
|
|
@@ -9999,7 +10135,7 @@ function deflatePipeline(pipelineString) {
|
|
|
9999
10135
|
${returnStatement}
|
|
10000
10136
|
`));
|
|
10001
10137
|
// <- TODO: Maybe use book` notation
|
|
10002
|
-
return pipelineString;
|
|
10138
|
+
return padBook(pipelineString);
|
|
10003
10139
|
}
|
|
10004
10140
|
/**
|
|
10005
10141
|
* TODO: Unit test
|
|
@@ -10053,7 +10189,7 @@ function extractAllListItemsFromMarkdown(markdown) {
|
|
|
10053
10189
|
function extractOneBlockFromMarkdown(markdown) {
|
|
10054
10190
|
const codeBlocks = extractAllBlocksFromMarkdown(markdown);
|
|
10055
10191
|
if (codeBlocks.length !== 1) {
|
|
10056
|
-
throw new ParseError(spaceTrim((block) => `
|
|
10192
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
10057
10193
|
There should be exactly 1 code block in task section, found ${codeBlocks.length} code blocks
|
|
10058
10194
|
|
|
10059
10195
|
${block(codeBlocks.map((block, i) => `Block ${i + 1}:\n${block.content}`).join('\n\n\n'))}
|
|
@@ -10078,7 +10214,7 @@ function parseMarkdownSection(value) {
|
|
|
10078
10214
|
}
|
|
10079
10215
|
const title = lines[0].replace(/^#+\s*/, '');
|
|
10080
10216
|
const level = (_b = (_a = lines[0].match(/^#+/)) === null || _a === void 0 ? void 0 : _a[0].length) !== null && _b !== void 0 ? _b : 0;
|
|
10081
|
-
const content = spaceTrim(lines.slice(1).join('\n'));
|
|
10217
|
+
const content = spaceTrim$2(lines.slice(1).join('\n'));
|
|
10082
10218
|
if (level < 1 || level > 6) {
|
|
10083
10219
|
throw new ParseError('Markdown section must have heading level between 1 and 6');
|
|
10084
10220
|
}
|
|
@@ -10106,7 +10242,7 @@ function splitMarkdownIntoSections(markdown) {
|
|
|
10106
10242
|
if (buffer.length === 0) {
|
|
10107
10243
|
return;
|
|
10108
10244
|
}
|
|
10109
|
-
let section = spaceTrim(buffer.join('\n'));
|
|
10245
|
+
let section = spaceTrim$2(buffer.join('\n'));
|
|
10110
10246
|
if (section === '') {
|
|
10111
10247
|
return;
|
|
10112
10248
|
}
|
|
@@ -10181,7 +10317,7 @@ function flattenMarkdown(markdown) {
|
|
|
10181
10317
|
flattenedMarkdown += `## ${title}` + `\n\n`;
|
|
10182
10318
|
flattenedMarkdown += content + `\n\n`; // <- [🧠] Maybe 3 new lines?
|
|
10183
10319
|
}
|
|
10184
|
-
return spaceTrim(flattenedMarkdown);
|
|
10320
|
+
return spaceTrim$2(flattenedMarkdown);
|
|
10185
10321
|
}
|
|
10186
10322
|
/**
|
|
10187
10323
|
* TODO: [🏛] This can be part of markdown builder
|
|
@@ -10887,6 +11023,7 @@ function $provideFilesystemForNode(options) {
|
|
|
10887
11023
|
writeFile,
|
|
10888
11024
|
readdir,
|
|
10889
11025
|
mkdir,
|
|
11026
|
+
watch,
|
|
10890
11027
|
};
|
|
10891
11028
|
}
|
|
10892
11029
|
/**
|
|
@@ -11174,10 +11311,10 @@ function $registeredLlmToolsMessage() {
|
|
|
11174
11311
|
var _a, _b;
|
|
11175
11312
|
const isMetadataAviailable = $llmToolsMetadataRegister
|
|
11176
11313
|
.list()
|
|
11177
|
-
.
|
|
11314
|
+
.some(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
|
|
11178
11315
|
const isInstalled = $llmToolsRegister
|
|
11179
11316
|
.list()
|
|
11180
|
-
.
|
|
11317
|
+
.some(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
|
|
11181
11318
|
const isFullyConfigured = ((_a = metadata.envVariables) === null || _a === void 0 ? void 0 : _a.every((envVariableName) => env[envVariableName] !== undefined)) || false;
|
|
11182
11319
|
const isPartiallyConfigured = ((_b = metadata.envVariables) === null || _b === void 0 ? void 0 : _b.some((envVariableName) => env[envVariableName] !== undefined)) || false;
|
|
11183
11320
|
// <- Note: [🗨]
|
|
@@ -11185,13 +11322,13 @@ function $registeredLlmToolsMessage() {
|
|
|
11185
11322
|
});
|
|
11186
11323
|
const usedEnvMessage = $usedEnvFilename === null ? `Unknown \`.env\` file` : `Used \`.env\` file:\n${$usedEnvFilename}`;
|
|
11187
11324
|
if (metadata.length === 0) {
|
|
11188
|
-
return spaceTrim((block) => `
|
|
11325
|
+
return spaceTrim$2((block) => `
|
|
11189
11326
|
No LLM providers are available.
|
|
11190
11327
|
|
|
11191
11328
|
${block(usedEnvMessage)}
|
|
11192
11329
|
`);
|
|
11193
11330
|
}
|
|
11194
|
-
return spaceTrim((block) => `
|
|
11331
|
+
return spaceTrim$2((block) => `
|
|
11195
11332
|
|
|
11196
11333
|
${block(usedEnvMessage)}
|
|
11197
11334
|
|
|
@@ -11237,7 +11374,7 @@ function $registeredLlmToolsMessage() {
|
|
|
11237
11374
|
morePieces.push(`Not configured`); // <- Note: Can not be configured via environment variables
|
|
11238
11375
|
}
|
|
11239
11376
|
}
|
|
11240
|
-
let providerMessage = spaceTrim(`
|
|
11377
|
+
let providerMessage = spaceTrim$2(`
|
|
11241
11378
|
${i + 1}) **${title}** \`${className}\` from \`${packageName}\`
|
|
11242
11379
|
${morePieces.join('; ')}
|
|
11243
11380
|
`);
|
|
@@ -11399,7 +11536,7 @@ function createLlmToolsFromConfiguration(configuration, options = {}) {
|
|
|
11399
11536
|
.find(({ packageName, className }) => llmConfiguration.packageName === packageName && llmConfiguration.className === className);
|
|
11400
11537
|
if (registeredItem === undefined) {
|
|
11401
11538
|
// console.log('$llmToolsRegister.list()', $llmToolsRegister.list());
|
|
11402
|
-
throw new Error(spaceTrim((block) => `
|
|
11539
|
+
throw new Error(spaceTrim$2((block) => `
|
|
11403
11540
|
There is no constructor for LLM provider \`${llmConfiguration.className}\` from \`${llmConfiguration.packageName}\`
|
|
11404
11541
|
Running in ${!$isRunningInBrowser() ? '' : 'browser environment'}${!$isRunningInNode() ? '' : 'node environment'}${!$isRunningInWebWorker() ? '' : 'worker environment'}
|
|
11405
11542
|
|
|
@@ -11467,14 +11604,14 @@ async function $provideLlmToolsFromEnv(options = {}) {
|
|
|
11467
11604
|
const configuration = await $provideLlmToolsConfigurationFromEnv();
|
|
11468
11605
|
if (configuration.length === 0) {
|
|
11469
11606
|
if ($llmToolsMetadataRegister.list().length === 0) {
|
|
11470
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
11607
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
11471
11608
|
No LLM tools registered, this is probably a bug in the Promptbook library
|
|
11472
11609
|
|
|
11473
11610
|
${block($registeredLlmToolsMessage())}}
|
|
11474
11611
|
`));
|
|
11475
11612
|
}
|
|
11476
11613
|
// TODO: [🥃]
|
|
11477
|
-
throw new Error(spaceTrim((block) => `
|
|
11614
|
+
throw new Error(spaceTrim$2((block) => `
|
|
11478
11615
|
No LLM tools found in the environment
|
|
11479
11616
|
|
|
11480
11617
|
${block($registeredLlmToolsMessage())}}
|
|
@@ -11605,6 +11742,9 @@ function nameToUriParts(name) {
|
|
|
11605
11742
|
}
|
|
11606
11743
|
|
|
11607
11744
|
/**
|
|
11745
|
+
* Normalizes a given text to PascalCase format.
|
|
11746
|
+
*
|
|
11747
|
+
* Note: [🔂] This function is idempotent.
|
|
11608
11748
|
*
|
|
11609
11749
|
* @param text @public exported from `@promptbook/utils`
|
|
11610
11750
|
* @returns
|
|
@@ -11829,8 +11969,8 @@ class JavascriptEvalExecutionTools {
|
|
|
11829
11969
|
}
|
|
11830
11970
|
// Note: [💎]
|
|
11831
11971
|
// Note: Using direct eval, following variables are in same scope as eval call so they are accessible from inside the evaluated script:
|
|
11832
|
-
const spaceTrim
|
|
11833
|
-
$preserve(spaceTrim
|
|
11972
|
+
const spaceTrim = (_) => spaceTrim$2(_);
|
|
11973
|
+
$preserve(spaceTrim);
|
|
11834
11974
|
const removeQuotes$1 = removeQuotes;
|
|
11835
11975
|
$preserve(removeQuotes$1);
|
|
11836
11976
|
const unwrapResult$1 = unwrapResult;
|
|
@@ -11883,7 +12023,7 @@ class JavascriptEvalExecutionTools {
|
|
|
11883
12023
|
// TODO: DRY [🍯]
|
|
11884
12024
|
const buildinFunctions = {
|
|
11885
12025
|
// TODO: [🍯] DRY all these functions across the file
|
|
11886
|
-
spaceTrim
|
|
12026
|
+
spaceTrim,
|
|
11887
12027
|
removeQuotes: removeQuotes$1,
|
|
11888
12028
|
unwrapResult: unwrapResult$1,
|
|
11889
12029
|
trimEndOfCodeBlock: trimEndOfCodeBlock$1,
|
|
@@ -11920,7 +12060,7 @@ class JavascriptEvalExecutionTools {
|
|
|
11920
12060
|
.join('\n');
|
|
11921
12061
|
// script = templateParameters(script, parameters);
|
|
11922
12062
|
// <- TODO: [🧠][🥳] Should be this is one of two variants how to use parameters in script
|
|
11923
|
-
const statementToEvaluate = spaceTrim((block) => `
|
|
12063
|
+
const statementToEvaluate = spaceTrim$2((block) => `
|
|
11924
12064
|
|
|
11925
12065
|
// Build-in functions:
|
|
11926
12066
|
${block(buildinFunctionsStatement)}
|
|
@@ -11935,7 +12075,7 @@ class JavascriptEvalExecutionTools {
|
|
|
11935
12075
|
(()=>{ ${script} })()
|
|
11936
12076
|
`);
|
|
11937
12077
|
if (this.options.isVerbose) {
|
|
11938
|
-
console.info(spaceTrim((block) => `
|
|
12078
|
+
console.info(spaceTrim$2((block) => `
|
|
11939
12079
|
🚀 Evaluating ${scriptLanguage} script:
|
|
11940
12080
|
|
|
11941
12081
|
${block(statementToEvaluate)}`));
|
|
@@ -11957,7 +12097,7 @@ class JavascriptEvalExecutionTools {
|
|
|
11957
12097
|
To: [PipelineExecutionError: Parameter `{thing}` is not defined],
|
|
11958
12098
|
*/
|
|
11959
12099
|
if (!statementToEvaluate.includes(undefinedName + '(')) {
|
|
11960
|
-
throw new PipelineExecutionError(spaceTrim((block) => `
|
|
12100
|
+
throw new PipelineExecutionError(spaceTrim$2((block) => `
|
|
11961
12101
|
|
|
11962
12102
|
Parameter \`{${undefinedName}}\` is not defined
|
|
11963
12103
|
|
|
@@ -11979,7 +12119,7 @@ class JavascriptEvalExecutionTools {
|
|
|
11979
12119
|
`));
|
|
11980
12120
|
}
|
|
11981
12121
|
else {
|
|
11982
|
-
throw new PipelineExecutionError(spaceTrim((block) => `
|
|
12122
|
+
throw new PipelineExecutionError(spaceTrim$2((block) => `
|
|
11983
12123
|
Function ${undefinedName}() is not defined
|
|
11984
12124
|
|
|
11985
12125
|
- Make sure that the function is one of built-in functions
|
|
@@ -12071,7 +12211,7 @@ async function isDirectoryExisting(directoryPath, fs) {
|
|
|
12071
12211
|
* @param path
|
|
12072
12212
|
* @param isRecursive
|
|
12073
12213
|
* @returns List of all files in the directory
|
|
12074
|
-
* @private internal function of `
|
|
12214
|
+
* @private internal function of `AgentCollectionInDirectory` and `createPipelineCollectionFromDirectory`
|
|
12075
12215
|
*/
|
|
12076
12216
|
async function listAllFiles(path, isRecursive, fs) {
|
|
12077
12217
|
if (!(await isDirectoryExisting(path, fs))) {
|
|
@@ -12099,26 +12239,27 @@ async function listAllFiles(path, isRecursive, fs) {
|
|
|
12099
12239
|
*/
|
|
12100
12240
|
|
|
12101
12241
|
/**
|
|
12102
|
-
* Constructs
|
|
12242
|
+
* Constructs `PipelineCollection` from async sources
|
|
12243
|
+
*
|
|
12103
12244
|
* It can be one of the following:
|
|
12104
12245
|
* - Promise of array of PipelineJson or PipelineString
|
|
12105
12246
|
* - Factory function that returns Promise of array of PipelineJson or PipelineString
|
|
12106
12247
|
*
|
|
12107
12248
|
* Note: This is useful as internal tool for other constructor functions like
|
|
12108
|
-
* `
|
|
12249
|
+
* `createPipelineCollectionFromUrl` or `createPipelineCollectionFromDirectory`
|
|
12109
12250
|
* Consider using those functions instead of this one
|
|
12110
12251
|
*
|
|
12111
12252
|
* Note: The function does NOT return promise it returns the collection directly which waits for the sources to be resolved
|
|
12112
12253
|
* when error occurs in given promise or factory function, it is thrown during `listPipelines` or `getPipelineByUrl` call
|
|
12113
12254
|
*
|
|
12114
|
-
* Note: Consider using `
|
|
12255
|
+
* Note: Consider using `createPipelineCollectionFromDirectory` or `createPipelineCollectionFromUrl`
|
|
12115
12256
|
*
|
|
12116
12257
|
* @param promptbookSourcesPromiseOrFactory
|
|
12117
12258
|
* @returns PipelineCollection
|
|
12118
12259
|
* @deprecated Do not use, it will became internal tool for other constructor functions
|
|
12119
12260
|
* @public exported from `@promptbook/core`
|
|
12120
12261
|
*/
|
|
12121
|
-
function
|
|
12262
|
+
function createPipelineCollectionFromPromise(promptbookSourcesPromiseOrFactory) {
|
|
12122
12263
|
let collection = null;
|
|
12123
12264
|
async function load() {
|
|
12124
12265
|
if (collection !== null) {
|
|
@@ -12129,7 +12270,7 @@ function createCollectionFromPromise(promptbookSourcesPromiseOrFactory) {
|
|
|
12129
12270
|
promptbookSourcesPromiseOrFactory = promptbookSourcesPromiseOrFactory();
|
|
12130
12271
|
}
|
|
12131
12272
|
const promptbookSources = await promptbookSourcesPromiseOrFactory;
|
|
12132
|
-
collection =
|
|
12273
|
+
collection = createPipelineCollectionFromJson(...promptbookSources);
|
|
12133
12274
|
}
|
|
12134
12275
|
async function listPipelines() {
|
|
12135
12276
|
await load();
|
|
@@ -12151,7 +12292,7 @@ function createCollectionFromPromise(promptbookSourcesPromiseOrFactory) {
|
|
|
12151
12292
|
}
|
|
12152
12293
|
|
|
12153
12294
|
/**
|
|
12154
|
-
* Constructs
|
|
12295
|
+
* Constructs `PipelineCollection` from given directory
|
|
12155
12296
|
*
|
|
12156
12297
|
* Note: Works only in Node.js environment because it reads the file system
|
|
12157
12298
|
*
|
|
@@ -12161,7 +12302,7 @@ function createCollectionFromPromise(promptbookSourcesPromiseOrFactory) {
|
|
|
12161
12302
|
* @returns PipelineCollection
|
|
12162
12303
|
* @public exported from `@promptbook/node`
|
|
12163
12304
|
*/
|
|
12164
|
-
async function
|
|
12305
|
+
async function createPipelineCollectionFromDirectory(rootPath, tools, options) {
|
|
12165
12306
|
if (tools === undefined) {
|
|
12166
12307
|
tools = await $provideExecutionToolsForNode();
|
|
12167
12308
|
}
|
|
@@ -12180,7 +12321,7 @@ async function createCollectionFromDirectory(rootPath, tools, options) {
|
|
|
12180
12321
|
// TODO: [🌗]
|
|
12181
12322
|
}
|
|
12182
12323
|
const { isRecursive = true, isVerbose = DEFAULT_IS_VERBOSE, isLazyLoaded = false, isCrashedOnError = true, rootUrl, } = options || {};
|
|
12183
|
-
const collection =
|
|
12324
|
+
const collection = createPipelineCollectionFromPromise(async () => {
|
|
12184
12325
|
if (isVerbose) {
|
|
12185
12326
|
console.info(colors.cyan(`Creating pipeline collection from path ${rootPath.split('\\').join('/')}`));
|
|
12186
12327
|
}
|
|
@@ -12225,7 +12366,7 @@ async function createCollectionFromDirectory(rootPath, tools, options) {
|
|
|
12225
12366
|
catch (error) {
|
|
12226
12367
|
assertsError(error);
|
|
12227
12368
|
// TODO: [7] DRY
|
|
12228
|
-
const wrappedErrorMessage = spaceTrim((block) => `
|
|
12369
|
+
const wrappedErrorMessage = spaceTrim$2((block) => `
|
|
12229
12370
|
${error.name} in pipeline ${fileName.split('\\').join('/')}:
|
|
12230
12371
|
|
|
12231
12372
|
Original error message:
|
|
@@ -12260,7 +12401,7 @@ async function createCollectionFromDirectory(rootPath, tools, options) {
|
|
|
12260
12401
|
pipeline = { ...pipeline, pipelineUrl };
|
|
12261
12402
|
}
|
|
12262
12403
|
else if (!pipeline.pipelineUrl.startsWith(rootUrl)) {
|
|
12263
|
-
throw new PipelineUrlError(spaceTrim(`
|
|
12404
|
+
throw new PipelineUrlError(spaceTrim$2(`
|
|
12264
12405
|
Pipeline with URL ${pipeline.pipelineUrl} is not a child of the root URL ${rootUrl} 🍏
|
|
12265
12406
|
|
|
12266
12407
|
File:
|
|
@@ -12298,7 +12439,7 @@ async function createCollectionFromDirectory(rootPath, tools, options) {
|
|
|
12298
12439
|
}
|
|
12299
12440
|
else {
|
|
12300
12441
|
const existing = collection.get(pipeline.pipelineUrl);
|
|
12301
|
-
throw new PipelineUrlError(spaceTrim(`
|
|
12442
|
+
throw new PipelineUrlError(spaceTrim$2(`
|
|
12302
12443
|
Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍏
|
|
12303
12444
|
|
|
12304
12445
|
Conflicting files:
|
|
@@ -12316,7 +12457,7 @@ async function createCollectionFromDirectory(rootPath, tools, options) {
|
|
|
12316
12457
|
catch (error) {
|
|
12317
12458
|
assertsError(error);
|
|
12318
12459
|
// TODO: [7] DRY
|
|
12319
|
-
const wrappedErrorMessage = spaceTrim((block) => `
|
|
12460
|
+
const wrappedErrorMessage = spaceTrim$2((block) => `
|
|
12320
12461
|
${error.name} in pipeline ${fileName.split('\\').join('/')}:
|
|
12321
12462
|
|
|
12322
12463
|
Original error message:
|
|
@@ -12343,7 +12484,7 @@ async function createCollectionFromDirectory(rootPath, tools, options) {
|
|
|
12343
12484
|
return collection;
|
|
12344
12485
|
}
|
|
12345
12486
|
/**
|
|
12346
|
-
* TODO: [🖇] What about symlinks? Maybe option isSymlinksFollowed
|
|
12487
|
+
* TODO: [🖇] What about symlinks? Maybe option `isSymlinksFollowed`
|
|
12347
12488
|
* TODO: Maybe move from `@promptbook/node` to `@promptbook/core` as we removes direct dependency on `fs`
|
|
12348
12489
|
*/
|
|
12349
12490
|
|
|
@@ -12373,7 +12514,7 @@ async function $provideScriptingForNode(options) {
|
|
|
12373
12514
|
*/
|
|
12374
12515
|
function stringifyPipelineJson(pipeline) {
|
|
12375
12516
|
if (!isSerializableAsJson(pipeline)) {
|
|
12376
|
-
throw new UnexpectedError(spaceTrim(`
|
|
12517
|
+
throw new UnexpectedError(spaceTrim$2(`
|
|
12377
12518
|
Cannot stringify the pipeline, because it is not serializable as JSON
|
|
12378
12519
|
|
|
12379
12520
|
There can be multiple reasons:
|
|
@@ -12508,5 +12649,5 @@ async function $execCommands({ commands, cwd, crashOnError, }) {
|
|
|
12508
12649
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
12509
12650
|
*/
|
|
12510
12651
|
|
|
12511
|
-
export { $execCommand, $execCommands, $provideExecutablesForNode, $provideExecutionToolsForNode, $provideFilesystemForNode, $provideLlmToolsConfigurationFromEnv, $provideLlmToolsFromEnv, $provideScrapersForNode, $provideScriptingForNode, BOOK_LANGUAGE_VERSION, FileCacheStorage, PROMPTBOOK_ENGINE_VERSION,
|
|
12652
|
+
export { $execCommand, $execCommands, $provideExecutablesForNode, $provideExecutionToolsForNode, $provideFilesystemForNode, $provideLlmToolsConfigurationFromEnv, $provideLlmToolsFromEnv, $provideScrapersForNode, $provideScriptingForNode, BOOK_LANGUAGE_VERSION, FileCacheStorage, PROMPTBOOK_ENGINE_VERSION, createPipelineCollectionFromDirectory };
|
|
12512
12653
|
//# sourceMappingURL=index.es.js.map
|