@promptbook/documents 0.103.0-1 → 0.103.0-100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +153 -89
- package/esm/index.es.js +299 -228
- package/esm/index.es.js.map +1 -1
- package/esm/typings/books/index.d.ts +0 -81
- package/esm/typings/servers.d.ts +9 -7
- package/esm/typings/src/_packages/browser.index.d.ts +6 -0
- package/esm/typings/src/_packages/cli.index.d.ts +4 -0
- package/esm/typings/src/_packages/components.index.d.ts +20 -8
- package/esm/typings/src/_packages/core.index.d.ts +58 -18
- package/esm/typings/src/_packages/node.index.d.ts +2 -2
- package/esm/typings/src/_packages/remote-server.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +58 -8
- package/esm/typings/src/_packages/utils.index.d.ts +6 -0
- package/esm/typings/src/_packages/wizard.index.d.ts +4 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +19 -5
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +17 -1
- package/esm/typings/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +3 -2
- package/esm/typings/src/book-2.0/agent-source/computeAgentHash.d.ts +8 -0
- package/esm/typings/src/book-2.0/agent-source/createCommitmentRegex.d.ts +3 -3
- package/esm/typings/src/book-2.0/agent-source/createDefaultAgentName.d.ts +8 -0
- package/esm/typings/src/book-2.0/agent-source/normalizeAgentName.d.ts +9 -0
- package/esm/typings/src/book-2.0/agent-source/padBook.d.ts +18 -0
- package/esm/typings/src/book-2.0/agent-source/parseAgentSourceWithCommitments.d.ts +1 -1
- package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +3 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +10 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfileTooltip.d.ts +15 -0
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +83 -8
- package/esm/typings/src/book-components/BookEditor/BookEditorActionbar.d.ts +14 -0
- package/esm/typings/src/book-components/BookEditor/BookEditorMonaco.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.d.ts +14 -0
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChatProps.d.ts +13 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +10 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +15 -0
- package/esm/typings/src/book-components/Chat/MockedChat/MockedChat.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +4 -0
- package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +5 -0
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgent.d.ts +29 -0
- package/esm/typings/src/book-components/Qr/BrandedQrCode.d.ts +18 -0
- package/esm/typings/src/book-components/Qr/GenericQrCode.d.ts +10 -0
- package/esm/typings/src/book-components/Qr/PromptbookQrCode.d.ts +18 -0
- package/esm/typings/src/book-components/Qr/useQrCode.d.ts +15 -0
- package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +15 -0
- package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +12 -0
- package/esm/typings/src/book-components/_common/Modal/Modal.d.ts +13 -0
- package/esm/typings/src/book-components/_common/Tooltip/Tooltip.d.ts +47 -0
- package/esm/typings/src/book-components/_common/react-utils/classNames.d.ts +1 -1
- package/esm/typings/src/book-components/icons/AboutIcon.d.ts +9 -0
- package/esm/typings/src/book-components/icons/CloseIcon.d.ts +4 -8
- package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +9 -0
- package/esm/typings/src/book-components/icons/ExitFullscreenIcon.d.ts +7 -0
- package/esm/typings/src/book-components/icons/FullscreenIcon.d.ts +7 -0
- package/esm/typings/src/book-components/icons/MenuIcon.d.ts +12 -0
- package/esm/typings/src/book-components/icons/MicIcon.d.ts +8 -0
- package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/about.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/hello.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/list-models.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/login.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/make.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/run.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/{start-server.d.ts → start-agents-server.d.ts} +3 -2
- package/esm/typings/src/cli/cli-commands/start-pipelines-server.d.ts +15 -0
- package/esm/typings/src/cli/cli-commands/test-command.d.ts +2 -1
- package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +2 -1
- package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +12 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +75 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabaseOptions.d.ts +10 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +154 -0
- package/esm/typings/src/collection/{PipelineCollection.d.ts → pipeline-collection/PipelineCollection.d.ts} +7 -3
- package/esm/typings/src/collection/{SimplePipelineCollection.d.ts → pipeline-collection/SimplePipelineCollection.d.ts} +5 -5
- package/esm/typings/src/collection/{constructors/createCollectionFromDirectory.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts} +8 -11
- package/esm/typings/src/collection/pipeline-collection/constructors/createPipelineCollectionFromJson.d.ts +13 -0
- package/esm/typings/src/collection/{constructors/createCollectionFromPromise.d.ts → pipeline-collection/constructors/createPipelineCollectionFromPromise.d.ts} +6 -5
- package/esm/typings/src/collection/pipeline-collection/constructors/createPipelineCollectionFromPromise.test.d.ts +1 -0
- package/esm/typings/src/collection/{constructors/createCollectionFromUrl.d.ts → pipeline-collection/constructors/createPipelineCollectionFromUrl.d.ts} +3 -3
- package/esm/typings/src/collection/{constructors/createSubcollection.d.ts → pipeline-collection/constructors/createPipelineSubcollection.d.ts} +3 -3
- package/esm/typings/src/collection/pipeline-collection/pipelineCollectionToJson.d.ts +13 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +4 -5
- package/esm/typings/src/{book-2.0/commitments → commitments}/ACTION/ACTION.d.ts +5 -1
- package/esm/typings/src/commitments/CLOSED/CLOSED.d.ts +35 -0
- package/esm/typings/src/commitments/COMPONENT/COMPONENT.d.ts +28 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/DELETE/DELETE.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/FORMAT/FORMAT.d.ts +5 -1
- package/esm/typings/src/commitments/FROM/FROM.d.ts +34 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/GOAL/GOAL.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/KNOWLEDGE/KNOWLEDGE.d.ts +5 -5
- package/esm/typings/src/commitments/LANGUAGE/LANGUAGE.d.ts +35 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/MEMORY/MEMORY.d.ts +5 -1
- package/esm/typings/src/commitments/MESSAGE/AgentMessageCommitmentDefinition.d.ts +32 -0
- package/esm/typings/src/commitments/MESSAGE/InitialMessageCommitmentDefinition.d.ts +32 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/MESSAGE/MESSAGE.d.ts +5 -1
- package/esm/typings/src/commitments/MESSAGE/UserMessageCommitmentDefinition.d.ts +32 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/META/META.d.ts +5 -1
- package/esm/typings/src/commitments/META_COLOR/META_COLOR.d.ts +48 -0
- package/esm/typings/src/commitments/META_FONT/META_FONT.d.ts +42 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/META_IMAGE/META_IMAGE.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/META_LINK/META_LINK.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/MODEL/MODEL.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/NOTE/NOTE.d.ts +5 -1
- package/esm/typings/src/commitments/OPEN/OPEN.d.ts +35 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/PERSONA/PERSONA.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/RULE/RULE.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/SAMPLE/SAMPLE.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/SCENARIO/SCENARIO.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/STYLE/STYLE.d.ts +5 -1
- package/esm/typings/src/commitments/USE/USE.d.ts +53 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +38 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.test.d.ts +1 -0
- package/esm/typings/src/commitments/USE_MCP/USE_MCP.d.ts +37 -0
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +38 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BaseCommitmentDefinition.d.ts +8 -2
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/CommitmentDefinition.d.ts +6 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/NotYetImplementedCommitmentDefinition.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/createEmptyAgentModelRequirements.d.ts +1 -1
- package/esm/typings/src/commitments/index.d.ts +93 -0
- package/esm/typings/src/config.d.ts +24 -3
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +2 -0
- package/esm/typings/src/errors/0-index.d.ts +6 -0
- package/esm/typings/src/errors/DatabaseError.d.ts +12 -0
- package/esm/typings/src/errors/NotAllowed.d.ts +9 -0
- package/esm/typings/src/errors/WrappedError.d.ts +2 -2
- package/esm/typings/src/execution/AvailableModel.d.ts +1 -0
- package/esm/typings/src/execution/Executables.d.ts +3 -0
- package/esm/typings/src/execution/ExecutionTask.d.ts +12 -3
- package/esm/typings/src/execution/ExecutionTools.d.ts +5 -0
- package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +21 -1
- package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +5 -0
- package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +5 -0
- package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +5 -0
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +5 -0
- package/esm/typings/src/execution/utils/usage-constants.d.ts +4 -124
- package/esm/typings/src/execution/utils/validatePromptResult.d.ts +2 -0
- package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +2 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +2 -2
- package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +2 -1
- package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/assertUniqueModels.d.ts +12 -0
- package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +70 -0
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +26 -4
- package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +19 -0
- package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +17 -0
- package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +50 -0
- package/esm/typings/src/llm-providers/agent/RemoteAgentOptions.d.ts +11 -0
- package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -19
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +60 -2
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +7 -1
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.test.d.ts +4 -0
- package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +1 -1
- package/esm/typings/src/pipeline/validatePipelineString.d.ts +2 -0
- package/esm/typings/src/playground/permanent/_boilerplate.d.ts +5 -0
- package/esm/typings/src/playground/permanent/agent-with-browser-playground.d.ts +5 -0
- package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +1 -0
- package/esm/typings/src/remote-server/startAgentServer.d.ts +26 -0
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +4 -1
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +3 -8
- package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -9
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
- package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +2 -1
- package/esm/typings/src/transpilers/_common/BookTranspiler.d.ts +33 -0
- package/esm/typings/src/transpilers/_common/BookTranspilerOptions.d.ts +18 -0
- package/esm/typings/src/transpilers/_common/register/$bookTranspilersRegister.d.ts +15 -0
- package/esm/typings/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.d.ts +16 -0
- package/esm/typings/src/transpilers/formatted-book-in-markdown/register.d.ts +15 -0
- package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.d.ts +16 -0
- package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.test.d.ts +1 -0
- package/esm/typings/src/transpilers/openai-sdk/playground/playground.d.ts +5 -0
- package/esm/typings/src/transpilers/openai-sdk/register.d.ts +15 -0
- package/esm/typings/src/types/LlmCall.d.ts +20 -0
- package/esm/typings/src/types/Updatable.d.ts +19 -0
- package/esm/typings/src/types/typeAliases.d.ts +32 -2
- package/esm/typings/src/utils/color/$randomColor.d.ts +1 -0
- package/esm/typings/src/utils/color/Color.d.ts +15 -0
- package/esm/typings/src/utils/color/Color.test.d.ts +1 -0
- package/esm/typings/src/utils/color/css-colors.d.ts +1 -0
- package/esm/typings/src/utils/color/internal-utils/checkChannelValue.d.ts +0 -3
- package/esm/typings/src/utils/color/operators/darken.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/grayscale.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/lighten.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/saturate.d.ts +1 -1
- package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +16 -0
- package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +2 -2
- package/esm/typings/src/utils/execCommand/$execCommand.d.ts +2 -1
- package/esm/typings/src/utils/execCommand/$execCommands.d.ts +2 -1
- package/esm/typings/src/utils/files/$induceBookDownload.d.ts +13 -0
- package/esm/typings/src/utils/files/$induceFileDownload.d.ts +13 -0
- package/esm/typings/src/utils/files/ObjectUrl.d.ts +46 -0
- package/esm/typings/src/utils/files/listAllFiles.d.ts +2 -3
- package/esm/typings/src/utils/misc/aboutPromptbookInformation.d.ts +27 -0
- package/esm/typings/src/utils/misc/computeHash.d.ts +11 -0
- package/esm/typings/src/utils/misc/computeHash.test.d.ts +1 -0
- package/esm/typings/src/utils/misc/injectCssModuleIntoShadowRoot.d.ts +1 -0
- package/esm/typings/src/utils/misc/xAboutPromptbookInformation.d.ts +13 -0
- package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +2 -0
- package/esm/typings/src/utils/normalization/normalizeMessageText.d.ts +9 -0
- package/esm/typings/src/utils/normalization/normalizeMessageText.test.d.ts +1 -0
- package/esm/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +3 -0
- package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +2 -0
- package/esm/typings/src/utils/normalization/titleToName.d.ts +2 -0
- package/esm/typings/src/utils/organization/$sideEffect.d.ts +2 -2
- package/esm/typings/src/utils/organization/$side_effect.d.ts +7 -0
- package/esm/typings/src/utils/organization/TODO_USE.d.ts +2 -2
- package/esm/typings/src/utils/organization/keepUnused.d.ts +2 -2
- package/esm/typings/src/utils/organization/preserve.d.ts +3 -3
- package/esm/typings/src/utils/organization/really_any.d.ts +7 -0
- package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +25 -0
- package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +9 -0
- package/esm/typings/src/utils/random/$randomFullnameWithColor.d.ts +13 -0
- package/esm/typings/src/utils/random/$randomItem.d.ts +9 -0
- package/esm/typings/src/utils/random/$randomSeed.d.ts +3 -0
- package/esm/typings/src/utils/random/$randomToken.d.ts +2 -0
- package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +2 -1
- package/esm/typings/src/utils/serialization/asSerializable.d.ts +2 -2
- package/esm/typings/src/utils/serialization/serializeToPromptbookJavascript.d.ts +2 -2
- package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +2 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/esm/typings/src/wizard/$getCompiledBook.d.ts +1 -2
- package/package.json +6 -6
- package/umd/index.umd.js +267 -196
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-2.0/commitments/index.d.ts +0 -60
- package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +0 -5
- package/esm/typings/src/book-components/BookEditor/config.d.ts +0 -10
- package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +0 -21
- package/esm/typings/src/collection/collectionToJson.d.ts +0 -13
- package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +0 -13
- /package/esm/typings/src/{book-components/Chat/utils/renderMarkdown.test.d.ts → book-2.0/agent-source/computeAgentHash.test.d.ts} +0 -0
- /package/esm/typings/src/{collection/constructors/createCollectionFromDirectory.test.d.ts → book-2.0/agent-source/normalizeAgentName.test.d.ts} +0 -0
- /package/esm/typings/src/{collection/constructors/createCollectionFromJson.test.d.ts → book-components/Chat/AgentChat/AgentChat.test.d.ts} +0 -0
- /package/esm/typings/src/collection/{constructors/createCollectionFromPromise.test.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.test.d.ts} +0 -0
- /package/esm/typings/src/{commands/_common/parseCommand.test.d.ts → collection/pipeline-collection/constructors/createPipelineCollectionFromJson.test.d.ts} +0 -0
- /package/esm/typings/src/collection/{collectionToJson.test.d.ts → pipeline-collection/pipelineCollectionToJson.test.d.ts} +0 -0
- /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BookCommitment.d.ts +0 -0
- /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/ParsedCommitment.d.ts +0 -0
package/umd/index.umd.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs/promises'), require('spacetrim'), require('child_process'), require('colors'), require('waitasecond'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('crypto'), require('rxjs'), require('crypto-js/sha256'), require('mime-types'), require('papaparse')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'fs/promises', 'spacetrim', 'child_process', 'colors', 'waitasecond', 'crypto-js', 'crypto-js/enc-hex', 'path', 'crypto', 'rxjs', 'crypto-js/sha256', 'mime-types', 'papaparse'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-documents"] = {}, global.promises, global.spaceTrim, global.child_process, global.colors, global.waitasecond, global.cryptoJs, global.hexEncoder, global.path, global.crypto, global.rxjs, global.sha256, global.mimeTypes, global.papaparse));
|
|
5
|
-
})(this, (function (exports, promises, spaceTrim, child_process, colors, waitasecond, cryptoJs, hexEncoder, path, crypto, rxjs, sha256, mimeTypes, papaparse) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-documents"] = {}, global.promises, global.spaceTrim$1, global.child_process, global.colors, global.waitasecond, global.cryptoJs, global.hexEncoder, global.path, global.crypto, global.rxjs, global.sha256, global.mimeTypes, global.papaparse));
|
|
5
|
+
})(this, (function (exports, promises, spaceTrim$1, child_process, colors, waitasecond, cryptoJs, hexEncoder, path, crypto, rxjs, sha256, mimeTypes, papaparse) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
|
-
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
|
|
9
|
+
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
|
|
10
10
|
var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
|
|
11
11
|
var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
|
|
12
12
|
var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
* @generated
|
|
19
19
|
* @see https://github.com/webgptorg/book
|
|
20
20
|
*/
|
|
21
|
-
const BOOK_LANGUAGE_VERSION = '
|
|
21
|
+
const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
22
22
|
/**
|
|
23
23
|
* The version of the Promptbook engine
|
|
24
24
|
*
|
|
25
25
|
* @generated
|
|
26
26
|
* @see https://github.com/webgptorg/promptbook
|
|
27
27
|
*/
|
|
28
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
28
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-100';
|
|
29
29
|
/**
|
|
30
30
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
31
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -48,6 +48,17 @@
|
|
|
48
48
|
function keepUnused(...valuesToKeep) {
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Trims string from all 4 sides
|
|
53
|
+
*
|
|
54
|
+
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
55
|
+
* Developed by same author @hejny as this package
|
|
56
|
+
*
|
|
57
|
+
* @public exported from `@promptbook/utils`
|
|
58
|
+
* @see https://github.com/hejny/spacetrim#usage
|
|
59
|
+
*/
|
|
60
|
+
const spaceTrim = spaceTrim$1.spaceTrim;
|
|
61
|
+
|
|
51
62
|
/**
|
|
52
63
|
* @private util of `@promptbook/color`
|
|
53
64
|
* @de
|
|
@@ -96,6 +107,7 @@
|
|
|
96
107
|
* @public exported from `@promptbook/color`
|
|
97
108
|
*/
|
|
98
109
|
const CSS_COLORS = {
|
|
110
|
+
promptbook: '#79EAFD',
|
|
99
111
|
transparent: 'rgba(0,0,0,0)',
|
|
100
112
|
aliceblue: '#f0f8ff',
|
|
101
113
|
antiquewhite: '#faebd7',
|
|
@@ -277,9 +289,6 @@
|
|
|
277
289
|
throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
|
|
278
290
|
}
|
|
279
291
|
}
|
|
280
|
-
/**
|
|
281
|
-
* TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
|
|
282
|
-
*/
|
|
283
292
|
|
|
284
293
|
/**
|
|
285
294
|
* Color object represents an RGB color with alpha channel
|
|
@@ -314,6 +323,28 @@
|
|
|
314
323
|
throw new Error(`Can not create color from given object`);
|
|
315
324
|
}
|
|
316
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* Creates a new Color instance from miscellaneous formats
|
|
328
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
329
|
+
*
|
|
330
|
+
* @param color
|
|
331
|
+
* @returns Color object
|
|
332
|
+
*/
|
|
333
|
+
static fromSafe(color) {
|
|
334
|
+
try {
|
|
335
|
+
return Color.from(color);
|
|
336
|
+
}
|
|
337
|
+
catch (error) {
|
|
338
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
339
|
+
console.warn(spaceTrim((block) => `
|
|
340
|
+
Color.fromSafe error:
|
|
341
|
+
${block(error.message)}
|
|
342
|
+
|
|
343
|
+
Returning default PROMPTBOOK_COLOR.
|
|
344
|
+
`));
|
|
345
|
+
return Color.fromString('promptbook');
|
|
346
|
+
}
|
|
347
|
+
}
|
|
317
348
|
/**
|
|
318
349
|
* Creates a new Color instance from miscellaneous string formats
|
|
319
350
|
*
|
|
@@ -381,6 +412,9 @@
|
|
|
381
412
|
if (hex.length === 3) {
|
|
382
413
|
return Color.fromHex3(hex);
|
|
383
414
|
}
|
|
415
|
+
if (hex.length === 4) {
|
|
416
|
+
return Color.fromHex4(hex);
|
|
417
|
+
}
|
|
384
418
|
if (hex.length === 6) {
|
|
385
419
|
return Color.fromHex6(hex);
|
|
386
420
|
}
|
|
@@ -401,6 +435,19 @@
|
|
|
401
435
|
const b = parseInt(hex.substr(2, 1), 16) * 16;
|
|
402
436
|
return take(new Color(r, g, b));
|
|
403
437
|
}
|
|
438
|
+
/**
|
|
439
|
+
* Creates a new Color instance from color in hex format with 4 digits (with alpha channel)
|
|
440
|
+
*
|
|
441
|
+
* @param color in hex for example `09df`
|
|
442
|
+
* @returns Color object
|
|
443
|
+
*/
|
|
444
|
+
static fromHex4(hex) {
|
|
445
|
+
const r = parseInt(hex.substr(0, 1), 16) * 16;
|
|
446
|
+
const g = parseInt(hex.substr(1, 1), 16) * 16;
|
|
447
|
+
const b = parseInt(hex.substr(2, 1), 16) * 16;
|
|
448
|
+
const a = parseInt(hex.substr(3, 1), 16) * 16;
|
|
449
|
+
return take(new Color(r, g, b, a));
|
|
450
|
+
}
|
|
404
451
|
/**
|
|
405
452
|
* Creates a new Color instance from color in hex format with 6 color digits (without alpha channel)
|
|
406
453
|
*
|
|
@@ -591,7 +638,8 @@
|
|
|
591
638
|
* @returns true if the value is a valid hex color string (e.g., `#009edd`, `#fff`, etc.)
|
|
592
639
|
*/
|
|
593
640
|
static isHexColorString(value) {
|
|
594
|
-
return typeof value === 'string' &&
|
|
641
|
+
return (typeof value === 'string' &&
|
|
642
|
+
/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value));
|
|
595
643
|
}
|
|
596
644
|
/**
|
|
597
645
|
* Creates new Color object
|
|
@@ -706,6 +754,23 @@
|
|
|
706
754
|
* TODO: Maybe connect with textures
|
|
707
755
|
*/
|
|
708
756
|
|
|
757
|
+
/**
|
|
758
|
+
* Makes color transformer which returns a grayscale version of the color
|
|
759
|
+
*
|
|
760
|
+
* @param amount from 0 to 1
|
|
761
|
+
*
|
|
762
|
+
* @public exported from `@promptbook/color`
|
|
763
|
+
*/
|
|
764
|
+
function grayscale(amount) {
|
|
765
|
+
return ({ red, green, blue, alpha }) => {
|
|
766
|
+
const average = (red + green + blue) / 3;
|
|
767
|
+
red = Math.round(average * amount + red * (1 - amount));
|
|
768
|
+
green = Math.round(average * amount + green * (1 - amount));
|
|
769
|
+
blue = Math.round(average * amount + blue * (1 - amount));
|
|
770
|
+
return Color.fromValues(red, green, blue, alpha);
|
|
771
|
+
};
|
|
772
|
+
}
|
|
773
|
+
|
|
709
774
|
/**
|
|
710
775
|
* Converts HSL values to RGB values
|
|
711
776
|
*
|
|
@@ -821,102 +886,6 @@
|
|
|
821
886
|
* TODO: Maybe implement by mix+hsl
|
|
822
887
|
*/
|
|
823
888
|
|
|
824
|
-
/**
|
|
825
|
-
* Calculates distance between two colors
|
|
826
|
-
*
|
|
827
|
-
* @param color1 first color
|
|
828
|
-
* @param color2 second color
|
|
829
|
-
*
|
|
830
|
-
* Note: This function is inefficient. Use colorDistanceSquared instead if possible.
|
|
831
|
-
*
|
|
832
|
-
* @public exported from `@promptbook/color`
|
|
833
|
-
*/
|
|
834
|
-
/**
|
|
835
|
-
* Calculates distance between two colors without square root
|
|
836
|
-
*
|
|
837
|
-
* @param color1 first color
|
|
838
|
-
* @param color2 second color
|
|
839
|
-
*
|
|
840
|
-
* @public exported from `@promptbook/color`
|
|
841
|
-
*/
|
|
842
|
-
function colorDistanceSquared(color1, color2) {
|
|
843
|
-
const rmean = (color1.red + color2.red) / 2;
|
|
844
|
-
const r = color1.red - color2.red;
|
|
845
|
-
const g = color1.green - color2.green;
|
|
846
|
-
const b = color1.blue - color2.blue;
|
|
847
|
-
const weightR = 2 + rmean / 256;
|
|
848
|
-
const weightG = 4.0;
|
|
849
|
-
const weightB = 2 + (255 - rmean) / 256;
|
|
850
|
-
const distance = weightR * r * r + weightG * g * g + weightB * b * b;
|
|
851
|
-
return distance;
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
/**
|
|
855
|
-
* Makes color transformer which finds the nearest color from the given list
|
|
856
|
-
*
|
|
857
|
-
* @param colors array of colors to choose from
|
|
858
|
-
*
|
|
859
|
-
* @public exported from `@promptbook/color`
|
|
860
|
-
*/
|
|
861
|
-
function nearest(...colors) {
|
|
862
|
-
return (color) => {
|
|
863
|
-
const distances = colors.map((c) => colorDistanceSquared(c, color));
|
|
864
|
-
const minDistance = Math.min(...distances);
|
|
865
|
-
const minIndex = distances.indexOf(minDistance);
|
|
866
|
-
const nearestColor = colors[minIndex];
|
|
867
|
-
return nearestColor;
|
|
868
|
-
};
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
/**
|
|
872
|
-
* Color transformer which returns the negative color
|
|
873
|
-
*
|
|
874
|
-
* @public exported from `@promptbook/color`
|
|
875
|
-
*/
|
|
876
|
-
function negative(color) {
|
|
877
|
-
const r = 255 - color.red;
|
|
878
|
-
const g = 255 - color.green;
|
|
879
|
-
const b = 255 - color.blue;
|
|
880
|
-
return Color.fromValues(r, g, b, color.alpha);
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
/**
|
|
884
|
-
* Makes color transformer which finds the furthest color from the given list
|
|
885
|
-
*
|
|
886
|
-
* @param colors array of colors to choose from
|
|
887
|
-
*
|
|
888
|
-
* @public exported from `@promptbook/color`
|
|
889
|
-
*/
|
|
890
|
-
function furthest(...colors) {
|
|
891
|
-
return (color) => {
|
|
892
|
-
const furthestColor = negative(nearest(...colors.map(negative))(color));
|
|
893
|
-
return furthestColor;
|
|
894
|
-
};
|
|
895
|
-
}
|
|
896
|
-
/**
|
|
897
|
-
* Makes color transformer which finds the best text color (black or white) for the given background color
|
|
898
|
-
*
|
|
899
|
-
* @public exported from `@promptbook/color`
|
|
900
|
-
*/
|
|
901
|
-
furthest(Color.get('white'), Color.from('black'));
|
|
902
|
-
|
|
903
|
-
/**
|
|
904
|
-
* Makes color transformer which returns a grayscale version of the color
|
|
905
|
-
*
|
|
906
|
-
* @param amount from 0 to 1
|
|
907
|
-
*
|
|
908
|
-
* @public exported from `@promptbook/color`
|
|
909
|
-
*/
|
|
910
|
-
function grayscale(amount) {
|
|
911
|
-
return ({ red, green, blue, alpha }) => {
|
|
912
|
-
const average = (red + green + blue) / 3;
|
|
913
|
-
red = Math.round(average * amount + red * (1 - amount));
|
|
914
|
-
green = Math.round(average * amount + green * (1 - amount));
|
|
915
|
-
blue = Math.round(average * amount + blue * (1 - amount));
|
|
916
|
-
return Color.fromValues(red, green, blue, alpha);
|
|
917
|
-
};
|
|
918
|
-
}
|
|
919
|
-
|
|
920
889
|
/**
|
|
921
890
|
* Makes color transformer which saturate the given color
|
|
922
891
|
*
|
|
@@ -985,16 +954,32 @@
|
|
|
985
954
|
*
|
|
986
955
|
* @public exported from `@promptbook/core`
|
|
987
956
|
*/
|
|
988
|
-
const PROMPTBOOK_COLOR = Color.
|
|
989
|
-
// <- TODO: [🧠] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
957
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
958
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
959
|
+
/**
|
|
960
|
+
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
961
|
+
*
|
|
962
|
+
* TODO: [🗽] Unite branding and make single place for it
|
|
963
|
+
*
|
|
964
|
+
* @public exported from `@promptbook/core`
|
|
965
|
+
*/
|
|
966
|
+
({
|
|
967
|
+
TITLE: Color.fromHex('#244EA8'),
|
|
968
|
+
LINE: Color.fromHex('#eeeeee'),
|
|
969
|
+
SEPARATOR: Color.fromHex('#cccccc'),
|
|
970
|
+
COMMITMENT: Color.fromHex('#DA0F78'),
|
|
971
|
+
PARAMETER: Color.fromHex('#8e44ad'),
|
|
972
|
+
});
|
|
973
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
990
974
|
/**
|
|
991
|
-
*
|
|
975
|
+
* Chat color of the Promptbook (in chat)
|
|
992
976
|
*
|
|
993
977
|
* TODO: [🗽] Unite branding and make single place for it
|
|
994
978
|
*
|
|
995
979
|
* @public exported from `@promptbook/core`
|
|
996
980
|
*/
|
|
997
981
|
PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
|
|
982
|
+
// <- TODO: [🧠][🈵] Using `Color` and `lighten`, `saturate`,... here increases the package size approx 3kb, maybe remove it
|
|
998
983
|
/**
|
|
999
984
|
* Color of the user (in chat)
|
|
1000
985
|
*
|
|
@@ -1003,6 +988,7 @@
|
|
|
1003
988
|
* @public exported from `@promptbook/core`
|
|
1004
989
|
*/
|
|
1005
990
|
Color.fromHex('#1D4ED8');
|
|
991
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
1006
992
|
/**
|
|
1007
993
|
* When the title is not provided, the default title is used
|
|
1008
994
|
*
|
|
@@ -1089,7 +1075,7 @@
|
|
|
1089
1075
|
* @public exported from `@promptbook/core`
|
|
1090
1076
|
*/
|
|
1091
1077
|
const DEFAULT_MAX_EXECUTION_ATTEMPTS = 7; // <- TODO: [🤹♂️]
|
|
1092
|
-
// <- TODO: [🕝] Make also `
|
|
1078
|
+
// <- TODO: [🕝] Make also `AGENTS_DIRNAME_ALTERNATIVES`
|
|
1093
1079
|
// TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
|
|
1094
1080
|
/**
|
|
1095
1081
|
* Where to store the temporary downloads
|
|
@@ -1191,7 +1177,7 @@
|
|
|
1191
1177
|
*/
|
|
1192
1178
|
class MissingToolsError extends Error {
|
|
1193
1179
|
constructor(message) {
|
|
1194
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1180
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1195
1181
|
${block(message)}
|
|
1196
1182
|
|
|
1197
1183
|
Note: You have probably forgot to provide some tools for pipeline execution or preparation
|
|
@@ -1253,7 +1239,7 @@
|
|
|
1253
1239
|
*/
|
|
1254
1240
|
class UnexpectedError extends Error {
|
|
1255
1241
|
constructor(message) {
|
|
1256
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1242
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1257
1243
|
${block(message)}
|
|
1258
1244
|
|
|
1259
1245
|
Note: This error should not happen.
|
|
@@ -1414,11 +1400,11 @@
|
|
|
1414
1400
|
console.warn(`Command "${humanReadableCommand}" exited with code ${code}`);
|
|
1415
1401
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
1416
1402
|
}
|
|
1417
|
-
resolve(spaceTrim.spaceTrim(output.join('\n')));
|
|
1403
|
+
resolve(spaceTrim$1.spaceTrim(output.join('\n')));
|
|
1418
1404
|
}
|
|
1419
1405
|
}
|
|
1420
1406
|
else {
|
|
1421
|
-
resolve(spaceTrim.spaceTrim(output.join('\n')));
|
|
1407
|
+
resolve(spaceTrim$1.spaceTrim(output.join('\n')));
|
|
1422
1408
|
}
|
|
1423
1409
|
};
|
|
1424
1410
|
commandProcess.on('close', finishWithCode);
|
|
@@ -1436,7 +1422,7 @@
|
|
|
1436
1422
|
console.warn(error);
|
|
1437
1423
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
1438
1424
|
}
|
|
1439
|
-
resolve(spaceTrim.spaceTrim(output.join('\n')));
|
|
1425
|
+
resolve(spaceTrim$1.spaceTrim(output.join('\n')));
|
|
1440
1426
|
}
|
|
1441
1427
|
});
|
|
1442
1428
|
}
|
|
@@ -1761,6 +1747,8 @@
|
|
|
1761
1747
|
/**
|
|
1762
1748
|
* Converts a given text to kebab-case format.
|
|
1763
1749
|
*
|
|
1750
|
+
* Note: [🔂] This function is idempotent.
|
|
1751
|
+
*
|
|
1764
1752
|
* @param text The text to be converted.
|
|
1765
1753
|
* @returns The kebab-case formatted string.
|
|
1766
1754
|
* @example 'hello-world'
|
|
@@ -1916,6 +1904,8 @@
|
|
|
1916
1904
|
/**
|
|
1917
1905
|
* Converts a title string into a normalized name.
|
|
1918
1906
|
*
|
|
1907
|
+
* Note: [🔂] This function is idempotent.
|
|
1908
|
+
*
|
|
1919
1909
|
* @param value The title string to be converted to a name.
|
|
1920
1910
|
* @returns A normalized name derived from the input title.
|
|
1921
1911
|
* @example 'Hello World!' -> 'hello-world'
|
|
@@ -2007,7 +1997,7 @@
|
|
|
2007
1997
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
2008
1998
|
*/
|
|
2009
1999
|
|
|
2010
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n```json\n{availableModels}\n```\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book"},{title:"📊 Curriculum Audit",pipelineUrl:"https://promptbook.studio/promptbook//examples/lsvp-asistent.book",formfactorName:"GENERIC",parameters:[{name:"result",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"prompt",title:"Prompt",content:"Asistent pro LŠVP\n\nPERSONA Jsi asistent pro RVP Lyceum v rámci Národního pedagogického institutu České Republiky\nMETA IMAGE https://edulk.cz/getFile/id:475818/type:large/02%20zna%C4%8Dka%20npi.jpg\nRULE Pokud jsi nejsi jistý, napiš nevím\nKNOWLEDGE ./241129_Lyceum_final.pdf\nCONTEXT Obecně dokážeš řešit libovolné ŠVP, aktuálně řešíš {Školní vzdělávací program LYCEUM}\nRULE Z {Porovnání RVP a ŠVP - postup} je nejdůležitější fáze 3\nKNOWLEDGE {Školní vzdělávací program LYCEUM} ./ŠVP Lyceum - Finance v digitální době.pdf\nKNOWLEDGE @Slovník\n\n**Interní slovník - RVP/ŠVP**\n\n**RVP**\n\nRámcový vzdělávací program pro obor vzdělání Lyceum je dokument na národní úrovni, který formuluje požadavky na školní vzdělávací programy ve formě především očekávaných výsledků učení, kterých mají žáci absolvováním tohoto programu na dané škole dosáhnout.\n\n**ŠVP**\n\nŠkolní vzdělávací program pro obor vzdělání Lyceum je dokument každé jednotlivé školy, který popisuje v jakých vyučovacích předmětech/ vzdělávacích modulech a v jakých ročnících budou požadované očekávané výsledky učení naplněny. Zároveň formuluje další očekávané výsledky učení, které naplňují disponibilní část vyučovacího času určeného RVP pro tento obor vzdělání.\n\n**Očekávaný výsledek učení (OVU)**\n\nVyjadřuje jednotlivý požadavek na to, co mají žáci umět na konci vzdělávacího programu, tzn. jejich požadované kompetence. Je vyjádřen formulací, která je uvozena činnostním slovesem a dále obsahuje předmět této činnosti. Formulace je konkretizována resp. doplněna zpravidla formou odrážek vymezením dílčích znalostí, dovedností, postojů, jejichž splnění je předpokladem dosažení OVU jako celku.\n\n_Příklad:_\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th><p><strong>Žák/žákyně řídí realizaci jednoduchého projektu</strong></p></th></tr><tr><td><ul><li>naplánuje aktivity projektu</li></ul></td></tr><tr><td><ul><li>navrhne rozpočet projektu vzhledem k navrženým aktivitám</li></ul></td></tr><tr><td><ul><li>stanoví základní ukazatele a sleduje jejich naplňování</li></ul></td></tr><tr><td><ul><li>vede projektový tým</li></ul></td></tr><tr><td><ul><li>uvede, jak by řešil krizové situace v projektu</li></ul></td></tr><tr><td><ul><li>vyhodnotí úspěšnost projektu</li></ul></td></tr></tbody></table></div>\n\n**Vzdělávací oblasti**\n\nOčekávané výsledky učení jsou v **_RVP členěny do 4 vzdělávacích oblastí_**, které tvoří společný všeobecně vzdělávací základ:\n\n- Osobnostní rozvoj, vzdělávání ke zdraví, bezpečí a produktivnímu pracovnímu životu (kariéře)\n- Komunikační a jazykové vzdělávání\n- Aplikované vzdělávání STEM (Science, Technology, Engeneering, Math), tj. přírodní vědy, informatika, technika, matematika\n- Prakticky orientované vzdělávání společenskovědní a humanitní\n\nKaždá vzdělávací oblast se dále člení na okruhy, v jejichž rámci jsou OVU samostatně číslované.\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th rowspan=\"21\"><ul><li>Prakticky orientované vzdělávání společenskovědní a humanitní</li></ul></th><th rowspan=\"21\"><p><strong>Člověk, ekonomie a podnikání</strong></p></th><th rowspan=\"7\"><p><strong>1</strong></p></th><th><p><strong>zpracuje podklady související s podnikáním</strong></p></th></tr><tr><td><p>připraví podnikatelský záměr</p></td></tr><tr><td><p>sestaví zakladatelský rozpočet</p></td></tr><tr><td><p>zkalkuluje cenu zboží nebo služby</p></td></tr><tr><td><p>vysvětlí na příkladu základní povinnosti podnikatele vůči státu a zaměstnancům</p></td></tr><tr><td><p>vede daňovou evidenci</p></td></tr><tr><td><p>vysvětlí na příkladech etiku v podnikání</p></td></tr><tr><td rowspan=\"7\"><p><strong>2</strong></p></td><td><p><strong>řídí realizaci jednoduchého projektu</strong></p></td></tr><tr><td><p>naplánuje aktivity projektu</p></td></tr><tr><td><p>navrhne rozpočet projektu vzhledem k navrženým aktivitám</p></td></tr><tr><td><p>stanoví základní ukazatele a sleduje jejich naplňování</p></td></tr><tr><td><p>vede projektový tým</p></td></tr><tr><td><p>uvede, jak by řešil krizové situace v projektu</p></td></tr><tr><td><p>vyhodnotí úspěšnost projektu</p></td></tr><tr><td rowspan=\"7\"><p><strong>3</strong></p></td><td><p><strong>aplikuje ekonomické teorie v osobním a profesním životě</strong></p></td></tr><tr><td><p>vysvětlí základní ekonomické otázky</p></td></tr><tr><td><p>vysvětí stanovení rovnovážné ceny na dokonalém i nedokonalém trhu</p></td></tr><tr><td><p>charakterizuje výrobní faktory a vysvětlí hranici produkčních možností a náklady obětované příležitosti</p></td></tr><tr><td><p>uvede nejdůležitější makroekonomické pojmy a vliv jejich výše na kvalitu života a podnikání v daném státě</p></td></tr><tr><td><p>vysvětlí podstatu inflace a její důsledky na finanční situaci obyvatel a na příkladu ukáže jak se bránit jejím nepříznivým důsledkům</p></td></tr><tr><td><p>uvede hlavní výhody a nevýhody mezinárodního obchodu a vliv ochranářských opatření na ekonomickou situaci dané země</p></td></tr><tr><td></td><td></td><td><p><strong>4</strong></p></td><td><p>Atd.</p></td></tr></tbody></table></div>\n\n**Vyučovací předmět / vzdělávací modul**\n\nOčekávané výsledky učení jsou v **ŠVP** členěny do vyučovacích předmětů nebo vzdělávacích modulů, které jsou dále zařazeny do jednoho nebo více ročníků 4letého studia. Vyučovací předmět / vzdělávací modul tvoří vyučovací jednotku, kde jsou očekávané výsledky učení dále rozpracovány pro potřeby výuky podle následující šablony\n\n| **A. VSTUPNÍ ČÁST** |\n| --- |\n| **1\\. Název** |\n| **2\\. Kód** (kódy by měly být navázány na obory vzdělání a výsledky učení) |\n| **2a) Kategorie vzdělání** - v případě, že nebude součástí kódu |\n| **3\\. Typ vyučovací jednotky** (modul, předmět, stáž apod.) |\n| **4\\. Délka** (počet hodin - dělitelný čtyřmi (optimální modul 16, 32 hodin = týden výuky) |\n| **5\\. Platnost** (datum, od kterého platí) |\n| **6\\. Vstupní předpoklady** (vymezení požadované úrovně vstupních vědomostí a dovedností, které jsou předpokladem úspěšného studia) |\n| |\n| **B. JÁDRO VYUČOVACÍ JEDNOTKY** |\n| **1\\. Charakteristika** (stručná anotace popisující obecné cíle a pojetí) |\n| **2\\. Očekávané výsledky učení a jejich indikátory (převzaté z RVP nebo dále konkretizované)** |\n| **3\\. Podpora rozvoje klíčových kompetencí a základních gramotností** (které klíčové kompetence jsou v rozvíjeny) |\n| **4\\. Obsah vzdělávání** (rozpis učiva) |\n| **5\\. Vzdělávací strategie** (strategie výuky, resp. učební činnosti žáků, které jsou doporučené pro dosažení výsledků) |\n| |\n| **C. VÝSTUPNÍ ČÁST** |\n| **1\\. Způsob ověřování dosažených výsledků** (ve vazbě na jednotlivé výsledky učení) |\n| **2\\. Kritéria hodnocení** (co znamená splnění výsledků učení, kdy je splněna celá vyučovací jednotka, kritéria pro známky, příp. procentuální, slovní hodnocení) |\n| **3\\. Doporučená studijní literatura, odkazy na ilustrační zdroje** |\n| **4\\. Poznámky** |\n\n**Soulad OVU RVP a ŠVP**\n\nTento soulad je předmětem zjišťování. Soulad nastává, jestliže jsou očekávané výsledky učení z jednotlivých vzdělávacích oblastí RVP **obsaženy** ve vyučovacích předmětech/ vzdělávacích modulech ŠVP jednotlivých škol, tzn. že v ŠVP se objevuje jejich formulace buď v doslovném nebo podobném znění v jednom nebo více vyučovacích předmětech/ vzdělávacích modulech.\n\n_Příklad souladu:_\n\nRVP ŠVP - komunikace a marketing (SŠ obchodní Č.\n\n| **2** | **řídí realizaci jednoduchého projektu** |\n| --- | --- |\n| naplánuje aktivity projektu |\n| navrhne rozpočet projektu vzhledem k navrženým aktivitám |\n| stanoví základní ukazatele a sleduje jejich naplňování |\n| vede projektový tým |\n| uvede, jak by řešil krizové situace v projektu |\n| vyhodnotí úspěšnost projektu |\n\nKNOWLEDGE {Porovnání RVP a ŠVP - postup}\n\n\n# AUDITNÍ PROTOKOL ŠVP-RVP\n\n# (POPIS KONTROLNÍHO ALGORITMU)\n\nMetodika je určena pro **Kvantifikaci Shody** školního vzdělávacího programu (ŠVP) s Rámcovým vzdělávacím programem (RVP).\n\n## FÁZE 1: VALIDACE DOKUMENTACE\n\n**Cíl:** Ověřit platnost, aktuálnost a strukturu zdrojových dokumentů.\n\n- **RVP Verifikace:** Otevřít aktuální verzi RVP (např. RVP ZV/G/SOŠ).\n- **Typová shoda:** Ověřit, že RVP se vztahuje k danému typu školy.\n- **ŠVP Dimenze:** Identifikovat a izolovat relevantní části ŠVP: Profil absolventa, Klíčové kompetence (KK), Vzdělávací oblasti (VO), případně Učební plán (UP).\n- **Verzování:** Potvrdit, že obě verze (RVP a ŠVP) jsou nejnovější a platné (včetně dodatků RVP).\n\n## FÁZE 2: DATABÁZOVÉ MAPOVÁNÍ VÝSTUPŮ (MASTER MATICE)\n\n**Cíl:** Vytvořit systémovou databázi pro křížové porovnání všech povinných komponent RVP se ŠVP.\n\n- **Dekompozice RVP:** Rozložit RVP na základní povinné komponenty: Klíčové kompetence, Vzdělávací oblasti a obory, Očekávané výstupy (OVU), Průřezová témata (PT).\n- **Přiřazovací mapa:** Vytvořit hlavní kontrolní matici (Master Matice) pro záznam vazeb.\n\n| Oblast RVP | Výstup RVP (OVU) | Odpovídající Část ŠVP (Předmět/Ročník) | Konkrétní Tématický Celek v ŠVP | Stav Shody (Protokol) |\n| --- | --- | --- | --- | --- |\n| ... | ... | ... | ... | ... |\n| --- | --- | --- | --- | --- |\n\n## FÁZE 3: ALGORITMICKÁ KONTROLA POKRYTÍ A HLOUBKY\n\n**Cíl:** Posoudit, zda každý povinný výstup RVP je adekvátně reflektován v obsahu ŠVP, a přidělit bodovou hodnotu pro kvantifikaci.\n\n- **Audit OVU:** Projít každý jednotlivý Očekávaný výstup (OVU) z RVP.\n- **Kódování stavu a bodování:** U každého OVU v matici označit stav pokrytí dle následujícího schématu:\n\n| Kód (Protokol) | Popis (Kvalitativní zjištění) | Bodová hodnota (Kvantifikace) |\n| --- | --- | --- |\n| ✅ | Plná shoda (Výstup pokryt v plném rozsahu, odpovídající úrovni RVP) | 1,0 |\n| --- | --- | --- |\n| ⚠️ | Částečná shoda (Formální pokrytí, omezený rozsah, chybná návaznost) | 0,5 |\n| --- | --- | --- |\n| ❌ | Absence (Výstup zcela chybí v obsahu ŠVP) | 0,0 |\n| --- | --- | --- |\n\n- **Defektologie ŠVP:** Identifikovat a zaznamenat deficity ŠVP: Chybějící výstupy (❌), Sémantické překryvy, Přetížení obsahu.\n- **Kvalitativní posun:** Ověřit, zda je formulace výstupů v ŠVP **aktivní, měřitelná a v souladu** s úrovní RVP.\n\n## FÁZE 4: STRUKTURÁLNÍ VERIFIKACE NÁVAZNOSTI (VERTIKÁLA/HORIZONTÁLA)\n\n**Cíl:** Zkontrolovat logickou posloupnost a provázanost učiva v rámci ŠVP.\n\n- **Vertikální Kontrola:** Ověřit posloupnost OVU a učiva uvnitř jednoho předmětu/oblasti (postup od jednodušších ke složitějším konceptům napříč ročníky).\n- **Horizontální Kontrola:** Zkontrolovat logické provázání napříč vzdělávacími oblastmi a předměty (např. fyzika ↔ matematika).\n- **PT Integrace:** Audit reálné integrace Průřezových témat (PT) do konkrétních částí obsahu, metod a projektů.\n\n## FÁZE 5: ANALÝZA ŠKOLNÍ PROFILACE A ROZŠÍŘENÍ RVP\n\n**Cíl:** Validovat, že profilace školy je **v souladu** s RVP a nejedná se o **rozpor**.\n\n- **Nekonfliktnost:** Porovnat definovaný Profil absolventa školy s Klíčovými kompetencemi RVP. Profil ŠVP musí RVP rozvíjet, nikoli mu odporovat.\n- **Modularita:** Zkontrolovat, zda volitelné předměty a rozšiřující moduly logicky navazují na vzdělávací oblasti RVP.\n- **Implementace specializace:** Popisně uvést, jak je školní profilace (např. STEM zaměření, projektová výuka) integrována do OVU a kompetencí definovaných RVP.\n\n## FÁZE 6: GENERÁTOR ZÁVĚREČNÉ ZPRÁVY A KVANTIFIKACE\n\n**Cíl:** Syntetizovat výsledky, kvantifikovat soulad a generovat závazné návrhy na korekce.\n\n### 6.1 Kvantifikace Souladu\n\nVypočítat Index shody (IS) na základě bodového hodnocení (Fáze 3):\n\n### 6.2 Interpretace Indexu Shody (IS)\n\nKlasifikace souladu pro standardizované vyhodnocení:\n\n| Interval IS | Klasifikace souladu | Popis |\n| --- | --- | --- |\n| 95-100 % | Výborný soulad | ŠVP plně odpovídá RVP, pouze stylistické nebo formální rozdíly. |\n| --- | --- | --- |\n| 85-94 % | Dobrá shoda | ŠVP pokrývá všechny klíčové výstupy, menší korekce nutné. |\n| --- | --- | --- |\n| 70-84 % | Částečná shoda | Významné nedostatky v některých oblastech, nutná revize obsahu. |\n| --- | --- | --- |\n| < 70 % | Kritická neshoda | ŠVP neplní rámcové požadavky, ohrožuje legislativní soulad. |\n| --- | --- | --- |\n\n### 6.3 Doplňkové Indexy\n\nVypočítat následující doplňkové indexy pro detailní kvalitativní analýzu:\n\n- **Index kompetenčního souladu (IKS):** Poměr pokrytí klíčových kompetencí RVP v ŠVP.\n- **Index průřezové integrace (IPI):** Míra reálné integrace průřezových témat do výuky.\n- **Index hloubky pokrytí (IHP):** Procento výstupů, které jsou v ŠVP rozvedeny na konkrétní výukové cíle (měřitelné, aktivní formulace).\n- **Index profilové rozšiřitelnosti (IPR):** Kolik rozšiřujících nebo profilových výstupů přesahuje rámec RVP, aniž by narušily jeho strukturu.\n\n### 6.4 Vizuální výstupy\n\nZajistit generování následujících vizualizací pro Závěrečnou zprávu:\n\n- Graf pokrytí po vzdělávacích oblastech (Sloupcový graf IS pro VO).\n- Pavoukový diagram Klíčových kompetencí (RVP vs. ŠVP).\n- Mapa defektů (Vizualizace ❌ a ⚠️ výstupů).\n\n### 6.5 Struktura Závěrečné Zprávy\n\nZpráva musí být strukturována dle standardizovaného formátu:\n\n| Oddíl | Obsah |\n| --- | --- |\n| A. Identifikace | Název školy, IZO, typ školy, datum revize, zpracovatel, verze ŠVP a RVP. |\n| --- | --- |\n| B. Shrnutí výsledků | Celkový Index Shody (IS), hlavní závěry a doporučení. |\n| --- | --- |\n| C. Kvantitativní analýza | Přehled IS v % dle kategorií OVU / VO / kompetencí. |\n| --- | --- |\n| D. Kvalitativní analýza | Slovní zhodnocení kvality souladu (formulace, obtížnost, integrace PT). |\n| --- | --- |\n| E. Rizikové oblasti | Přehled nalezených defektů (chybějící OVU, přetížení, formální shoda). |\n| --- | --- |\n| F. Návrhy opatření (Korekční plán) | Přesné návrhy změn - **Co, Kde, Kdo** má upravit, včetně termínu. |\n| --- | --- |\n| G. Přílohy | Master Matice (Fáze 2-3), revizní tabulka, výstupní grafy a metriky. |\n| --- | --- |\n\n\n\n\n.",resultingParameterName:"result",dependentParameterNames:[]}],personas:[],preparations:[{id:1,promptbookVersion:"0.103.0-0",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"Asistent pro LŠVP\n\nPERSONA Jsi asistent pro RVP Lyceum v rámci Národního pedagogického institutu České Republiky\nMETA IMAGE https://edulk.cz/getFile/id:475818/type:large/02%20zna%C4%8Dka%20npi.jpg\nRULE Pokud jsi nejsi jistý, napiš nevím\nKNOWLEDGE ./241129_Lyceum_final.pdf\nCONTEXT Obecně dokážeš řešit libovolné ŠVP, aktuálně řešíš {Školní vzdělávací program LYCEUM}\nRULE Z {Porovnání RVP a ŠVP - postup} je nejdůležitější fáze 3\nKNOWLEDGE {Školní vzdělávací program LYCEUM} ./ŠVP Lyceum - Finance v digitální době.pdf\nKNOWLEDGE @Slovník\n\n**Interní slovník - RVP/ŠVP**\n\n**RVP**\n\nRámcový vzdělávací program pro obor vzdělání Lyceum je dokument na národní úrovni, který formuluje požadavky na školní vzdělávací programy ve formě především očekávaných výsledků učení, kterých mají žáci absolvováním tohoto programu na dané škole dosáhnout.\n\n**ŠVP**\n\nŠkolní vzdělávací program pro obor vzdělání Lyceum je dokument každé jednotlivé školy, který popisuje v jakých vyučovacích předmětech/ vzdělávacích modulech a v jakých ročnících budou požadované očekávané výsledky učení naplněny. Zároveň formuluje další očekávané výsledky učení, které naplňují disponibilní část vyučovacího času určeného RVP pro tento obor vzdělání.\n\n**Očekávaný výsledek učení (OVU)**\n\nVyjadřuje jednotlivý požadavek na to, co mají žáci umět na konci vzdělávacího programu, tzn. jejich požadované kompetence. Je vyjádřen formulací, která je uvozena činnostním slovesem a dále obsahuje předmět této činnosti. Formulace je konkretizována resp. doplněna zpravidla formou odrážek vymezením dílčích znalostí, dovedností, postojů, jejichž splnění je předpokladem dosažení OVU jako celku.\n\n_Příklad:_\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th><p><strong>Žák/žákyně řídí realizaci jednoduchého projektu</strong></p></th></tr><tr><td><ul><li>naplánuje aktivity projektu</li></ul></td></tr><tr><td><ul><li>navrhne rozpočet projektu vzhledem k navrženým aktivitám</li></ul></td></tr><tr><td><ul><li>stanoví základní ukazatele a sleduje jejich naplňování</li></ul></td></tr><tr><td><ul><li>vede projektový tým</li></ul></td></tr><tr><td><ul><li>uvede, jak by řešil krizové situace v projektu</li></ul></td></tr><tr><td><ul><li>vyhodnotí úspěšnost projektu</li></ul></td></tr></tbody></table></div>\n\n**Vzdělávací oblasti**\n\nOčekávané výsledky učení jsou v **_RVP členěny do 4 vzdělávacích oblastí_**, které tvoří společný všeobecně vzdělávací základ:\n\n- Osobnostní rozvoj, vzdělávání ke zdraví, bezpečí a produktivnímu pracovnímu životu (kariéře)\n- Komunikační a jazykové vzdělávání\n- Aplikované vzdělávání STEM (Science, Technology, Engeneering, Math), tj. přírodní vědy, informatika, technika, matematika\n- Prakticky orientované vzdělávání společenskovědní a humanitní\n\nKaždá vzdělávací oblast se dále člení na okruhy, v jejichž rámci jsou OVU samostatně číslované.\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th rowspan=\"21\"><ul><li>Prakticky orientované vzdělávání společenskovědní a humanitní</li></ul></th><th rowspan=\"21\"><p><strong>Člověk, ekonomie a podnikání</strong></p></th><th rowspan=\"7\"><p><strong>1</strong></p></th><th><p><strong>zpracuje podklady související s podnikáním</strong></p></th></tr><tr><td><p>připraví podnikatelský záměr</p></td></tr><tr><td><p>sestaví zakladatelský rozpočet</p></td></tr><tr><td><p>zkalkuluje cenu zboží nebo služby</p></td></tr><tr><td><p>vysvětlí na příkladu základní povinnosti podnikatele vůči státu a zaměstnancům</p></td></tr><tr><td><p>vede daňovou evidenci</p></td></tr><tr><td><p>vysvětlí na příkladech etiku v podnikání</p></td></tr><tr><td rowspan=\"7\"><p><strong>2</strong></p></td><td><p><strong>řídí realizaci jednoduchého projektu</strong></p></td></tr><tr><td><p>naplánuje aktivity projektu</p></td></tr><tr><td><p>navrhne rozpočet projektu vzhledem k navrženým aktivitám</p></td></tr><tr><td><p>stanoví základní ukazatele a sleduje jejich naplňování</p></td></tr><tr><td><p>vede projektový tým</p></td></tr><tr><td><p>uvede, jak by řešil krizové situace v projektu</p></td></tr><tr><td><p>vyhodnotí úspěšnost projektu</p></td></tr><tr><td rowspan=\"7\"><p><strong>3</strong></p></td><td><p><strong>aplikuje ekonomické teorie v osobním a profesním životě</strong></p></td></tr><tr><td><p>vysvětlí základní ekonomické otázky</p></td></tr><tr><td><p>vysvětí stanovení rovnovážné ceny na dokonalém i nedokonalém trhu</p></td></tr><tr><td><p>charakterizuje výrobní faktory a vysvětlí hranici produkčních možností a náklady obětované příležitosti</p></td></tr><tr><td><p>uvede nejdůležitější makroekonomické pojmy a vliv jejich výše na kvalitu života a podnikání v daném státě</p></td></tr><tr><td><p>vysvětlí podstatu inflace a její důsledky na finanční situaci obyvatel a na příkladu ukáže jak se bránit jejím nepříznivým důsledkům</p></td></tr><tr><td><p>uvede hlavní výhody a nevýhody mezinárodního obchodu a vliv ochranářských opatření na ekonomickou situaci dané země</p></td></tr><tr><td></td><td></td><td><p><strong>4</strong></p></td><td><p>Atd.</p></td></tr></tbody></table></div>\n\n**Vyučovací předmět / vzdělávací modul**\n\nOčekávané výsledky učení jsou v **ŠVP** členěny do vyučovacích předmětů nebo vzdělávacích modulů, které jsou dále zařazeny do jednoho nebo více ročníků 4letého studia. Vyučovací předmět / vzdělávací modul tvoří vyučovací jednotku, kde jsou očekávané výsledky učení dále rozpracovány pro potřeby výuky podle následující šablony\n\n| **A. VSTUPNÍ ČÁST** |\n| --- |\n| **1\\. Název** |\n| **2\\. Kód** (kódy by měly být navázány na obory vzdělání a výsledky učení) |\n| **2a) Kategorie vzdělání** - v případě, že nebude součástí kódu |\n| **3\\. Typ vyučovací jednotky** (modul, předmět, stáž apod.) |\n| **4\\. Délka** (počet hodin - dělitelný čtyřmi (optimální modul 16, 32 hodin = týden výuky) |\n| **5\\. Platnost** (datum, od kterého platí) |\n| **6\\. Vstupní předpoklady** (vymezení požadované úrovně vstupních vědomostí a dovedností, které jsou předpokladem úspěšného studia) |\n| |\n| **B. JÁDRO VYUČOVACÍ JEDNOTKY** |\n| **1\\. Charakteristika** (stručná anotace popisující obecné cíle a pojetí) |\n| **2\\. Očekávané výsledky učení a jejich indikátory (převzaté z RVP nebo dále konkretizované)** |\n| **3\\. Podpora rozvoje klíčových kompetencí a základních gramotností** (které klíčové kompetence jsou v rozvíjeny) |\n| **4\\. Obsah vzdělávání** (rozpis učiva) |\n| **5\\. Vzdělávací strategie** (strategie výuky, resp. učební činnosti žáků, které jsou doporučené pro dosažení výsledků) |\n| |\n| **C. VÝSTUPNÍ ČÁST** |\n| **1\\. Způsob ověřování dosažených výsledků** (ve vazbě na jednotlivé výsledky učení) |\n| **2\\. Kritéria hodnocení** (co znamená splnění výsledků učení, kdy je splněna celá vyučovací jednotka, kritéria pro známky, příp. procentuální, slovní hodnocení) |\n| **3\\. Doporučená studijní literatura, odkazy na ilustrační zdroje** |\n| **4\\. Poznámky** |\n\n**Soulad OVU RVP a ŠVP**\n\nTento soulad je předmětem zjišťování. Soulad nastává, jestliže jsou očekávané výsledky učení z jednotlivých vzdělávacích oblastí RVP **obsaženy** ve vyučovacích předmětech/ vzdělávacích modulech ŠVP jednotlivých škol, tzn. že v ŠVP se objevuje jejich formulace buď v doslovném nebo podobném znění v jednom nebo více vyučovacích předmětech/ vzdělávacích modulech.\n\n_Příklad souladu:_\n\nRVP ŠVP - komunikace a marketing (SŠ obchodní Č.\n\n| **2** | **řídí realizaci jednoduchého projektu** |\n| --- | --- |\n| naplánuje aktivity projektu |\n| navrhne rozpočet projektu vzhledem k navrženým aktivitám |\n| stanoví základní ukazatele a sleduje jejich naplňování |\n| vede projektový tým |\n| uvede, jak by řešil krizové situace v projektu |\n| vyhodnotí úspěšnost projektu |\n\nKNOWLEDGE {Porovnání RVP a ŠVP - postup}\n\n\n# AUDITNÍ PROTOKOL ŠVP-RVP\n\n# (POPIS KONTROLNÍHO ALGORITMU)\n\nMetodika je určena pro **Kvantifikaci Shody** školního vzdělávacího programu (ŠVP) s Rámcovým vzdělávacím programem (RVP).\n\n## FÁZE 1: VALIDACE DOKUMENTACE\n\n**Cíl:** Ověřit platnost, aktuálnost a strukturu zdrojových dokumentů.\n\n- **RVP Verifikace:** Otevřít aktuální verzi RVP (např. RVP ZV/G/SOŠ).\n- **Typová shoda:** Ověřit, že RVP se vztahuje k danému typu školy.\n- **ŠVP Dimenze:** Identifikovat a izolovat relevantní části ŠVP: Profil absolventa, Klíčové kompetence (KK), Vzdělávací oblasti (VO), případně Učební plán (UP).\n- **Verzování:** Potvrdit, že obě verze (RVP a ŠVP) jsou nejnovější a platné (včetně dodatků RVP).\n\n## FÁZE 2: DATABÁZOVÉ MAPOVÁNÍ VÝSTUPŮ (MASTER MATICE)\n\n**Cíl:** Vytvořit systémovou databázi pro křížové porovnání všech povinných komponent RVP se ŠVP.\n\n- **Dekompozice RVP:** Rozložit RVP na základní povinné komponenty: Klíčové kompetence, Vzdělávací oblasti a obory, Očekávané výstupy (OVU), Průřezová témata (PT).\n- **Přiřazovací mapa:** Vytvořit hlavní kontrolní matici (Master Matice) pro záznam vazeb.\n\n| Oblast RVP | Výstup RVP (OVU) | Odpovídající Část ŠVP (Předmět/Ročník) | Konkrétní Tématický Celek v ŠVP | Stav Shody (Protokol) |\n| --- | --- | --- | --- | --- |\n| ... | ... | ... | ... | ... |\n| --- | --- | --- | --- | --- |\n\n## FÁZE 3: ALGORITMICKÁ KONTROLA POKRYTÍ A HLOUBKY\n\n**Cíl:** Posoudit, zda každý povinný výstup RVP je adekvátně reflektován v obsahu ŠVP, a přidělit bodovou hodnotu pro kvantifikaci.\n\n- **Audit OVU:** Projít každý jednotlivý Očekávaný výstup (OVU) z RVP.\n- **Kódování stavu a bodování:** U každého OVU v matici označit stav pokrytí dle následujícího schématu:\n\n| Kód (Protokol) | Popis (Kvalitativní zjištění) | Bodová hodnota (Kvantifikace) |\n| --- | --- | --- |\n| ✅ | Plná shoda (Výstup pokryt v plném rozsahu, odpovídající úrovni RVP) | 1,0 |\n| --- | --- | --- |\n| ⚠️ | Částečná shoda (Formální pokrytí, omezený rozsah, chybná návaznost) | 0,5 |\n| --- | --- | --- |\n| ❌ | Absence (Výstup zcela chybí v obsahu ŠVP) | 0,0 |\n| --- | --- | --- |\n\n- **Defektologie ŠVP:** Identifikovat a zaznamenat deficity ŠVP: Chybějící výstupy (❌), Sémantické překryvy, Přetížení obsahu.\n- **Kvalitativní posun:** Ověřit, zda je formulace výstupů v ŠVP **aktivní, měřitelná a v souladu** s úrovní RVP.\n\n## FÁZE 4: STRUKTURÁLNÍ VERIFIKACE NÁVAZNOSTI (VERTIKÁLA/HORIZONTÁLA)\n\n**Cíl:** Zkontrolovat logickou posloupnost a provázanost učiva v rámci ŠVP.\n\n- **Vertikální Kontrola:** Ověřit posloupnost OVU a učiva uvnitř jednoho předmětu/oblasti (postup od jednodušších ke složitějším konceptům napříč ročníky).\n- **Horizontální Kontrola:** Zkontrolovat logické provázání napříč vzdělávacími oblastmi a předměty (např. fyzika ↔ matematika).\n- **PT Integrace:** Audit reálné integrace Průřezových témat (PT) do konkrétních částí obsahu, metod a projektů.\n\n## FÁZE 5: ANALÝZA ŠKOLNÍ PROFILACE A ROZŠÍŘENÍ RVP\n\n**Cíl:** Validovat, že profilace školy je **v souladu** s RVP a nejedná se o **rozpor**.\n\n- **Nekonfliktnost:** Porovnat definovaný Profil absolventa školy s Klíčovými kompetencemi RVP. Profil ŠVP musí RVP rozvíjet, nikoli mu odporovat.\n- **Modularita:** Zkontrolovat, zda volitelné předměty a rozšiřující moduly logicky navazují na vzdělávací oblasti RVP.\n- **Implementace specializace:** Popisně uvést, jak je školní profilace (např. STEM zaměření, projektová výuka) integrována do OVU a kompetencí definovaných RVP.\n\n## FÁZE 6: GENERÁTOR ZÁVĚREČNÉ ZPRÁVY A KVANTIFIKACE\n\n**Cíl:** Syntetizovat výsledky, kvantifikovat soulad a generovat závazné návrhy na korekce.\n\n### 6.1 Kvantifikace Souladu\n\nVypočítat Index shody (IS) na základě bodového hodnocení (Fáze 3):\n\n### 6.2 Interpretace Indexu Shody (IS)\n\nKlasifikace souladu pro standardizované vyhodnocení:\n\n| Interval IS | Klasifikace souladu | Popis |\n| --- | --- | --- |\n| 95-100 % | Výborný soulad | ŠVP plně odpovídá RVP, pouze stylistické nebo formální rozdíly. |\n| --- | --- | --- |\n| 85-94 % | Dobrá shoda | ŠVP pokrývá všechny klíčové výstupy, menší korekce nutné. |\n| --- | --- | --- |\n| 70-84 % | Částečná shoda | Významné nedostatky v některých oblastech, nutná revize obsahu. |\n| --- | --- | --- |\n| < 70 % | Kritická neshoda | ŠVP neplní rámcové požadavky, ohrožuje legislativní soulad. |\n| --- | --- | --- |\n\n### 6.3 Doplňkové Indexy\n\nVypočítat následující doplňkové indexy pro detailní kvalitativní analýzu:\n\n- **Index kompetenčního souladu (IKS):** Poměr pokrytí klíčových kompetencí RVP v ŠVP.\n- **Index průřezové integrace (IPI):** Míra reálné integrace průřezových témat do výuky.\n- **Index hloubky pokrytí (IHP):** Procento výstupů, které jsou v ŠVP rozvedeny na konkrétní výukové cíle (měřitelné, aktivní formulace).\n- **Index profilové rozšiřitelnosti (IPR):** Kolik rozšiřujících nebo profilových výstupů přesahuje rámec RVP, aniž by narušily jeho strukturu.\n\n### 6.4 Vizuální výstupy\n\nZajistit generování následujících vizualizací pro Závěrečnou zprávu:\n\n- Graf pokrytí po vzdělávacích oblastech (Sloupcový graf IS pro VO).\n- Pavoukový diagram Klíčových kompetencí (RVP vs. ŠVP).\n- Mapa defektů (Vizualizace ❌ a ⚠️ výstupů).\n\n### 6.5 Struktura Závěrečné Zprávy\n\nZpráva musí být strukturována dle standardizovaného formátu:\n\n| Oddíl | Obsah |\n| --- | --- |\n| A. Identifikace | Název školy, IZO, typ školy, datum revize, zpracovatel, verze ŠVP a RVP. |\n| --- | --- |\n| B. Shrnutí výsledků | Celkový Index Shody (IS), hlavní závěry a doporučení. |\n| --- | --- |\n| C. Kvantitativní analýza | Přehled IS v % dle kategorií OVU / VO / kompetencí. |\n| --- | --- |\n| D. Kvalitativní analýza | Slovní zhodnocení kvality souladu (formulace, obtížnost, integrace PT). |\n| --- | --- |\n| E. Rizikové oblasti | Přehled nalezených defektů (chybějící OVU, přetížení, formální shoda). |\n| --- | --- |\n| F. Návrhy opatření (Korekční plán) | Přesné návrhy změn - **Co, Kde, Kdo** má upravit, včetně termínu. |\n| --- | --- |\n| G. Přílohy | Master Matice (Fáze 2-3), revizní tabulka, výstupní grafy a metriky. |\n| --- | --- |\n\n\n\n\n.\n"}],sourceFile:"./books/examples/lsvp-asistent.book"}];
|
|
2000
|
+
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"}];
|
|
2011
2001
|
|
|
2012
2002
|
/**
|
|
2013
2003
|
* Checks if value is valid email
|
|
@@ -2049,7 +2039,7 @@
|
|
|
2049
2039
|
constructor(whatWasThrown) {
|
|
2050
2040
|
const tag = `[🤮]`;
|
|
2051
2041
|
console.error(tag, whatWasThrown);
|
|
2052
|
-
super(spaceTrim.spaceTrim(`
|
|
2042
|
+
super(spaceTrim$1.spaceTrim(`
|
|
2053
2043
|
Non-Error object was thrown
|
|
2054
2044
|
|
|
2055
2045
|
Note: Look for ${tag} in the console for more details
|
|
@@ -2114,6 +2104,8 @@
|
|
|
2114
2104
|
* Function `validatePipelineString` will validate the if the string is a valid pipeline string
|
|
2115
2105
|
* 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.
|
|
2116
2106
|
*
|
|
2107
|
+
* Note: [🔂] This function is idempotent.
|
|
2108
|
+
*
|
|
2117
2109
|
* @param {string} pipelineString the candidate for a pipeline string
|
|
2118
2110
|
* @returns {PipelineString} the same string as input, but validated as valid
|
|
2119
2111
|
* @throws {ParseError} if the string is not a valid pipeline string
|
|
@@ -2498,7 +2490,7 @@
|
|
|
2498
2490
|
TODO: [🧠] Is there a better implementation?
|
|
2499
2491
|
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
2500
2492
|
> for (const propertyName of propertyNames) {
|
|
2501
|
-
> const value = (objectValue as
|
|
2493
|
+
> const value = (objectValue as chococake)[propertyName];
|
|
2502
2494
|
> if (value && typeof value === 'object') {
|
|
2503
2495
|
> deepClone(value);
|
|
2504
2496
|
> }
|
|
@@ -2703,6 +2695,8 @@
|
|
|
2703
2695
|
* - if it is valid json
|
|
2704
2696
|
* - if it is meaningful
|
|
2705
2697
|
*
|
|
2698
|
+
* Note: [🔂] This function is idempotent.
|
|
2699
|
+
*
|
|
2706
2700
|
* @param pipeline valid or invalid PipelineJson
|
|
2707
2701
|
* @returns the same pipeline if it is logically valid
|
|
2708
2702
|
* @throws {PipelineLogicError} on logical error in the pipeline
|
|
@@ -2720,7 +2714,7 @@
|
|
|
2720
2714
|
if (!(error instanceof PipelineLogicError)) {
|
|
2721
2715
|
throw error;
|
|
2722
2716
|
}
|
|
2723
|
-
console.error(spaceTrim.spaceTrim((block) => `
|
|
2717
|
+
console.error(spaceTrim$1.spaceTrim((block) => `
|
|
2724
2718
|
Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
|
|
2725
2719
|
|
|
2726
2720
|
${block(error.message)}
|
|
@@ -2747,7 +2741,7 @@
|
|
|
2747
2741
|
})();
|
|
2748
2742
|
if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
|
|
2749
2743
|
// <- Note: [🚲]
|
|
2750
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2744
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2751
2745
|
Invalid promptbook URL "${pipeline.pipelineUrl}"
|
|
2752
2746
|
|
|
2753
2747
|
${block(pipelineIdentification)}
|
|
@@ -2755,7 +2749,7 @@
|
|
|
2755
2749
|
}
|
|
2756
2750
|
if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
|
|
2757
2751
|
// <- Note: [🚲]
|
|
2758
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2752
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2759
2753
|
Invalid Promptbook Version "${pipeline.bookVersion}"
|
|
2760
2754
|
|
|
2761
2755
|
${block(pipelineIdentification)}
|
|
@@ -2764,7 +2758,7 @@
|
|
|
2764
2758
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2765
2759
|
if (!Array.isArray(pipeline.parameters)) {
|
|
2766
2760
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2767
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2761
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
2768
2762
|
Pipeline is valid JSON but with wrong structure
|
|
2769
2763
|
|
|
2770
2764
|
\`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
|
|
@@ -2775,7 +2769,7 @@
|
|
|
2775
2769
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2776
2770
|
if (!Array.isArray(pipeline.tasks)) {
|
|
2777
2771
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2778
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2772
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
2779
2773
|
Pipeline is valid JSON but with wrong structure
|
|
2780
2774
|
|
|
2781
2775
|
\`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
|
|
@@ -2801,7 +2795,7 @@
|
|
|
2801
2795
|
// Note: Check each parameter individually
|
|
2802
2796
|
for (const parameter of pipeline.parameters) {
|
|
2803
2797
|
if (parameter.isInput && parameter.isOutput) {
|
|
2804
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2798
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2805
2799
|
|
|
2806
2800
|
Parameter \`{${parameter.name}}\` can not be both input and output
|
|
2807
2801
|
|
|
@@ -2812,7 +2806,7 @@
|
|
|
2812
2806
|
if (!parameter.isInput &&
|
|
2813
2807
|
!parameter.isOutput &&
|
|
2814
2808
|
!pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
|
|
2815
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2809
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2816
2810
|
Parameter \`{${parameter.name}}\` is created but not used
|
|
2817
2811
|
|
|
2818
2812
|
You can declare {${parameter.name}} as output parameter by adding in the header:
|
|
@@ -2824,7 +2818,7 @@
|
|
|
2824
2818
|
}
|
|
2825
2819
|
// Note: Testing that parameter is either input or result of some task
|
|
2826
2820
|
if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
|
|
2827
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2821
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2828
2822
|
Parameter \`{${parameter.name}}\` is declared but not defined
|
|
2829
2823
|
|
|
2830
2824
|
You can do one of these:
|
|
@@ -2840,14 +2834,14 @@
|
|
|
2840
2834
|
// Note: Checking each task individually
|
|
2841
2835
|
for (const task of pipeline.tasks) {
|
|
2842
2836
|
if (definedParameters.has(task.resultingParameterName)) {
|
|
2843
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2837
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2844
2838
|
Parameter \`{${task.resultingParameterName}}\` is defined multiple times
|
|
2845
2839
|
|
|
2846
2840
|
${block(pipelineIdentification)}
|
|
2847
2841
|
`));
|
|
2848
2842
|
}
|
|
2849
2843
|
if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
|
|
2850
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2844
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2851
2845
|
Parameter name {${task.resultingParameterName}} is reserved, please use different name
|
|
2852
2846
|
|
|
2853
2847
|
${block(pipelineIdentification)}
|
|
@@ -2857,7 +2851,7 @@
|
|
|
2857
2851
|
if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
|
|
2858
2852
|
if (!task.format &&
|
|
2859
2853
|
!task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
2860
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2854
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2861
2855
|
Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
|
|
2862
2856
|
|
|
2863
2857
|
${block(pipelineIdentification)}
|
|
@@ -2865,7 +2859,7 @@
|
|
|
2865
2859
|
}
|
|
2866
2860
|
for (const joker of task.jokerParameterNames) {
|
|
2867
2861
|
if (!task.dependentParameterNames.includes(joker)) {
|
|
2868
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2862
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2869
2863
|
Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
|
|
2870
2864
|
|
|
2871
2865
|
${block(pipelineIdentification)}
|
|
@@ -2876,21 +2870,21 @@
|
|
|
2876
2870
|
if (task.expectations) {
|
|
2877
2871
|
for (const [unit, { min, max }] of Object.entries(task.expectations)) {
|
|
2878
2872
|
if (min !== undefined && max !== undefined && min > max) {
|
|
2879
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2873
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2880
2874
|
Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
|
|
2881
2875
|
|
|
2882
2876
|
${block(pipelineIdentification)}
|
|
2883
2877
|
`));
|
|
2884
2878
|
}
|
|
2885
2879
|
if (min !== undefined && min < 0) {
|
|
2886
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2880
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2887
2881
|
Min expectation of ${unit} must be zero or positive
|
|
2888
2882
|
|
|
2889
2883
|
${block(pipelineIdentification)}
|
|
2890
2884
|
`));
|
|
2891
2885
|
}
|
|
2892
2886
|
if (max !== undefined && max <= 0) {
|
|
2893
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2887
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2894
2888
|
Max expectation of ${unit} must be positive
|
|
2895
2889
|
|
|
2896
2890
|
${block(pipelineIdentification)}
|
|
@@ -2912,7 +2906,7 @@
|
|
|
2912
2906
|
while (unresovedTasks.length > 0) {
|
|
2913
2907
|
if (loopLimit-- < 0) {
|
|
2914
2908
|
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
2915
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
2909
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
2916
2910
|
Loop limit reached during detection of circular dependencies in \`validatePipeline\`
|
|
2917
2911
|
|
|
2918
2912
|
${block(pipelineIdentification)}
|
|
@@ -2922,7 +2916,7 @@
|
|
|
2922
2916
|
if (currentlyResovedTasks.length === 0) {
|
|
2923
2917
|
throw new PipelineLogicError(
|
|
2924
2918
|
// TODO: [🐎] DRY
|
|
2925
|
-
spaceTrim.spaceTrim((block) => `
|
|
2919
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
2926
2920
|
|
|
2927
2921
|
Can not resolve some parameters:
|
|
2928
2922
|
Either you are using a parameter that is not defined, or there are some circular dependencies.
|
|
@@ -3069,7 +3063,7 @@
|
|
|
3069
3063
|
* Library of pipelines that groups together pipelines for an application.
|
|
3070
3064
|
* This implementation is a very thin wrapper around the Array / Map of pipelines.
|
|
3071
3065
|
*
|
|
3072
|
-
* @private internal function of `
|
|
3066
|
+
* @private internal function of `createPipelineCollectionFromJson`, use `createPipelineCollectionFromJson` instead
|
|
3073
3067
|
* @see https://github.com/webgptorg/pipeline#pipeline-collection
|
|
3074
3068
|
*/
|
|
3075
3069
|
class SimplePipelineCollection {
|
|
@@ -3079,14 +3073,14 @@
|
|
|
3079
3073
|
* @param pipelines Array of pipeline JSON objects to include in the collection
|
|
3080
3074
|
*
|
|
3081
3075
|
* Note: During the construction logic of all pipelines are validated
|
|
3082
|
-
* Note: It is not recommended to use this constructor directly, use `
|
|
3076
|
+
* Note: It is not recommended to use this constructor directly, use `createPipelineCollectionFromJson` *(or other variant)* instead
|
|
3083
3077
|
*/
|
|
3084
3078
|
constructor(...pipelines) {
|
|
3085
3079
|
this.collection = new Map();
|
|
3086
3080
|
for (const pipeline of pipelines) {
|
|
3087
3081
|
// TODO: [👠] DRY
|
|
3088
3082
|
if (pipeline.pipelineUrl === undefined) {
|
|
3089
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
3083
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
3090
3084
|
Pipeline with name "${pipeline.title}" does not have defined URL
|
|
3091
3085
|
|
|
3092
3086
|
File:
|
|
@@ -3108,7 +3102,7 @@
|
|
|
3108
3102
|
pipelineJsonToString(unpreparePipeline(pipeline)) !==
|
|
3109
3103
|
pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
|
|
3110
3104
|
const existing = this.collection.get(pipeline.pipelineUrl);
|
|
3111
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
3105
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
3112
3106
|
Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
|
|
3113
3107
|
|
|
3114
3108
|
Conflicting files:
|
|
@@ -3140,13 +3134,13 @@
|
|
|
3140
3134
|
const pipeline = this.collection.get(url);
|
|
3141
3135
|
if (!pipeline) {
|
|
3142
3136
|
if (this.listPipelines().length === 0) {
|
|
3143
|
-
throw new NotFoundError(spaceTrim.spaceTrim(`
|
|
3137
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim(`
|
|
3144
3138
|
Pipeline with url "${url}" not found
|
|
3145
3139
|
|
|
3146
3140
|
No pipelines available
|
|
3147
3141
|
`));
|
|
3148
3142
|
}
|
|
3149
|
-
throw new NotFoundError(spaceTrim.spaceTrim((block) => `
|
|
3143
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
|
|
3150
3144
|
Pipeline with url "${url}" not found
|
|
3151
3145
|
|
|
3152
3146
|
Available pipelines:
|
|
@@ -3167,22 +3161,23 @@
|
|
|
3167
3161
|
}
|
|
3168
3162
|
|
|
3169
3163
|
/**
|
|
3170
|
-
* Creates PipelineCollection from array of PipelineJson or PipelineString
|
|
3164
|
+
* Creates `PipelineCollection` from array of PipelineJson or PipelineString
|
|
3171
3165
|
*
|
|
3172
|
-
* Note: Functions `
|
|
3166
|
+
* Note: Functions `pipelineCollectionToJson` and `createPipelineCollectionFromJson` are complementary
|
|
3173
3167
|
* Note: Syntax, parsing, and logic consistency checks are performed on all sources during build
|
|
3174
3168
|
*
|
|
3175
3169
|
* @param promptbookSources
|
|
3176
3170
|
* @returns PipelineCollection
|
|
3177
3171
|
* @public exported from `@promptbook/core`
|
|
3178
3172
|
*/
|
|
3179
|
-
function
|
|
3173
|
+
function createPipelineCollectionFromJson(...promptbooks) {
|
|
3180
3174
|
return new SimplePipelineCollection(...promptbooks);
|
|
3181
3175
|
}
|
|
3182
3176
|
|
|
3183
3177
|
/**
|
|
3184
3178
|
* Generates random token
|
|
3185
3179
|
*
|
|
3180
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
3186
3181
|
* Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
|
|
3187
3182
|
*
|
|
3188
3183
|
* @private internal helper function
|
|
@@ -3192,6 +3187,7 @@
|
|
|
3192
3187
|
return crypto.randomBytes(randomness).toString('hex');
|
|
3193
3188
|
}
|
|
3194
3189
|
/**
|
|
3190
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
3195
3191
|
* TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
3196
3192
|
*/
|
|
3197
3193
|
|
|
@@ -3310,6 +3306,22 @@
|
|
|
3310
3306
|
}
|
|
3311
3307
|
}
|
|
3312
3308
|
|
|
3309
|
+
/**
|
|
3310
|
+
* This error indicates error from the database
|
|
3311
|
+
*
|
|
3312
|
+
* @public exported from `@promptbook/core`
|
|
3313
|
+
*/
|
|
3314
|
+
class DatabaseError extends Error {
|
|
3315
|
+
constructor(message) {
|
|
3316
|
+
super(message);
|
|
3317
|
+
this.name = 'DatabaseError';
|
|
3318
|
+
Object.setPrototypeOf(this, DatabaseError.prototype);
|
|
3319
|
+
}
|
|
3320
|
+
}
|
|
3321
|
+
/**
|
|
3322
|
+
* TODO: [🐱🚀] Explain that NotFoundError ([🐱🚀] and other specific errors) has priority over DatabaseError in some contexts
|
|
3323
|
+
*/
|
|
3324
|
+
|
|
3313
3325
|
/**
|
|
3314
3326
|
* This error occurs when some expectation is not met in the execution of the pipeline
|
|
3315
3327
|
*
|
|
@@ -3339,6 +3351,19 @@
|
|
|
3339
3351
|
}
|
|
3340
3352
|
}
|
|
3341
3353
|
|
|
3354
|
+
/**
|
|
3355
|
+
* This error indicates that promptbook operation is not allowed
|
|
3356
|
+
*
|
|
3357
|
+
* @public exported from `@promptbook/core`
|
|
3358
|
+
*/
|
|
3359
|
+
class NotAllowed extends Error {
|
|
3360
|
+
constructor(message) {
|
|
3361
|
+
super(message);
|
|
3362
|
+
this.name = 'NotAllowed';
|
|
3363
|
+
Object.setPrototypeOf(this, NotAllowed.prototype);
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
|
|
3342
3367
|
/**
|
|
3343
3368
|
* This error type indicates that some part of the code is not implemented yet
|
|
3344
3369
|
*
|
|
@@ -3346,7 +3371,7 @@
|
|
|
3346
3371
|
*/
|
|
3347
3372
|
class NotYetImplementedError extends Error {
|
|
3348
3373
|
constructor(message) {
|
|
3349
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
3374
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
3350
3375
|
${block(message)}
|
|
3351
3376
|
|
|
3352
3377
|
Note: This feature is not implemented yet but it will be soon.
|
|
@@ -3399,6 +3424,8 @@
|
|
|
3399
3424
|
PromptbookFetchError,
|
|
3400
3425
|
UnexpectedError,
|
|
3401
3426
|
WrappedError,
|
|
3427
|
+
NotAllowed,
|
|
3428
|
+
DatabaseError,
|
|
3402
3429
|
// TODO: [🪑]> VersionMismatchError,
|
|
3403
3430
|
};
|
|
3404
3431
|
/**
|
|
@@ -3583,11 +3610,11 @@
|
|
|
3583
3610
|
throw deserializeError(errors[0]);
|
|
3584
3611
|
}
|
|
3585
3612
|
else {
|
|
3586
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
3613
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
3587
3614
|
Multiple errors occurred during Promptbook execution
|
|
3588
3615
|
|
|
3589
3616
|
${block(errors
|
|
3590
|
-
.map(({ name, stack, message }, index) => spaceTrim.spaceTrim((block) => `
|
|
3617
|
+
.map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
|
|
3591
3618
|
${name} ${index + 1}:
|
|
3592
3619
|
${block(stack || message)}
|
|
3593
3620
|
`))
|
|
@@ -3614,6 +3641,7 @@
|
|
|
3614
3641
|
let updatedAt = createdAt;
|
|
3615
3642
|
const errors = [];
|
|
3616
3643
|
const warnings = [];
|
|
3644
|
+
const llmCalls = [];
|
|
3617
3645
|
let currentValue = {};
|
|
3618
3646
|
let customTldr = null;
|
|
3619
3647
|
const partialResultSubject = new rxjs.Subject();
|
|
@@ -3629,6 +3657,9 @@
|
|
|
3629
3657
|
}, (tldrInfo) => {
|
|
3630
3658
|
customTldr = tldrInfo;
|
|
3631
3659
|
updatedAt = new Date();
|
|
3660
|
+
}, (llmCall) => {
|
|
3661
|
+
llmCalls.push(llmCall);
|
|
3662
|
+
updatedAt = new Date();
|
|
3632
3663
|
});
|
|
3633
3664
|
finalResultPromise
|
|
3634
3665
|
.catch((error) => {
|
|
@@ -3751,7 +3782,7 @@
|
|
|
3751
3782
|
}
|
|
3752
3783
|
return {
|
|
3753
3784
|
percent: percent,
|
|
3754
|
-
message,
|
|
3785
|
+
message: message + ' (!!!fallback)',
|
|
3755
3786
|
};
|
|
3756
3787
|
},
|
|
3757
3788
|
get createdAt() {
|
|
@@ -3774,6 +3805,10 @@
|
|
|
3774
3805
|
return warnings;
|
|
3775
3806
|
// <- Note: [1] --||--
|
|
3776
3807
|
},
|
|
3808
|
+
get llmCalls() {
|
|
3809
|
+
return [...llmCalls, { foo: '!!! bar' }];
|
|
3810
|
+
// <- Note: [1] --||--
|
|
3811
|
+
},
|
|
3777
3812
|
get currentValue() {
|
|
3778
3813
|
return currentValue;
|
|
3779
3814
|
// <- Note: [1] --||--
|
|
@@ -4227,6 +4262,7 @@
|
|
|
4227
4262
|
return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
|
|
4228
4263
|
}
|
|
4229
4264
|
/**
|
|
4265
|
+
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
4230
4266
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
4231
4267
|
*/
|
|
4232
4268
|
|
|
@@ -4243,6 +4279,7 @@
|
|
|
4243
4279
|
return llmTools;
|
|
4244
4280
|
}
|
|
4245
4281
|
/**
|
|
4282
|
+
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
4246
4283
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
4247
4284
|
*/
|
|
4248
4285
|
|
|
@@ -4258,7 +4295,7 @@
|
|
|
4258
4295
|
throw new MissingToolsError('LLM tools are required for preparing persona');
|
|
4259
4296
|
}
|
|
4260
4297
|
// TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
|
|
4261
|
-
const collection =
|
|
4298
|
+
const collection = createPipelineCollectionFromJson(...PipelineCollection);
|
|
4262
4299
|
const preparePersonaExecutor = createPipelineExecutor({
|
|
4263
4300
|
pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book'),
|
|
4264
4301
|
tools,
|
|
@@ -4966,7 +5003,7 @@
|
|
|
4966
5003
|
if (task.taskType === 'PROMPT_TASK' &&
|
|
4967
5004
|
knowledgePiecesCount > 0 &&
|
|
4968
5005
|
!dependentParameterNames.includes('knowledge')) {
|
|
4969
|
-
preparedContent = spaceTrim.spaceTrim(`
|
|
5006
|
+
preparedContent = spaceTrim$1.spaceTrim(`
|
|
4970
5007
|
{content}
|
|
4971
5008
|
|
|
4972
5009
|
## Knowledge
|
|
@@ -5052,7 +5089,7 @@
|
|
|
5052
5089
|
let title = pipeline.title;
|
|
5053
5090
|
if (title === undefined || title === '' || title === DEFAULT_BOOK_TITLE) {
|
|
5054
5091
|
// TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
|
|
5055
|
-
const collection =
|
|
5092
|
+
const collection = createPipelineCollectionFromJson(...PipelineCollection);
|
|
5056
5093
|
const prepareTitleExecutor = createPipelineExecutor({
|
|
5057
5094
|
pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book'),
|
|
5058
5095
|
tools,
|
|
@@ -5279,7 +5316,7 @@
|
|
|
5279
5316
|
}
|
|
5280
5317
|
catch (error) {
|
|
5281
5318
|
assertsError(error);
|
|
5282
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
5319
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
5283
5320
|
Can not extract variables from the script
|
|
5284
5321
|
${block(error.stack || error.message)}
|
|
5285
5322
|
|
|
@@ -5964,10 +6001,13 @@
|
|
|
5964
6001
|
* @public exported from `@promptbook/utils`
|
|
5965
6002
|
*/
|
|
5966
6003
|
function countLines(text) {
|
|
6004
|
+
if (text === '') {
|
|
6005
|
+
return 0;
|
|
6006
|
+
}
|
|
5967
6007
|
text = text.replace('\r\n', '\n');
|
|
5968
6008
|
text = text.replace('\r', '\n');
|
|
5969
6009
|
const lines = text.split('\n');
|
|
5970
|
-
return lines.reduce((count, line) => count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 0);
|
|
6010
|
+
return lines.reduce((count, line) => count + Math.max(Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 1), 0);
|
|
5971
6011
|
}
|
|
5972
6012
|
/**
|
|
5973
6013
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
@@ -6092,6 +6132,8 @@
|
|
|
6092
6132
|
* This function provides a common abstraction for result validation that can be used
|
|
6093
6133
|
* by both execution logic and caching logic to ensure consistency.
|
|
6094
6134
|
*
|
|
6135
|
+
* Note: [🔂] This function is idempotent.
|
|
6136
|
+
*
|
|
6095
6137
|
* @param options - The validation options including result string, expectations, and format
|
|
6096
6138
|
* @returns Validation result with processed string and validity status
|
|
6097
6139
|
* @private internal function of `createPipelineExecutor` and `cacheLlmTools`
|
|
@@ -6111,7 +6153,7 @@
|
|
|
6111
6153
|
}
|
|
6112
6154
|
catch (error) {
|
|
6113
6155
|
keepUnused(error);
|
|
6114
|
-
throw new ExpectError(spaceTrim.spaceTrim((block) => `
|
|
6156
|
+
throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
|
|
6115
6157
|
Expected valid JSON string
|
|
6116
6158
|
|
|
6117
6159
|
The expected JSON text:
|
|
@@ -6160,7 +6202,7 @@
|
|
|
6160
6202
|
*/
|
|
6161
6203
|
async function executeAttempts(options) {
|
|
6162
6204
|
const { jokerParameterNames, priority, maxAttempts, // <- Note: [💂]
|
|
6163
|
-
preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, } = options;
|
|
6205
|
+
preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, logLlmCall, } = options;
|
|
6164
6206
|
const $ongoingTaskResult = {
|
|
6165
6207
|
$result: null,
|
|
6166
6208
|
$resultString: null,
|
|
@@ -6174,7 +6216,7 @@
|
|
|
6174
6216
|
const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
|
|
6175
6217
|
// TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
|
|
6176
6218
|
if (isJokerAttempt && !jokerParameterName) {
|
|
6177
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6219
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6178
6220
|
Joker not found in attempt ${attemptIndex}
|
|
6179
6221
|
|
|
6180
6222
|
${block(pipelineIdentification)}
|
|
@@ -6185,7 +6227,7 @@
|
|
|
6185
6227
|
$ongoingTaskResult.$expectError = null;
|
|
6186
6228
|
if (isJokerAttempt) {
|
|
6187
6229
|
if (parameters[jokerParameterName] === undefined) {
|
|
6188
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6230
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6189
6231
|
Joker parameter {${jokerParameterName}} not defined
|
|
6190
6232
|
|
|
6191
6233
|
${block(pipelineIdentification)}
|
|
@@ -6243,7 +6285,7 @@
|
|
|
6243
6285
|
$ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
|
|
6244
6286
|
break variant;
|
|
6245
6287
|
case 'EMBEDDING':
|
|
6246
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6288
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6247
6289
|
Embedding model can not be used in pipeline
|
|
6248
6290
|
|
|
6249
6291
|
This should be catched during parsing
|
|
@@ -6254,7 +6296,7 @@
|
|
|
6254
6296
|
break variant;
|
|
6255
6297
|
// <- case [🤖]:
|
|
6256
6298
|
default:
|
|
6257
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6299
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6258
6300
|
Unknown model variant "${task.modelRequirements.modelVariant}"
|
|
6259
6301
|
|
|
6260
6302
|
${block(pipelineIdentification)}
|
|
@@ -6265,14 +6307,14 @@
|
|
|
6265
6307
|
break;
|
|
6266
6308
|
case 'SCRIPT_TASK':
|
|
6267
6309
|
if (arrayableToArray(tools.script).length === 0) {
|
|
6268
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6310
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6269
6311
|
No script execution tools are available
|
|
6270
6312
|
|
|
6271
6313
|
${block(pipelineIdentification)}
|
|
6272
6314
|
`));
|
|
6273
6315
|
}
|
|
6274
6316
|
if (!task.contentLanguage) {
|
|
6275
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6317
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6276
6318
|
Script language is not defined for SCRIPT TASK "${task.name}"
|
|
6277
6319
|
|
|
6278
6320
|
${block(pipelineIdentification)}
|
|
@@ -6303,7 +6345,7 @@
|
|
|
6303
6345
|
throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
|
|
6304
6346
|
}
|
|
6305
6347
|
else {
|
|
6306
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6348
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6307
6349
|
Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
|
|
6308
6350
|
|
|
6309
6351
|
${block(pipelineIdentification)}
|
|
@@ -6317,7 +6359,7 @@
|
|
|
6317
6359
|
break taskType;
|
|
6318
6360
|
case 'DIALOG_TASK':
|
|
6319
6361
|
if (tools.userInterface === undefined) {
|
|
6320
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6362
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6321
6363
|
User interface tools are not available
|
|
6322
6364
|
|
|
6323
6365
|
${block(pipelineIdentification)}
|
|
@@ -6335,7 +6377,7 @@
|
|
|
6335
6377
|
break taskType;
|
|
6336
6378
|
// <- case: [🅱]
|
|
6337
6379
|
default:
|
|
6338
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6380
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6339
6381
|
Unknown execution type "${task.taskType}"
|
|
6340
6382
|
|
|
6341
6383
|
${block(pipelineIdentification)}
|
|
@@ -6408,14 +6450,10 @@
|
|
|
6408
6450
|
});
|
|
6409
6451
|
}
|
|
6410
6452
|
finally {
|
|
6411
|
-
if (!isJokerAttempt &&
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
// In that case we don’t want to make a report about it because it’s not a llm execution error
|
|
6416
|
-
) {
|
|
6417
|
-
// TODO: [🧠] Maybe put other taskTypes into report
|
|
6418
|
-
$executionReport.promptExecutions.push({
|
|
6453
|
+
if (!isJokerAttempt && task.taskType === 'PROMPT_TASK' && $ongoingTaskResult.$prompt) {
|
|
6454
|
+
// Note: [2] When some expected parameter is not defined, error will occur in templateParameters
|
|
6455
|
+
// In that case we don’t want to make a report about it because it’s not a llm execution error
|
|
6456
|
+
const executionPromptReport = {
|
|
6419
6457
|
prompt: {
|
|
6420
6458
|
...$ongoingTaskResult.$prompt,
|
|
6421
6459
|
// <- TODO: [🧠] How to pick everyhing except `pipelineUrl`
|
|
@@ -6424,13 +6462,20 @@
|
|
|
6424
6462
|
error: $ongoingTaskResult.$expectError === null
|
|
6425
6463
|
? undefined
|
|
6426
6464
|
: serializeError($ongoingTaskResult.$expectError),
|
|
6427
|
-
}
|
|
6465
|
+
};
|
|
6466
|
+
$executionReport.promptExecutions.push(executionPromptReport);
|
|
6467
|
+
if (logLlmCall) {
|
|
6468
|
+
logLlmCall({
|
|
6469
|
+
modelName: 'model' /* <- TODO: How to get model name from the report */,
|
|
6470
|
+
report: executionPromptReport,
|
|
6471
|
+
});
|
|
6472
|
+
}
|
|
6428
6473
|
}
|
|
6429
6474
|
}
|
|
6430
6475
|
if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
|
|
6431
6476
|
// Note: Create a summary of all failures
|
|
6432
6477
|
const failuresSummary = $ongoingTaskResult.$failedResults
|
|
6433
|
-
.map((failure) => spaceTrim.spaceTrim((block) => {
|
|
6478
|
+
.map((failure) => spaceTrim$1.spaceTrim((block) => {
|
|
6434
6479
|
var _a, _b;
|
|
6435
6480
|
return `
|
|
6436
6481
|
Attempt ${failure.attemptIndex + 1}:
|
|
@@ -6440,14 +6485,14 @@
|
|
|
6440
6485
|
Result:
|
|
6441
6486
|
${block(failure.result === null
|
|
6442
6487
|
? 'null'
|
|
6443
|
-
: spaceTrim.spaceTrim(failure.result)
|
|
6488
|
+
: spaceTrim$1.spaceTrim(failure.result)
|
|
6444
6489
|
.split('\n')
|
|
6445
6490
|
.map((line) => `> ${line}`)
|
|
6446
6491
|
.join('\n'))}
|
|
6447
6492
|
`;
|
|
6448
6493
|
}))
|
|
6449
6494
|
.join('\n\n---\n\n');
|
|
6450
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
|
|
6495
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
|
|
6451
6496
|
var _a;
|
|
6452
6497
|
return `
|
|
6453
6498
|
LLM execution failed ${maxExecutionAttempts}x
|
|
@@ -6467,7 +6512,7 @@
|
|
|
6467
6512
|
}
|
|
6468
6513
|
}
|
|
6469
6514
|
if ($ongoingTaskResult.$resultString === null) {
|
|
6470
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6515
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6471
6516
|
Something went wrong and prompt result is null
|
|
6472
6517
|
|
|
6473
6518
|
${block(pipelineIdentification)}
|
|
@@ -6489,9 +6534,9 @@
|
|
|
6489
6534
|
* @private internal utility of `createPipelineExecutor`
|
|
6490
6535
|
*/
|
|
6491
6536
|
async function executeFormatSubvalues(options) {
|
|
6492
|
-
const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, pipelineIdentification } = options;
|
|
6537
|
+
const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, logLlmCall, pipelineIdentification, } = options;
|
|
6493
6538
|
if (task.foreach === undefined) {
|
|
6494
|
-
return /* not await */ executeAttempts(options);
|
|
6539
|
+
return /* not await */ executeAttempts({ ...options, logLlmCall });
|
|
6495
6540
|
}
|
|
6496
6541
|
if (jokerParameterNames.length !== 0) {
|
|
6497
6542
|
throw new UnexpectedError(spaceTrim__default["default"]((block) => `
|
|
@@ -6697,7 +6742,7 @@
|
|
|
6697
6742
|
},
|
|
6698
6743
|
content: task.content,
|
|
6699
6744
|
parameters,
|
|
6700
|
-
};
|
|
6745
|
+
}; /* <- Note: [🤛] */
|
|
6701
6746
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
6702
6747
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
6703
6748
|
const { index } = knowledgePiece;
|
|
@@ -6773,7 +6818,7 @@
|
|
|
6773
6818
|
// Note: Doublecheck that ALL reserved parameters are defined:
|
|
6774
6819
|
for (const parameterName of RESERVED_PARAMETER_NAMES) {
|
|
6775
6820
|
if (reservedParameters[parameterName] === undefined) {
|
|
6776
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6821
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6777
6822
|
Reserved parameter {${parameterName}} is not defined
|
|
6778
6823
|
|
|
6779
6824
|
${block(pipelineIdentification)}
|
|
@@ -6792,14 +6837,14 @@
|
|
|
6792
6837
|
* @private internal utility of `createPipelineExecutor`
|
|
6793
6838
|
*/
|
|
6794
6839
|
async function executeTask(options) {
|
|
6795
|
-
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
|
|
6840
|
+
const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, logLlmCall, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
|
|
6796
6841
|
const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
|
|
6797
6842
|
// Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
|
|
6798
6843
|
const usedParameterNames = extractParameterNamesFromTask(currentTask);
|
|
6799
6844
|
const dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
6800
6845
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
6801
6846
|
if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
|
|
6802
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6847
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6803
6848
|
Dependent parameters are not consistent with used parameters:
|
|
6804
6849
|
|
|
6805
6850
|
Dependent parameters:
|
|
@@ -6843,7 +6888,7 @@
|
|
|
6843
6888
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
6844
6889
|
// Houston, we have a problem
|
|
6845
6890
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
6846
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6891
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6847
6892
|
Parameter \`{${parameterName}}\` is NOT defined
|
|
6848
6893
|
BUT used in task "${currentTask.title || currentTask.name}"
|
|
6849
6894
|
|
|
@@ -6871,6 +6916,7 @@
|
|
|
6871
6916
|
tools,
|
|
6872
6917
|
$executionReport,
|
|
6873
6918
|
onProgress,
|
|
6919
|
+
logLlmCall,
|
|
6874
6920
|
pipelineIdentification,
|
|
6875
6921
|
maxExecutionAttempts,
|
|
6876
6922
|
maxParallelCount,
|
|
@@ -6911,9 +6957,32 @@
|
|
|
6911
6957
|
for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
|
|
6912
6958
|
if (parametersToPass[parameter.name] === undefined) {
|
|
6913
6959
|
// [4]
|
|
6914
|
-
$warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6960
|
+
$warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6915
6961
|
Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
|
|
6916
6962
|
|
|
6963
|
+
Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
|
|
6964
|
+
|
|
6965
|
+
All parameters:
|
|
6966
|
+
${block(preparedPipeline.parameters
|
|
6967
|
+
.map(({ name, isInput, isOutput, description }) => {
|
|
6968
|
+
let line = `\`{${name}}\``;
|
|
6969
|
+
if (isInput) {
|
|
6970
|
+
line += ' `[input parameter]`';
|
|
6971
|
+
}
|
|
6972
|
+
if (isOutput) {
|
|
6973
|
+
line += ' `[output parameter]`';
|
|
6974
|
+
}
|
|
6975
|
+
if (parametersToPass[name] === undefined) {
|
|
6976
|
+
line += ` <- Warning: Should be in the output but its not |`;
|
|
6977
|
+
}
|
|
6978
|
+
if (description) {
|
|
6979
|
+
line += ` ${description}`;
|
|
6980
|
+
}
|
|
6981
|
+
return line;
|
|
6982
|
+
})
|
|
6983
|
+
.map((line, index) => `${index + 1}) ${line}`)
|
|
6984
|
+
.join('\n'))}
|
|
6985
|
+
|
|
6917
6986
|
${block(pipelineIdentification)}
|
|
6918
6987
|
`)));
|
|
6919
6988
|
continue;
|
|
@@ -6934,7 +7003,7 @@
|
|
|
6934
7003
|
* @private internal utility of `createPipelineExecutor`
|
|
6935
7004
|
*/
|
|
6936
7005
|
async function executePipeline(options) {
|
|
6937
|
-
const { inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
|
|
7006
|
+
const { inputParameters, tools, onProgress, logLlmCall, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
|
|
6938
7007
|
let { preparedPipeline } = options;
|
|
6939
7008
|
if (preparedPipeline === undefined) {
|
|
6940
7009
|
preparedPipeline = await preparePipeline(pipeline, tools, {
|
|
@@ -6996,7 +7065,7 @@
|
|
|
6996
7065
|
for (const parameterName of Object.keys(inputParameters)) {
|
|
6997
7066
|
const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
|
|
6998
7067
|
if (parameter === undefined) {
|
|
6999
|
-
warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
7068
|
+
warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
7000
7069
|
Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
|
|
7001
7070
|
|
|
7002
7071
|
${block(pipelineIdentification)}
|
|
@@ -7011,7 +7080,7 @@
|
|
|
7011
7080
|
// TODO: [🧠] This should be also non-critical error
|
|
7012
7081
|
return exportJson({
|
|
7013
7082
|
name: 'pipelineExecutorResult',
|
|
7014
|
-
message: spaceTrim.spaceTrim((block) => `
|
|
7083
|
+
message: spaceTrim$1.spaceTrim((block) => `
|
|
7015
7084
|
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
7016
7085
|
|
|
7017
7086
|
${block(pipelineIdentification)}
|
|
@@ -7020,7 +7089,7 @@
|
|
|
7020
7089
|
value: {
|
|
7021
7090
|
isSuccessful: false,
|
|
7022
7091
|
errors: [
|
|
7023
|
-
new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
7092
|
+
new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
7024
7093
|
Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
|
|
7025
7094
|
|
|
7026
7095
|
${block(pipelineIdentification)}
|
|
@@ -7047,7 +7116,7 @@
|
|
|
7047
7116
|
while (unresovedTasks.length > 0) {
|
|
7048
7117
|
if (loopLimit-- < 0) {
|
|
7049
7118
|
// Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
|
|
7050
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
7119
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
7051
7120
|
Loop limit reached during resolving parameters pipeline execution
|
|
7052
7121
|
|
|
7053
7122
|
${block(pipelineIdentification)}
|
|
@@ -7057,7 +7126,7 @@
|
|
|
7057
7126
|
if (!currentTask && resolving.length === 0) {
|
|
7058
7127
|
throw new UnexpectedError(
|
|
7059
7128
|
// TODO: [🐎] DRY
|
|
7060
|
-
spaceTrim.spaceTrim((block) => `
|
|
7129
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
7061
7130
|
Can not resolve some parameters:
|
|
7062
7131
|
|
|
7063
7132
|
${block(pipelineIdentification)}
|
|
@@ -7097,7 +7166,7 @@
|
|
|
7097
7166
|
tools,
|
|
7098
7167
|
onProgress(newOngoingResult) {
|
|
7099
7168
|
if (isReturned) {
|
|
7100
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
7169
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
7101
7170
|
Can not call \`onProgress\` after pipeline execution is finished
|
|
7102
7171
|
|
|
7103
7172
|
${block(pipelineIdentification)}
|
|
@@ -7112,8 +7181,9 @@
|
|
|
7112
7181
|
onProgress(newOngoingResult);
|
|
7113
7182
|
}
|
|
7114
7183
|
},
|
|
7184
|
+
logLlmCall,
|
|
7115
7185
|
$executionReport: executionReport,
|
|
7116
|
-
pipelineIdentification: spaceTrim.spaceTrim((block) => `
|
|
7186
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
7117
7187
|
${block(pipelineIdentification)}
|
|
7118
7188
|
Task name: ${currentTask.name}
|
|
7119
7189
|
Task title: ${currentTask.title}
|
|
@@ -7222,7 +7292,7 @@
|
|
|
7222
7292
|
preparedPipeline = pipeline;
|
|
7223
7293
|
}
|
|
7224
7294
|
else if (isNotPreparedWarningSuppressed !== true) {
|
|
7225
|
-
console.warn(spaceTrim.spaceTrim((block) => `
|
|
7295
|
+
console.warn(spaceTrim$1.spaceTrim((block) => `
|
|
7226
7296
|
Pipeline is not prepared
|
|
7227
7297
|
|
|
7228
7298
|
${block(pipelineIdentification)}
|
|
@@ -7235,7 +7305,7 @@
|
|
|
7235
7305
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
7236
7306
|
}
|
|
7237
7307
|
let runCount = 0;
|
|
7238
|
-
const pipelineExecutorWithCallback = async (inputParameters, onProgress) => {
|
|
7308
|
+
const pipelineExecutorWithCallback = async (inputParameters, onProgress, logLlmCall) => {
|
|
7239
7309
|
runCount++;
|
|
7240
7310
|
return /* not await */ executePipeline({
|
|
7241
7311
|
pipeline,
|
|
@@ -7246,7 +7316,8 @@
|
|
|
7246
7316
|
inputParameters,
|
|
7247
7317
|
tools,
|
|
7248
7318
|
onProgress,
|
|
7249
|
-
|
|
7319
|
+
logLlmCall,
|
|
7320
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
7250
7321
|
${block(pipelineIdentification)}
|
|
7251
7322
|
${runCount === 1 ? '' : `Run #${runCount}`}
|
|
7252
7323
|
`),
|
|
@@ -7407,7 +7478,7 @@
|
|
|
7407
7478
|
}
|
|
7408
7479
|
const llmTools = getSingleLlmExecutionTools(llm);
|
|
7409
7480
|
// TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
|
|
7410
|
-
const collection =
|
|
7481
|
+
const collection = createPipelineCollectionFromJson(...PipelineCollection);
|
|
7411
7482
|
const prepareKnowledgeFromMarkdownExecutor = createPipelineExecutor({
|
|
7412
7483
|
pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book'),
|
|
7413
7484
|
tools: {
|