@minded-ai/mindedjs 1.0.0-ec2-beta-1
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 +6 -0
- package/dist/agent.d.ts +256 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +896 -0
- package/dist/agent.js.map +1 -0
- package/dist/browserTask/README.md +419 -0
- package/dist/browserTask/browserAgent.py +632 -0
- package/dist/browserTask/captcha_isolated.png +0 -0
- package/dist/browserTask/executeBrowserTask.d.ts +14 -0
- package/dist/browserTask/executeBrowserTask.d.ts.map +1 -0
- package/dist/browserTask/executeBrowserTask.js +195 -0
- package/dist/browserTask/executeBrowserTask.js.map +1 -0
- package/dist/browserTask/executeBrowserTask.py +153 -0
- package/dist/browserTask/executeBrowserTask.ts +79 -0
- package/dist/browserTask/localBrowserTask.d.ts +49 -0
- package/dist/browserTask/localBrowserTask.d.ts.map +1 -0
- package/dist/browserTask/localBrowserTask.js +284 -0
- package/dist/browserTask/localBrowserTask.js.map +1 -0
- package/dist/browserTask/requirements.txt +8 -0
- package/dist/browserTask/setup.sh +144 -0
- package/dist/browserTask/types.d.ts +35 -0
- package/dist/browserTask/types.d.ts.map +1 -0
- package/dist/browserTask/types.js +10 -0
- package/dist/browserTask/types.js.map +1 -0
- package/dist/checkpointer/checkpointSaverFactory.d.ts +7 -0
- package/dist/checkpointer/checkpointSaverFactory.d.ts.map +1 -0
- package/dist/checkpointer/checkpointSaverFactory.js +53 -0
- package/dist/checkpointer/checkpointSaverFactory.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +209 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/lambdaHandlerTemplate.d.ts +10 -0
- package/dist/cli/lambdaHandlerTemplate.d.ts.map +1 -0
- package/dist/cli/lambdaHandlerTemplate.js +76 -0
- package/dist/cli/lambdaHandlerTemplate.js.map +1 -0
- package/dist/cli/lambdaHandlerTemplate.ts +78 -0
- package/dist/cli/localOperatorSetup.d.ts +6 -0
- package/dist/cli/localOperatorSetup.d.ts.map +1 -0
- package/dist/cli/localOperatorSetup.js +310 -0
- package/dist/cli/localOperatorSetup.js.map +1 -0
- package/dist/debugging/index.d.ts +2 -0
- package/dist/debugging/index.d.ts.map +1 -0
- package/dist/debugging/index.js +6 -0
- package/dist/debugging/index.js.map +1 -0
- package/dist/debugging/llmCallbackHandler.d.ts +36 -0
- package/dist/debugging/llmCallbackHandler.d.ts.map +1 -0
- package/dist/debugging/llmCallbackHandler.js +101 -0
- package/dist/debugging/llmCallbackHandler.js.map +1 -0
- package/dist/edges/createDirectEdge.d.ts +4 -0
- package/dist/edges/createDirectEdge.d.ts.map +1 -0
- package/dist/edges/createDirectEdge.js +24 -0
- package/dist/edges/createDirectEdge.js.map +1 -0
- package/dist/edges/createLogicalRouter.d.ts +8 -0
- package/dist/edges/createLogicalRouter.d.ts.map +1 -0
- package/dist/edges/createLogicalRouter.js +194 -0
- package/dist/edges/createLogicalRouter.js.map +1 -0
- package/dist/edges/createPromptRouter.d.ts +12 -0
- package/dist/edges/createPromptRouter.d.ts.map +1 -0
- package/dist/edges/createPromptRouter.js +176 -0
- package/dist/edges/createPromptRouter.js.map +1 -0
- package/dist/edges/edgeFactory.d.ts +14 -0
- package/dist/edges/edgeFactory.d.ts.map +1 -0
- package/dist/edges/edgeFactory.js +125 -0
- package/dist/edges/edgeFactory.js.map +1 -0
- package/dist/events/AgentEvents.d.ts +56 -0
- package/dist/events/AgentEvents.d.ts.map +1 -0
- package/dist/events/AgentEvents.js +13 -0
- package/dist/events/AgentEvents.js.map +1 -0
- package/dist/events/index.d.ts +3 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +5 -0
- package/dist/events/index.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +98 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/zendesk.d.ts +35 -0
- package/dist/interfaces/zendesk.d.ts.map +1 -0
- package/dist/interfaces/zendesk.js +219 -0
- package/dist/interfaces/zendesk.js.map +1 -0
- package/dist/internalTools/appActionRunnerTool.d.ts +5 -0
- package/dist/internalTools/appActionRunnerTool.d.ts.map +1 -0
- package/dist/internalTools/appActionRunnerTool.js +88 -0
- package/dist/internalTools/appActionRunnerTool.js.map +1 -0
- package/dist/internalTools/documentExtraction/documentExtraction.d.ts +129 -0
- package/dist/internalTools/documentExtraction/documentExtraction.d.ts.map +1 -0
- package/dist/internalTools/documentExtraction/documentExtraction.js +736 -0
- package/dist/internalTools/documentExtraction/documentExtraction.js.map +1 -0
- package/dist/internalTools/documentExtraction/types.d.ts +29 -0
- package/dist/internalTools/documentExtraction/types.d.ts.map +1 -0
- package/dist/internalTools/documentExtraction/types.js +35 -0
- package/dist/internalTools/documentExtraction/types.js.map +1 -0
- package/dist/internalTools/libraryActionRunnerTool.d.ts +4 -0
- package/dist/internalTools/libraryActionRunnerTool.d.ts.map +1 -0
- package/dist/internalTools/libraryActionRunnerTool.js +53 -0
- package/dist/internalTools/libraryActionRunnerTool.js.map +1 -0
- package/dist/internalTools/retell.d.ts +12 -0
- package/dist/internalTools/retell.d.ts.map +1 -0
- package/dist/internalTools/retell.js +54 -0
- package/dist/internalTools/retell.js.map +1 -0
- package/dist/internalTools/sendPlaceholderMessage.d.ts +14 -0
- package/dist/internalTools/sendPlaceholderMessage.d.ts.map +1 -0
- package/dist/internalTools/sendPlaceholderMessage.js +61 -0
- package/dist/internalTools/sendPlaceholderMessage.js.map +1 -0
- package/dist/internalTools/timer.d.ts +99 -0
- package/dist/internalTools/timer.d.ts.map +1 -0
- package/dist/internalTools/timer.js +139 -0
- package/dist/internalTools/timer.js.map +1 -0
- package/dist/internalTools/voice/escalateVoiceCall.d.ts +2 -0
- package/dist/internalTools/voice/escalateVoiceCall.d.ts.map +1 -0
- package/dist/internalTools/voice/escalateVoiceCall.js +52 -0
- package/dist/internalTools/voice/escalateVoiceCall.js.map +1 -0
- package/dist/internalTools/voice/retell.d.ts +12 -0
- package/dist/internalTools/voice/retell.d.ts.map +1 -0
- package/dist/internalTools/voice/retell.js +54 -0
- package/dist/internalTools/voice/retell.js.map +1 -0
- package/dist/internalTools/voice/sendPlaceholderMessage.d.ts +14 -0
- package/dist/internalTools/voice/sendPlaceholderMessage.d.ts.map +1 -0
- package/dist/internalTools/voice/sendPlaceholderMessage.js +61 -0
- package/dist/internalTools/voice/sendPlaceholderMessage.js.map +1 -0
- package/dist/interrupts/BaseInterruptSessionManager.d.ts +49 -0
- package/dist/interrupts/BaseInterruptSessionManager.d.ts.map +1 -0
- package/dist/interrupts/BaseInterruptSessionManager.js +34 -0
- package/dist/interrupts/BaseInterruptSessionManager.js.map +1 -0
- package/dist/interrupts/MemoryInterruptSessionManager.d.ts +14 -0
- package/dist/interrupts/MemoryInterruptSessionManager.d.ts.map +1 -0
- package/dist/interrupts/MemoryInterruptSessionManager.js +60 -0
- package/dist/interrupts/MemoryInterruptSessionManager.js.map +1 -0
- package/dist/interrupts/MindedInterruptSessionManager.d.ts +13 -0
- package/dist/interrupts/MindedInterruptSessionManager.d.ts.map +1 -0
- package/dist/interrupts/MindedInterruptSessionManager.js +162 -0
- package/dist/interrupts/MindedInterruptSessionManager.js.map +1 -0
- package/dist/interrupts/interruptSessionManagerFactory.d.ts +3 -0
- package/dist/interrupts/interruptSessionManagerFactory.d.ts.map +1 -0
- package/dist/interrupts/interruptSessionManagerFactory.js +56 -0
- package/dist/interrupts/interruptSessionManagerFactory.js.map +1 -0
- package/dist/llm/createLlmInstance.d.ts +3 -0
- package/dist/llm/createLlmInstance.d.ts.map +1 -0
- package/dist/llm/createLlmInstance.js +31 -0
- package/dist/llm/createLlmInstance.js.map +1 -0
- package/dist/nodes/addAppToolNode.d.ts +13 -0
- package/dist/nodes/addAppToolNode.d.ts.map +1 -0
- package/dist/nodes/addAppToolNode.js +87 -0
- package/dist/nodes/addAppToolNode.js.map +1 -0
- package/dist/nodes/addBrowserTaskNode.d.ts +13 -0
- package/dist/nodes/addBrowserTaskNode.d.ts.map +1 -0
- package/dist/nodes/addBrowserTaskNode.js +167 -0
- package/dist/nodes/addBrowserTaskNode.js.map +1 -0
- package/dist/nodes/addBrowserTaskRunNode.d.ts +13 -0
- package/dist/nodes/addBrowserTaskRunNode.d.ts.map +1 -0
- package/dist/nodes/addBrowserTaskRunNode.js +167 -0
- package/dist/nodes/addBrowserTaskRunNode.js.map +1 -0
- package/dist/nodes/addHumanInTheLoopNode.d.ts +9 -0
- package/dist/nodes/addHumanInTheLoopNode.d.ts.map +1 -0
- package/dist/nodes/addHumanInTheLoopNode.js +22 -0
- package/dist/nodes/addHumanInTheLoopNode.js.map +1 -0
- package/dist/nodes/addJumpToNode.d.ts +7 -0
- package/dist/nodes/addJumpToNode.d.ts.map +1 -0
- package/dist/nodes/addJumpToNode.js +24 -0
- package/dist/nodes/addJumpToNode.js.map +1 -0
- package/dist/nodes/addJunctionNode.d.ts +7 -0
- package/dist/nodes/addJunctionNode.d.ts.map +1 -0
- package/dist/nodes/addJunctionNode.js +20 -0
- package/dist/nodes/addJunctionNode.js.map +1 -0
- package/dist/nodes/addPromptNode.d.ts +18 -0
- package/dist/nodes/addPromptNode.d.ts.map +1 -0
- package/dist/nodes/addPromptNode.js +253 -0
- package/dist/nodes/addPromptNode.js.map +1 -0
- package/dist/nodes/addRpaNode.d.ts +18 -0
- package/dist/nodes/addRpaNode.d.ts.map +1 -0
- package/dist/nodes/addRpaNode.js +180 -0
- package/dist/nodes/addRpaNode.js.map +1 -0
- package/dist/nodes/addToolNode.d.ts +13 -0
- package/dist/nodes/addToolNode.d.ts.map +1 -0
- package/dist/nodes/addToolNode.js +67 -0
- package/dist/nodes/addToolNode.js.map +1 -0
- package/dist/nodes/addToolRunNode.d.ts +17 -0
- package/dist/nodes/addToolRunNode.d.ts.map +1 -0
- package/dist/nodes/addToolRunNode.js +59 -0
- package/dist/nodes/addToolRunNode.js.map +1 -0
- package/dist/nodes/addTriggerNode.d.ts +7 -0
- package/dist/nodes/addTriggerNode.d.ts.map +1 -0
- package/dist/nodes/addTriggerNode.js +25 -0
- package/dist/nodes/addTriggerNode.js.map +1 -0
- package/dist/nodes/compilePrompt.d.ts +5 -0
- package/dist/nodes/compilePrompt.d.ts.map +1 -0
- package/dist/nodes/compilePrompt.js +76 -0
- package/dist/nodes/compilePrompt.js.map +1 -0
- package/dist/nodes/nodeFactory.d.ts +16 -0
- package/dist/nodes/nodeFactory.d.ts.map +1 -0
- package/dist/nodes/nodeFactory.js +45 -0
- package/dist/nodes/nodeFactory.js.map +1 -0
- package/dist/nodes/rpaStepsExecutor.d.ts +5 -0
- package/dist/nodes/rpaStepsExecutor.d.ts.map +1 -0
- package/dist/nodes/rpaStepsExecutor.js +156 -0
- package/dist/nodes/rpaStepsExecutor.js.map +1 -0
- package/dist/platform/config.d.ts +16 -0
- package/dist/platform/config.d.ts.map +1 -0
- package/dist/platform/config.js +80 -0
- package/dist/platform/config.js.map +1 -0
- package/dist/platform/mindedCheckpointSaver.d.ts +10 -0
- package/dist/platform/mindedCheckpointSaver.d.ts.map +1 -0
- package/dist/platform/mindedCheckpointSaver.js +137 -0
- package/dist/platform/mindedCheckpointSaver.js.map +1 -0
- package/dist/platform/mindedConnection.d.ts +15 -0
- package/dist/platform/mindedConnection.d.ts.map +1 -0
- package/dist/platform/mindedConnection.js +254 -0
- package/dist/platform/mindedConnection.js.map +1 -0
- package/dist/platform/mindedConnectionTypes.d.ts +404 -0
- package/dist/platform/mindedConnectionTypes.d.ts.map +1 -0
- package/dist/platform/mindedConnectionTypes.js +51 -0
- package/dist/platform/mindedConnectionTypes.js.map +1 -0
- package/dist/platform/models/mindedChatOpenAI.d.ts +20 -0
- package/dist/platform/models/mindedChatOpenAI.d.ts.map +1 -0
- package/dist/platform/models/mindedChatOpenAI.js +32 -0
- package/dist/platform/models/mindedChatOpenAI.js.map +1 -0
- package/dist/platform/models/parallelWrapper.d.ts +17 -0
- package/dist/platform/models/parallelWrapper.d.ts.map +1 -0
- package/dist/platform/models/parallelWrapper.js +105 -0
- package/dist/platform/models/parallelWrapper.js.map +1 -0
- package/dist/platform/piiGateway/gateway.d.ts +14 -0
- package/dist/platform/piiGateway/gateway.d.ts.map +1 -0
- package/dist/platform/piiGateway/gateway.js +117 -0
- package/dist/platform/piiGateway/gateway.js.map +1 -0
- package/dist/platform/piiGateway/index.d.ts +3 -0
- package/dist/platform/piiGateway/index.d.ts.map +1 -0
- package/dist/platform/piiGateway/index.js +7 -0
- package/dist/platform/piiGateway/index.js.map +1 -0
- package/dist/platform/piiGateway/types.d.ts +27 -0
- package/dist/platform/piiGateway/types.d.ts.map +1 -0
- package/dist/platform/piiGateway/types.js +3 -0
- package/dist/platform/piiGateway/types.js.map +1 -0
- package/dist/platform/toolExecutor.d.ts +29 -0
- package/dist/platform/toolExecutor.d.ts.map +1 -0
- package/dist/platform/toolExecutor.js +84 -0
- package/dist/platform/toolExecutor.js.map +1 -0
- package/dist/platform/utils/parseAttachments.d.ts +14 -0
- package/dist/platform/utils/parseAttachments.d.ts.map +1 -0
- package/dist/platform/utils/parseAttachments.js +53 -0
- package/dist/platform/utils/parseAttachments.js.map +1 -0
- package/dist/platform/utils/tools.d.ts +6 -0
- package/dist/platform/utils/tools.d.ts.map +1 -0
- package/dist/platform/utils/tools.js +57 -0
- package/dist/platform/utils/tools.js.map +1 -0
- package/dist/playbooks/playbooks.d.ts +15 -0
- package/dist/playbooks/playbooks.d.ts.map +1 -0
- package/dist/playbooks/playbooks.js +208 -0
- package/dist/playbooks/playbooks.js.map +1 -0
- package/dist/toolsLibrary/classifier.d.ts +74 -0
- package/dist/toolsLibrary/classifier.d.ts.map +1 -0
- package/dist/toolsLibrary/classifier.js +256 -0
- package/dist/toolsLibrary/classifier.js.map +1 -0
- package/dist/toolsLibrary/extraction.d.ts +83 -0
- package/dist/toolsLibrary/extraction.d.ts.map +1 -0
- package/dist/toolsLibrary/extraction.js +328 -0
- package/dist/toolsLibrary/extraction.js.map +1 -0
- package/dist/toolsLibrary/index.d.ts +9 -0
- package/dist/toolsLibrary/index.d.ts.map +1 -0
- package/dist/toolsLibrary/index.js +46 -0
- package/dist/toolsLibrary/index.js.map +1 -0
- package/dist/toolsLibrary/parseDocument.d.ts +30 -0
- package/dist/toolsLibrary/parseDocument.d.ts.map +1 -0
- package/dist/toolsLibrary/parseDocument.js +119 -0
- package/dist/toolsLibrary/parseDocument.js.map +1 -0
- package/dist/triggers/triggerTypeToDefaultMessage.d.ts +4 -0
- package/dist/triggers/triggerTypeToDefaultMessage.d.ts.map +1 -0
- package/dist/triggers/triggerTypeToDefaultMessage.js +10 -0
- package/dist/triggers/triggerTypeToDefaultMessage.js.map +1 -0
- package/dist/types/Agent.types.d.ts +60 -0
- package/dist/types/Agent.types.d.ts.map +1 -0
- package/dist/types/Agent.types.js +9 -0
- package/dist/types/Agent.types.js.map +1 -0
- package/dist/types/Flows.types.d.ts +232 -0
- package/dist/types/Flows.types.d.ts.map +1 -0
- package/dist/types/Flows.types.js +65 -0
- package/dist/types/Flows.types.js.map +1 -0
- package/dist/types/LLM.types.d.ts +7 -0
- package/dist/types/LLM.types.d.ts.map +1 -0
- package/dist/types/LLM.types.js +11 -0
- package/dist/types/LLM.types.js.map +1 -0
- package/dist/types/LangGraph.types.d.ts +45 -0
- package/dist/types/LangGraph.types.d.ts.map +1 -0
- package/dist/types/LangGraph.types.js +77 -0
- package/dist/types/LangGraph.types.js.map +1 -0
- package/dist/types/Platform.types.d.ts +7 -0
- package/dist/types/Platform.types.d.ts.map +1 -0
- package/dist/types/Platform.types.js +11 -0
- package/dist/types/Platform.types.js.map +1 -0
- package/dist/types/Tools.types.d.ts +26 -0
- package/dist/types/Tools.types.d.ts.map +1 -0
- package/dist/types/Tools.types.js +3 -0
- package/dist/types/Tools.types.js.map +1 -0
- package/dist/types/Voice.types.d.ts +5 -0
- package/dist/types/Voice.types.d.ts.map +1 -0
- package/dist/types/Voice.types.js +3 -0
- package/dist/types/Voice.types.js.map +1 -0
- package/dist/utils/agentUtils.d.ts +5 -0
- package/dist/utils/agentUtils.d.ts.map +1 -0
- package/dist/utils/agentUtils.js +97 -0
- package/dist/utils/agentUtils.js.map +1 -0
- package/dist/utils/extractStateMemoryResponse.d.ts +5 -0
- package/dist/utils/extractStateMemoryResponse.d.ts.map +1 -0
- package/dist/utils/extractStateMemoryResponse.js +91 -0
- package/dist/utils/extractStateMemoryResponse.js.map +1 -0
- package/dist/utils/history.d.ts +4 -0
- package/dist/utils/history.d.ts.map +1 -0
- package/dist/utils/history.js +33 -0
- package/dist/utils/history.js.map +1 -0
- package/dist/utils/logger.d.ts +3 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +39 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/schemaUtils.d.ts +15 -0
- package/dist/utils/schemaUtils.d.ts.map +1 -0
- package/dist/utils/schemaUtils.js +56 -0
- package/dist/utils/schemaUtils.js.map +1 -0
- package/dist/utils/wait.d.ts +2 -0
- package/dist/utils/wait.d.ts.map +1 -0
- package/dist/utils/wait.js +6 -0
- package/dist/utils/wait.js.map +1 -0
- package/dist/voice/elevenLabsUtils.d.ts +65 -0
- package/dist/voice/elevenLabsUtils.d.ts.map +1 -0
- package/dist/voice/elevenLabsUtils.js +4 -0
- package/dist/voice/elevenLabsUtils.js.map +1 -0
- package/dist/voice/voiceSession.d.ts +37 -0
- package/dist/voice/voiceSession.d.ts.map +1 -0
- package/dist/voice/voiceSession.js +306 -0
- package/dist/voice/voiceSession.js.map +1 -0
- package/docs/.gitbook/assets/ADLC.png +0 -0
- package/docs/.gitbook/assets/PII-masking.png +0 -0
- package/docs/.gitbook/assets/image.png +0 -0
- package/docs/.gitbook/assets/on-prem.svg +4 -0
- package/docs/README.md +54 -0
- package/docs/SUMMARY.md +56 -0
- package/docs/examples/order-refund-flow.md +566 -0
- package/docs/getting-started/environment-configuration.md +158 -0
- package/docs/getting-started/installation.md +44 -0
- package/docs/getting-started/project-configuration.md +206 -0
- package/docs/getting-started/quick-start.md +262 -0
- package/docs/integrations/zendesk.md +554 -0
- package/docs/low-code-editor/edges.md +396 -0
- package/docs/low-code-editor/flows.md +74 -0
- package/docs/low-code-editor/nodes.md +367 -0
- package/docs/low-code-editor/playbooks.md +280 -0
- package/docs/low-code-editor/tools.md +358 -0
- package/docs/low-code-editor/triggers.md +182 -0
- package/docs/platform/on-prem.md +182 -0
- package/docs/platform/operator.md +89 -0
- package/docs/platform/pii-masking.md +221 -0
- package/docs/platform/scenarios.md +43 -0
- package/docs/platform/secrets.md +99 -0
- package/docs/platform/sso.md +27 -0
- package/docs/resources/your-first-eval.md +108 -0
- package/docs/sdk/agent-api.md +540 -0
- package/docs/sdk/debugging.md +80 -0
- package/docs/sdk/events.md +595 -0
- package/docs/sdk/logging.md +72 -0
- package/docs/sdk/memory.md +271 -0
- package/docs/sdk/parallel-llm.md +242 -0
- package/docs/sdk/vectorstore-query.md +60 -0
- package/docs/tooling/classifier.md +217 -0
- package/docs/tooling/document-processing.md +389 -0
- package/docs/tooling/extraction.md +78 -0
- package/docs/tooling/timers.md +61 -0
- package/package.json +73 -0
- package/src/agent.ts +1019 -0
- package/src/browserTask/executeBrowserTask.py +153 -0
- package/src/browserTask/executeBrowserTask.ts +253 -0
- package/src/browserTask/localBrowserTask.ts +300 -0
- package/src/browserTask/profile/Default/Extension Rules/000003.log +0 -0
- package/src/browserTask/profile/Default/Extension Scripts/000003.log +0 -0
- package/src/browserTask/profile/Default/Extension State/000003.log +0 -0
- package/src/browserTask/profile/Default/GCM Store/000003.log +0 -0
- package/src/browserTask/profile/Default/Local Storage/leveldb/000004.log +0 -0
- package/src/browserTask/profile/Default/Session Storage/000003.log +0 -0
- package/src/browserTask/profile/Default/Site Characteristics Database/000003.log +0 -0
- package/src/browserTask/profile/Default/Sync Data/LevelDB/000003.log +0 -0
- package/src/browserTask/profile/Default/shared_proto_db/000003.log +0 -0
- package/src/browserTask/profile/Default/shared_proto_db/metadata/000003.log +0 -0
- package/src/browserTask/types.ts +37 -0
- package/src/checkpointer/checkpointSaverFactory.ts +18 -0
- package/src/cli/index.ts +188 -0
- package/src/cli/lambdaHandlerTemplate.ts +78 -0
- package/src/cli/localOperatorSetup.ts +308 -0
- package/src/debugging/index.ts +1 -0
- package/src/debugging/llmCallbackHandler.ts +125 -0
- package/src/edges/createDirectEdge.ts +22 -0
- package/src/edges/createLogicalRouter.ts +182 -0
- package/src/edges/createPromptRouter.ts +213 -0
- package/src/edges/edgeFactory.ts +167 -0
- package/src/events/AgentEvents.ts +58 -0
- package/src/events/index.ts +3 -0
- package/src/index.ts +105 -0
- package/src/interfaces/zendesk.ts +212 -0
- package/src/internalTools/appActionRunnerTool.ts +68 -0
- package/src/internalTools/documentExtraction/documentExtraction.ts +804 -0
- package/src/internalTools/documentExtraction/types.ts +59 -0
- package/src/internalTools/libraryActionRunnerTool.ts +62 -0
- package/src/internalTools/timer.ts +125 -0
- package/src/internalTools/voice/escalateVoiceCall.ts +15 -0
- package/src/internalTools/voice/retell.ts +28 -0
- package/src/internalTools/voice/sendPlaceholderMessage.ts +27 -0
- package/src/interrupts/BaseInterruptSessionManager.ts +80 -0
- package/src/interrupts/MemoryInterruptSessionManager.ts +63 -0
- package/src/interrupts/MindedInterruptSessionManager.ts +163 -0
- package/src/interrupts/interruptSessionManagerFactory.ts +20 -0
- package/src/llm/createLlmInstance.ts +33 -0
- package/src/nodes/addAppToolNode.ts +111 -0
- package/src/nodes/addBrowserTaskNode.ts +191 -0
- package/src/nodes/addBrowserTaskRunNode.ts +190 -0
- package/src/nodes/addHumanInTheLoopNode.ts +26 -0
- package/src/nodes/addJumpToNode.ts +26 -0
- package/src/nodes/addJunctionNode.ts +21 -0
- package/src/nodes/addPromptNode.ts +305 -0
- package/src/nodes/addRpaNode.ts +217 -0
- package/src/nodes/addToolNode.ts +84 -0
- package/src/nodes/addToolRunNode.ts +80 -0
- package/src/nodes/addTriggerNode.ts +27 -0
- package/src/nodes/compilePrompt.ts +44 -0
- package/src/nodes/nodeFactory.ts +61 -0
- package/src/nodes/rpaStepsExecutor.ts +175 -0
- package/src/platform/config.ts +89 -0
- package/src/platform/mindedCheckpointSaver.ts +146 -0
- package/src/platform/mindedConnection.ts +250 -0
- package/src/platform/mindedConnectionTypes.ts +495 -0
- package/src/platform/models/mindedChatOpenAI.ts +49 -0
- package/src/platform/models/parallelWrapper.ts +141 -0
- package/src/platform/piiGateway/gateway.ts +103 -0
- package/src/platform/piiGateway/index.ts +5 -0
- package/src/platform/piiGateway/types.ts +29 -0
- package/src/platform/toolExecutor.ts +106 -0
- package/src/platform/utils/parseAttachments.ts +56 -0
- package/src/platform/utils/tools.ts +55 -0
- package/src/playbooks/playbooks.ts +200 -0
- package/src/toolsLibrary/classifier.ts +326 -0
- package/src/toolsLibrary/extraction.ts +393 -0
- package/src/toolsLibrary/index.ts +10 -0
- package/src/toolsLibrary/parseDocument.ts +129 -0
- package/src/triggers/triggerTypeToDefaultMessage.ts +9 -0
- package/src/types/Agent.types.ts +73 -0
- package/src/types/Flows.types.ts +262 -0
- package/src/types/LLM.types.ts +15 -0
- package/src/types/LangGraph.types.ts +86 -0
- package/src/types/Platform.types.ts +6 -0
- package/src/types/Tools.types.ts +28 -0
- package/src/types/Voice.types.ts +4 -0
- package/src/utils/agentUtils.ts +69 -0
- package/src/utils/history.ts +38 -0
- package/src/utils/logger.ts +38 -0
- package/src/utils/schemaUtils.ts +68 -0
- package/src/utils/wait.ts +1 -0
- package/src/voice/elevenLabsUtils.ts +81 -0
- package/src/voice/voiceSession.ts +309 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# Classifier Tool
|
|
2
|
+
|
|
3
|
+
The classifier tool is a powerful utility in the MindedJS SDK that allows you to categorize text content using AI. It's available both as a tool that can be used in flows and as standalone utility functions that can be imported and used anywhere in your code.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The classifier tool provides:
|
|
8
|
+
|
|
9
|
+
- **Single-label classification**: Categorize content into one class
|
|
10
|
+
- **Multi-label classification**: Categorize content into multiple classes
|
|
11
|
+
- **Conversation classification**: Specialized classification for chat conversations
|
|
12
|
+
- **Configurable output formats**: JSON or plain text
|
|
13
|
+
- **Error handling with fallback defaults**
|
|
14
|
+
- **Confidence scoring**
|
|
15
|
+
|
|
16
|
+
## Using as a Tool
|
|
17
|
+
|
|
18
|
+
### In Flows
|
|
19
|
+
|
|
20
|
+
You can use the classifier tool in your flows by referencing `minded-classifier`:
|
|
21
|
+
|
|
22
|
+
```yaml
|
|
23
|
+
- id: classifyUserIntent
|
|
24
|
+
type: tool
|
|
25
|
+
toolName: minded-classifier
|
|
26
|
+
prompt: |
|
|
27
|
+
Classify the user's message into one of these categories:
|
|
28
|
+
- Technical Issue: Problems with the system
|
|
29
|
+
- Billing: Payment or pricing questions
|
|
30
|
+
- Feature Request: Asking for new features
|
|
31
|
+
|
|
32
|
+
Content: "{{userMessage}}"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Tool Parameters
|
|
36
|
+
|
|
37
|
+
| Parameter | Type | Description | Required |
|
|
38
|
+
| ------------- | ---------------- | ------------------------------------------------------ | -------- |
|
|
39
|
+
| content | string | The text content to classify | Yes |
|
|
40
|
+
| classes | array | Classes to classify into (strings, tuples, or objects) | No\* |
|
|
41
|
+
| systemPrompt | string | Custom system prompt for classification | No |
|
|
42
|
+
| includeReason | boolean | Whether to include reasoning (default: true) | No |
|
|
43
|
+
| outputFormat | 'json' \| 'text' | Output format (default: 'json') | No |
|
|
44
|
+
| defaultClass | string | Fallback class if classification fails | No |
|
|
45
|
+
| defaultReason | string | Fallback reason if classification fails | No |
|
|
46
|
+
|
|
47
|
+
\*Classes can be provided in the tool parameters or stored in agent memory
|
|
48
|
+
|
|
49
|
+
## Using as a Utility
|
|
50
|
+
|
|
51
|
+
### Import the Utilities
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { toolsLibrary } from '@minded-ai/mindedjs';
|
|
55
|
+
|
|
56
|
+
const { classify, createClassifier, createConversationClassifier, multiClassify } = toolsLibrary.tools['minded-classifier'];
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Direct Classification
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
const result = await classify(
|
|
63
|
+
"I can't access my account",
|
|
64
|
+
{
|
|
65
|
+
classes: [
|
|
66
|
+
{ name: 'Technical', description: 'Technical issues' },
|
|
67
|
+
{ name: 'Account', description: 'Account access problems' },
|
|
68
|
+
],
|
|
69
|
+
includeReason: true,
|
|
70
|
+
},
|
|
71
|
+
agent.llm,
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
console.log(result);
|
|
75
|
+
// { class: 'Account', reason: 'User cannot access their account', confidence: 0.95 }
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Create Reusable Classifiers
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
// Simple classifier with string classes
|
|
82
|
+
const sentimentClassifier = createClassifier(['positive', 'negative', 'neutral']);
|
|
83
|
+
|
|
84
|
+
// Classifier with descriptions
|
|
85
|
+
const intentClassifier = createClassifier([
|
|
86
|
+
['greeting', 'User is greeting or saying hello'],
|
|
87
|
+
['question', 'User is asking a question'],
|
|
88
|
+
['complaint', 'User is complaining or expressing dissatisfaction'],
|
|
89
|
+
['goodbye', 'User is saying goodbye or ending conversation'],
|
|
90
|
+
]);
|
|
91
|
+
|
|
92
|
+
// Use the classifier
|
|
93
|
+
const sentiment = await sentimentClassifier('This is amazing!', agent.llm);
|
|
94
|
+
const intent = await intentClassifier('Hello there!', agent.llm);
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Conversation Classification
|
|
98
|
+
|
|
99
|
+
For classifying entire conversations:
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
const conversationClassifier = createConversationClassifier([
|
|
103
|
+
{ name: 'Resolved', description: 'Issue was resolved successfully' },
|
|
104
|
+
{ name: 'Escalated', description: 'Needs escalation to human agent' },
|
|
105
|
+
{ name: 'Pending', description: 'Awaiting more information' },
|
|
106
|
+
]);
|
|
107
|
+
|
|
108
|
+
const result = await conversationClassifier(messages, agent.llm);
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Multi-Label Classification
|
|
112
|
+
|
|
113
|
+
When content can belong to multiple categories:
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
const topics = await multiClassify(
|
|
117
|
+
'The app crashes on login and the UI looks outdated',
|
|
118
|
+
{
|
|
119
|
+
classes: [
|
|
120
|
+
{ name: 'Bug', description: 'Software bugs or crashes' },
|
|
121
|
+
{ name: 'UI/UX', description: 'User interface issues' },
|
|
122
|
+
{ name: 'Authentication', description: 'Login or auth problems' },
|
|
123
|
+
],
|
|
124
|
+
maxClasses: 3,
|
|
125
|
+
},
|
|
126
|
+
agent.llm,
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
console.log(topics);
|
|
130
|
+
// [
|
|
131
|
+
// { class: 'Bug', reason: 'App crashes', confidence: 0.9 },
|
|
132
|
+
// { class: 'Authentication', reason: 'Login issues', confidence: 0.85 },
|
|
133
|
+
// { class: 'UI/UX', reason: 'Outdated UI', confidence: 0.7 }
|
|
134
|
+
// ]
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Configuration Options
|
|
138
|
+
|
|
139
|
+
### ClassifierConfig Interface
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
interface ClassifierConfig {
|
|
143
|
+
classes: ClassDefinition[];
|
|
144
|
+
systemPrompt?: string;
|
|
145
|
+
outputFormat?: 'json' | 'text';
|
|
146
|
+
includeReason?: boolean;
|
|
147
|
+
defaultClass?: string;
|
|
148
|
+
defaultReason?: string;
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Class Definition Formats
|
|
153
|
+
|
|
154
|
+
Classes can be defined in multiple ways:
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
// Simple strings
|
|
158
|
+
['positive', 'negative', 'neutral'][
|
|
159
|
+
// Tuples with descriptions
|
|
160
|
+
(['technical', 'Technical problems'], ['billing', 'Payment issues'])
|
|
161
|
+
][
|
|
162
|
+
// Objects
|
|
163
|
+
({ name: 'urgent', description: 'Requires immediate attention' }, { name: 'normal', description: 'Standard priority' })
|
|
164
|
+
];
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Example: Customer Support Bot
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
import { Agent, toolsLibrary } from '@minded-ai/mindedjs';
|
|
171
|
+
import { z } from 'zod';
|
|
172
|
+
|
|
173
|
+
const classifierTool = toolsLibrary.tools['minded-classifier'].default;
|
|
174
|
+
|
|
175
|
+
const agent = new Agent({
|
|
176
|
+
memorySchema: z.object({
|
|
177
|
+
ticketPriority: z.string().optional(),
|
|
178
|
+
ticketCategory: z.string().optional(),
|
|
179
|
+
}),
|
|
180
|
+
config: {
|
|
181
|
+
flows: ['./flows'],
|
|
182
|
+
llm: { provider: 'openai', model: 'gpt-4' },
|
|
183
|
+
},
|
|
184
|
+
tools: [classifierTool],
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
// Create specialized classifiers
|
|
188
|
+
const priorityClassifier = createClassifier([
|
|
189
|
+
['urgent', 'Requires immediate attention'],
|
|
190
|
+
['high', 'Important but not critical'],
|
|
191
|
+
['normal', 'Standard priority'],
|
|
192
|
+
['low', 'Can be handled later'],
|
|
193
|
+
]);
|
|
194
|
+
|
|
195
|
+
const categoryClassifier = createClassifier([
|
|
196
|
+
['technical', 'Technical issues or bugs'],
|
|
197
|
+
['billing', 'Payment and subscription issues'],
|
|
198
|
+
['feature', 'Feature requests'],
|
|
199
|
+
['other', 'General inquiries'],
|
|
200
|
+
]);
|
|
201
|
+
|
|
202
|
+
// Use in message handler
|
|
203
|
+
agent.on('message', async (message) => {
|
|
204
|
+
const [priority, category] = await Promise.all([
|
|
205
|
+
priorityClassifier(message.content, agent.llm),
|
|
206
|
+
categoryClassifier(message.content, agent.llm),
|
|
207
|
+
]);
|
|
208
|
+
|
|
209
|
+
// Update agent memory
|
|
210
|
+
await agent.updateMemory({
|
|
211
|
+
ticketPriority: priority.class,
|
|
212
|
+
ticketCategory: category.class,
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
`
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
# Document Processing
|
|
2
|
+
|
|
3
|
+
MindedJS provides powerful document processing capabilities that allow you to extract data from various document types including images, PDFs, Word documents, spreadsheets, and more.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The document processing system supports three modes of operation:
|
|
8
|
+
|
|
9
|
+
1. **Structured Extraction with Schema**: Extract data into a predefined structure using AI
|
|
10
|
+
2. **Unstructured Extraction with Prompt**: Extract information based on prompt instructions
|
|
11
|
+
3. **Raw Text Extraction**: Extract plain text without AI processing
|
|
12
|
+
|
|
13
|
+
Supported document types:
|
|
14
|
+
|
|
15
|
+
- **Images**: JPG, PNG, GIF, BMP, WebP, TIFF
|
|
16
|
+
- **Documents**: PDF, DOC, DOCX, TXT, RTF, ODT
|
|
17
|
+
- **Spreadsheets**: XLS, XLSX, CSV, ODS
|
|
18
|
+
- **Presentations**: PPT, PPTX, ODP
|
|
19
|
+
- **Web formats**: HTML, HTM, MD, XML
|
|
20
|
+
|
|
21
|
+
## Library Tool Integration
|
|
22
|
+
|
|
23
|
+
The document processing functionality is available as a **library tool** called `minded-parse-documents` that can be added to your flows through the Minded platform. As a library tool, it provides several configuration advantages:
|
|
24
|
+
|
|
25
|
+
### System Prompt Configuration
|
|
26
|
+
|
|
27
|
+
The `systemPrompt` property can be configured directly in the Minded platform's flow editor when adding the parseDocument tool to your flow. This allows you to:
|
|
28
|
+
|
|
29
|
+
- Set extraction instructions without code changes
|
|
30
|
+
- Customize prompts for different use cases within the same agent
|
|
31
|
+
- Update extraction behavior through the UI without redeployment
|
|
32
|
+
|
|
33
|
+
**When system prompt is configured in the platform:**
|
|
34
|
+
|
|
35
|
+
- The platform-configured prompt takes precedence and guides the AI extraction
|
|
36
|
+
- The prompt is automatically applied to all document processing operations in that flow node
|
|
37
|
+
|
|
38
|
+
**When system prompt is not set:**
|
|
39
|
+
|
|
40
|
+
- The tool falls back to using any Zod schema provided for structured extraction
|
|
41
|
+
- If no schema is provided, the tool performs basic text extraction with minimal AI guidance
|
|
42
|
+
- Raw text extraction mode bypasses AI processing entirely regardless of prompt configuration
|
|
43
|
+
|
|
44
|
+
### Parameter Configuration
|
|
45
|
+
|
|
46
|
+
Other tool parameters that can be pre-configured in the platform include:
|
|
47
|
+
|
|
48
|
+
- `loadFrom`: Source type (url, path, buffer, string)
|
|
49
|
+
- `extractRaw`: Whether to extract raw text without AI processing
|
|
50
|
+
- `schema`: Zod schema for structured data extraction
|
|
51
|
+
|
|
52
|
+
Parameters not set in the platform can still be provided by the LLM during execution, allowing for flexible hybrid configuration.
|
|
53
|
+
|
|
54
|
+
## Quick Start
|
|
55
|
+
|
|
56
|
+
### Structured Data Extraction (with Schema)
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { extractFromDocument } from '@minded-ai/mindedjs';
|
|
60
|
+
import { z } from 'zod';
|
|
61
|
+
|
|
62
|
+
// Define the data structure you want to extract
|
|
63
|
+
const schema = z.object({
|
|
64
|
+
name: z.string(),
|
|
65
|
+
email: z.string(),
|
|
66
|
+
phoneNumber: z.string().optional(),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// Extract structured data using the agent's LLM
|
|
70
|
+
const result = await extractFromDocument({
|
|
71
|
+
llm: agent.llm,
|
|
72
|
+
documentPath: './path/to/id-card.jpg',
|
|
73
|
+
schema,
|
|
74
|
+
systemPrompt: 'Extract personal information from this ID document',
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
console.log(result.data.name); // Typed data matching your schema
|
|
78
|
+
console.log(result.metadata.processingTime); // Processing time in ms
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Unstructured Extraction (Prompt Only)
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
// Extract information without a predefined schema
|
|
85
|
+
const result = await extractFromDocument({
|
|
86
|
+
llm: agent.llm,
|
|
87
|
+
documentPath: './contract.pdf',
|
|
88
|
+
systemPrompt: `
|
|
89
|
+
Extract and summarize:
|
|
90
|
+
1. All parties involved
|
|
91
|
+
2. Key dates and deadlines
|
|
92
|
+
3. Payment terms
|
|
93
|
+
4. Termination clauses
|
|
94
|
+
`,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
console.log(result.data); // String containing the extracted information
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Raw Text Extraction (No AI)
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
// Extract raw text without AI processing
|
|
104
|
+
const result = await extractFromDocument({
|
|
105
|
+
documentPath: './document.pdf',
|
|
106
|
+
config: {
|
|
107
|
+
llamaCloudApiKey: process.env.LLAMA_CLOUD_API_KEY,
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
console.log(result.data); // Raw text content from the document
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Using Document URLs
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
const result = await extractFromDocument({
|
|
118
|
+
llm: agent.llm,
|
|
119
|
+
documentUrl: 'https://example.com/invoice.pdf',
|
|
120
|
+
schema: z.object({
|
|
121
|
+
invoiceNumber: z.string(),
|
|
122
|
+
amount: z.number(),
|
|
123
|
+
dueDate: z.string(),
|
|
124
|
+
}),
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Configuration
|
|
129
|
+
|
|
130
|
+
### Environment Variables
|
|
131
|
+
|
|
132
|
+
Set these environment variables for optimal functionality:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Required for advanced document parsing (PDFs, Word docs, etc.)
|
|
136
|
+
LLAMA_CLOUD_API_KEY=your_llama_cloud_api_key
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Document Processor Configuration
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
const result = await extractFromDocument({
|
|
143
|
+
llm: agent.llm,
|
|
144
|
+
documentPath: './image.jpg',
|
|
145
|
+
schema: yourSchema,
|
|
146
|
+
config: {
|
|
147
|
+
llamaCloudApiKey: 'your-key', // Override env variable
|
|
148
|
+
useBase64: true, // Return images as base64
|
|
149
|
+
maxImageWidth: 1600, // Max image width for processing
|
|
150
|
+
imageQuality: 90, // JPEG quality (0-100)
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### LLM Configuration
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
const result = await extractFromDocument({
|
|
159
|
+
llm: agent.llm,
|
|
160
|
+
documentPath: './document.pdf',
|
|
161
|
+
schema: yourSchema,
|
|
162
|
+
llmConfig: {
|
|
163
|
+
model: 'gpt-4o', // Override default model
|
|
164
|
+
temperature: 0.1, // Lower temperature for consistent extraction
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Advanced Usage
|
|
170
|
+
|
|
171
|
+
### Custom System Prompts
|
|
172
|
+
|
|
173
|
+
Tailor the AI's extraction behavior with custom prompts:
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
const result = await extractFromDocument({
|
|
177
|
+
llm: agent.llm,
|
|
178
|
+
documentPath: './medical-record.pdf',
|
|
179
|
+
schema: z.object({
|
|
180
|
+
patientName: z.string(),
|
|
181
|
+
diagnosis: z.string(),
|
|
182
|
+
medications: z.array(z.string()),
|
|
183
|
+
}),
|
|
184
|
+
systemPrompt: `
|
|
185
|
+
You are a medical data extraction specialist.
|
|
186
|
+
Extract information with high accuracy and attention to medical terminology.
|
|
187
|
+
If any required field is unclear or missing, mark it as "Not clearly specified".
|
|
188
|
+
`,
|
|
189
|
+
});
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Handling Multiple Document Sources
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
const processDocuments = async (documents: string[]) => {
|
|
196
|
+
const results = await Promise.all(
|
|
197
|
+
documents.map((path) =>
|
|
198
|
+
extractFromDocument({
|
|
199
|
+
llm: agent.llm,
|
|
200
|
+
documentPath: path,
|
|
201
|
+
schema: invoiceSchema,
|
|
202
|
+
}),
|
|
203
|
+
),
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
return results.map((r) => r.data);
|
|
207
|
+
};
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Error Handling
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
try {
|
|
214
|
+
const result = await extractFromDocument({
|
|
215
|
+
llm: agent.llm,
|
|
216
|
+
documentPath: './document.pdf',
|
|
217
|
+
schema: yourSchema,
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
logger.info({ message: 'Extracted', data: result.data });
|
|
221
|
+
} catch (err) {
|
|
222
|
+
if (err.message.includes('LLAMA_CLOUD_API_KEY')) {
|
|
223
|
+
logger.error({ message: 'LlamaCloud API key required for PDF processing', err });
|
|
224
|
+
} else if (err.message.includes('Document not found')) {
|
|
225
|
+
logger.error({ message: 'File does not exist', err });
|
|
226
|
+
} else {
|
|
227
|
+
logger.error({ message: 'Processing failed', err });
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Example Use Cases
|
|
233
|
+
|
|
234
|
+
### Invoice Processing
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
const invoiceSchema = z.object({
|
|
238
|
+
invoiceNumber: z.string(),
|
|
239
|
+
vendor: z.string(),
|
|
240
|
+
amount: z.number(),
|
|
241
|
+
dueDate: z.string(),
|
|
242
|
+
lineItems: z.array(
|
|
243
|
+
z.object({
|
|
244
|
+
description: z.string(),
|
|
245
|
+
quantity: z.number(),
|
|
246
|
+
unitPrice: z.number(),
|
|
247
|
+
}),
|
|
248
|
+
),
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
const result = await extractFromDocument({
|
|
252
|
+
llm: agent.llm,
|
|
253
|
+
documentPath: './invoice.pdf',
|
|
254
|
+
schema: invoiceSchema,
|
|
255
|
+
systemPrompt: 'Extract all invoice details including line items',
|
|
256
|
+
});
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Identity Document Verification
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
const idSchema = z.object({
|
|
263
|
+
documentType: z.enum(['passport', 'driver_license', 'national_id']),
|
|
264
|
+
fullName: z.string(),
|
|
265
|
+
dateOfBirth: z.string(),
|
|
266
|
+
documentNumber: z.string(),
|
|
267
|
+
expiryDate: z.string().optional(),
|
|
268
|
+
issuingCountry: z.string().optional(),
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
const result = await extractFromDocument({
|
|
272
|
+
llm: agent.llm,
|
|
273
|
+
documentPath: './id-document.jpg',
|
|
274
|
+
schema: idSchema,
|
|
275
|
+
});
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Contract Analysis
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
const contractSchema = z.object({
|
|
282
|
+
parties: z.array(z.string()),
|
|
283
|
+
effectiveDate: z.string(),
|
|
284
|
+
expiryDate: z.string().optional(),
|
|
285
|
+
keyTerms: z.array(z.string()),
|
|
286
|
+
terminationClauses: z.array(z.string()),
|
|
287
|
+
governingLaw: z.string().optional(),
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
const result = await extractFromDocument({
|
|
291
|
+
llm: agent.llm,
|
|
292
|
+
documentPath: './contract.docx',
|
|
293
|
+
schema: contractSchema,
|
|
294
|
+
systemPrompt: 'Focus on legal terms, dates, and parties involved',
|
|
295
|
+
});
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## Tool Implementation
|
|
299
|
+
|
|
300
|
+
### Using the Library Tool
|
|
301
|
+
|
|
302
|
+
The easiest way to add document processing to your flows is using the **minded-parse-documents library tool** available in the Minded platform. Simply add it to your flow through the platform UI and configure the parameters as needed.
|
|
303
|
+
|
|
304
|
+
## Standalone Usage
|
|
305
|
+
|
|
306
|
+
You can also use the document processor independently of the agent:
|
|
307
|
+
|
|
308
|
+
```typescript
|
|
309
|
+
import { DocumentProcessor, extractFromDocument } from '@minded-ai/mindedjs';
|
|
310
|
+
|
|
311
|
+
// Using the class directly
|
|
312
|
+
const processor = new DocumentProcessor({
|
|
313
|
+
llamaCloudApiKey: 'your-key',
|
|
314
|
+
maxImageWidth: 1200,
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
const result = await processor.extractFromDocument({
|
|
318
|
+
documentPath: './document.pdf',
|
|
319
|
+
schema: yourSchema,
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
// Using the convenience function
|
|
323
|
+
const result2 = await extractFromDocument({
|
|
324
|
+
documentPath: './document.pdf',
|
|
325
|
+
schema: yourSchema,
|
|
326
|
+
config: {
|
|
327
|
+
llamaCloudApiKey: 'your-key',
|
|
328
|
+
},
|
|
329
|
+
});
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## Troubleshooting
|
|
333
|
+
|
|
334
|
+
### Common Issues
|
|
335
|
+
|
|
336
|
+
**PDF Processing Fails**
|
|
337
|
+
|
|
338
|
+
```
|
|
339
|
+
Error: PDF processing requires LLAMA_CLOUD_API_KEY
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
_Solution_: Set the `LLAMA_CLOUD_API_KEY` environment variable.
|
|
343
|
+
|
|
344
|
+
**Image Too Large**
|
|
345
|
+
|
|
346
|
+
```
|
|
347
|
+
Error: Image processing failed: Input image exceeds pixel limit
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
_Solution_: Reduce `maxImageWidth` in configuration or resize images beforehand.
|
|
351
|
+
|
|
352
|
+
**Schema Validation Errors**
|
|
353
|
+
|
|
354
|
+
```
|
|
355
|
+
Error: LLM extraction failed: Invalid schema
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
_Solution_: Check that your Zod schema matches expected data structure.
|
|
359
|
+
|
|
360
|
+
**Network Timeouts**
|
|
361
|
+
|
|
362
|
+
```
|
|
363
|
+
Error: Failed to fetch document from URL: timeout
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
_Solution_: Implement retry logic or download files locally first.
|
|
367
|
+
|
|
368
|
+
### Debugging
|
|
369
|
+
|
|
370
|
+
Enable debug logging to troubleshoot issues:
|
|
371
|
+
|
|
372
|
+
```typescript
|
|
373
|
+
// Set LOG_LEVEL environment variable
|
|
374
|
+
process.env.LOG_LEVEL = 'debug';
|
|
375
|
+
|
|
376
|
+
// Or use the logger directly
|
|
377
|
+
import { logger } from '@minded-ai/mindedjs';
|
|
378
|
+
logger.debug('Processing document:', { path: documentPath });
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
## Supported File Types
|
|
382
|
+
|
|
383
|
+
| Category | Extensions | Notes |
|
|
384
|
+
| ------------- | ------------------------------------------- | ---------------------------------------- |
|
|
385
|
+
| Images | .jpg, .jpeg, .png, .gif, .bmp, .webp, .tiff | Direct processing |
|
|
386
|
+
| Documents | .pdf, .doc, .docx, .txt, .rtf, .odt | Requires LlamaCloud for advanced formats |
|
|
387
|
+
| Spreadsheets | .xls, .xlsx, .csv, .ods | Requires LlamaCloud for binary formats |
|
|
388
|
+
| Presentations | .ppt, .pptx, .odp | Requires LlamaCloud |
|
|
389
|
+
| Web | .html, .htm, .md, .xml | Basic text extraction |
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Data Extraction
|
|
2
|
+
|
|
3
|
+
MindedJS provides a powerful AI-based extraction tool for extracting structured data from unstructured text. The extraction system uses LLM capabilities to parse content and return data in a predefined format.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The extraction tool (`minded-extraction`) enables you to extract specific information from text using:
|
|
8
|
+
|
|
9
|
+
- **Structured Extraction with Zod Schema**: Define exact data structure using Zod schemas
|
|
10
|
+
- **Prompt-based Extraction**: Extract information using custom prompts
|
|
11
|
+
- **Validation and Retries**: Automatic validation against schema with retry logic
|
|
12
|
+
|
|
13
|
+
## Key Features
|
|
14
|
+
|
|
15
|
+
- **LLM Structured Output Support**: When available, uses the LLM's native structured output capabilities for guaranteed schema compliance
|
|
16
|
+
- **Fallback JSON Parsing**: Automatically falls back to JSON parsing with validation when structured output is unavailable
|
|
17
|
+
- **Schema Validation**: Built-in Zod validation ensures extracted data matches expected structure
|
|
18
|
+
- **Retry Logic**: Configurable retry attempts with error feedback for improved accuracy
|
|
19
|
+
- **Strict and Non-strict Modes**: Choose between validated extraction (strict) or flexible extraction
|
|
20
|
+
|
|
21
|
+
## Library Tool Integration
|
|
22
|
+
|
|
23
|
+
The extraction functionality is available as a library tool called `minded-extraction` that can be added to your flows through the Minded platform.
|
|
24
|
+
|
|
25
|
+
### Configuration Options
|
|
26
|
+
|
|
27
|
+
- `content`: The text to extract information from
|
|
28
|
+
- `schema`: Optional Zod-compatible schema defining the structure
|
|
29
|
+
- `systemPrompt`: Custom instructions for extraction
|
|
30
|
+
- `examples`: Input/output examples to guide extraction
|
|
31
|
+
- `strictMode`: Enable/disable schema validation (default: true)
|
|
32
|
+
- `maxRetries`: Number of retry attempts on validation failure (default: 3)
|
|
33
|
+
- `defaultValue`: Fallback value if extraction fails
|
|
34
|
+
|
|
35
|
+
## How It Works
|
|
36
|
+
|
|
37
|
+
1. **With Structured Output Support** (when available):
|
|
38
|
+
|
|
39
|
+
- The tool uses the LLM's `withStructuredOutput` method for direct schema-compliant extraction
|
|
40
|
+
- No manual JSON parsing or validation needed
|
|
41
|
+
- Guaranteed to match the provided Zod schema
|
|
42
|
+
|
|
43
|
+
2. **Fallback Mode** (JSON parsing):
|
|
44
|
+
|
|
45
|
+
- Generates a prompt with schema description
|
|
46
|
+
- Uses JSON output parser to extract structured data
|
|
47
|
+
- Validates against Zod schema
|
|
48
|
+
- Retries with error feedback if validation fails
|
|
49
|
+
|
|
50
|
+
3. **Non-strict Mode**:
|
|
51
|
+
- Skips validation for more flexible extraction
|
|
52
|
+
- Useful when schema compliance is not critical
|
|
53
|
+
|
|
54
|
+
## Standalone Usage
|
|
55
|
+
|
|
56
|
+
The extraction utility can also be used programmatically:
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { extract, createExtractor } from '@minded-ai/mindedjs';
|
|
60
|
+
import { z } from 'zod';
|
|
61
|
+
|
|
62
|
+
// Direct extraction
|
|
63
|
+
const result = await extract(
|
|
64
|
+
content,
|
|
65
|
+
{
|
|
66
|
+
schema: z.object({
|
|
67
|
+
name: z.string(),
|
|
68
|
+
age: z.number(),
|
|
69
|
+
}),
|
|
70
|
+
systemPrompt: 'Extract person details',
|
|
71
|
+
},
|
|
72
|
+
agent.llm,
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
// Create reusable extractor
|
|
76
|
+
const extractor = createExtractor(schema, { systemPrompt: 'Extract data' });
|
|
77
|
+
const result = await extractor(content, agent.llm);
|
|
78
|
+
```
|