@valerypopoff/rivet2-core 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/README.md +15 -0
- package/dist/cjs/bundle.cjs +28772 -0
- package/dist/cjs/bundle.cjs.map +7 -0
- package/dist/esm/api/createProcessor.js +116 -0
- package/dist/esm/api/looseDataValue.js +16 -0
- package/dist/esm/api/processSettings.js +16 -0
- package/dist/esm/api/streaming.js +116 -0
- package/dist/esm/exports.js +48 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/integrations/AudioProvider.js +1 -0
- package/dist/esm/integrations/CodeRunner.js +44 -0
- package/dist/esm/integrations/DatasetProvider.js +92 -0
- package/dist/esm/integrations/EmbeddingGenerator.js +1 -0
- package/dist/esm/integrations/GptTokenizerTokenizer.js +67 -0
- package/dist/esm/integrations/LLMProvider.js +1 -0
- package/dist/esm/integrations/Tokenizer.js +1 -0
- package/dist/esm/integrations/VectorDatabase.js +1 -0
- package/dist/esm/integrations/enableIntegrations.js +3 -0
- package/dist/esm/integrations/integrations.js +19 -0
- package/dist/esm/integrations/mcp/MCPBase.js +87 -0
- package/dist/esm/integrations/mcp/MCPProvider.js +23 -0
- package/dist/esm/integrations/mcp/MCPUtils.js +33 -0
- package/dist/esm/integrations/openai/OpenAIEmbeddingGenerator.js +23 -0
- package/dist/esm/model/CycleDetector.js +43 -0
- package/dist/esm/model/DataValue.js +188 -0
- package/dist/esm/model/Dataset.js +1 -0
- package/dist/esm/model/EditorDefinition.js +1 -0
- package/dist/esm/model/ExecutorProtocol.js +1 -0
- package/dist/esm/model/GraphPreprocessor.js +97 -0
- package/dist/esm/model/GraphProcessor.js +1136 -0
- package/dist/esm/model/NodeBase.js +11 -0
- package/dist/esm/model/NodeBodySpec.js +1 -0
- package/dist/esm/model/NodeDefinition.js +12 -0
- package/dist/esm/model/NodeExecutionPlanner.js +82 -0
- package/dist/esm/model/NodeGraph.js +14 -0
- package/dist/esm/model/NodeImpl.js +57 -0
- package/dist/esm/model/NodeRegistration.js +146 -0
- package/dist/esm/model/Nodes.js +279 -0
- package/dist/esm/model/PluginLoadSpec.js +1 -0
- package/dist/esm/model/ProcessContext.js +1 -0
- package/dist/esm/model/ProcessContextBuilder.js +33 -0
- package/dist/esm/model/Project.js +2 -0
- package/dist/esm/model/ProjectReferenceLoader.js +1 -0
- package/dist/esm/model/RecordingPlayer.js +262 -0
- package/dist/esm/model/RegistryAssembly.js +53 -0
- package/dist/esm/model/RivetPlugin.js +1 -0
- package/dist/esm/model/RivetUIContext.js +1 -0
- package/dist/esm/model/Settings.js +1 -0
- package/dist/esm/model/SplitRunProcessor.js +98 -0
- package/dist/esm/model/SubprocessorBridge.js +82 -0
- package/dist/esm/model/chat/aiSdkMessages.js +105 -0
- package/dist/esm/model/chat/aiSdkStreaming.js +38 -0
- package/dist/esm/model/chat/aiSdkTools.js +10 -0
- package/dist/esm/model/chat/chatCost.js +33 -0
- package/dist/esm/model/chat/chatMessages.js +47 -0
- package/dist/esm/model/chat/openAIChatRequest.js +110 -0
- package/dist/esm/model/chat/openAIChatRuntime.js +220 -0
- package/dist/esm/model/chat/streamChatResponse.js +97 -0
- package/dist/esm/model/chat/tokenBudget.js +16 -0
- package/dist/esm/model/chat-v2/aiSdkBridge.js +88 -0
- package/dist/esm/model/chat-v2/chatV2EditorCache.js +107 -0
- package/dist/esm/model/chat-v2/chatV2Errors.js +255 -0
- package/dist/esm/model/chat-v2/chatV2FeatureCompatibility.js +16 -0
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +387 -0
- package/dist/esm/model/chat-v2/chatV2ResponseFormat.js +57 -0
- package/dist/esm/model/chat-v2/chatV2Retry.js +41 -0
- package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +242 -0
- package/dist/esm/model/chat-v2/chatV2Shared.js +285 -0
- package/dist/esm/model/chat-v2/chatV2Types.js +1 -0
- package/dist/esm/model/chat-v2/index.js +10 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeData.js +56 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +475 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeRuntime.js +90 -0
- package/dist/esm/model/chat-v2/messageConverter.js +173 -0
- package/dist/esm/model/chat-v2/modelRegistry.js +23 -0
- package/dist/esm/model/chat-v2/providerOptions.js +202 -0
- package/dist/esm/model/chat-v2/toolContinuation.js +108 -0
- package/dist/esm/model/chat-v2/toolConverter.js +4 -0
- package/dist/esm/model/interpolationInputDefinition.js +36 -0
- package/dist/esm/model/loopControllerBreak.js +4 -0
- package/dist/esm/model/nodes/AbortGraphNode.js +100 -0
- package/dist/esm/model/nodes/AppendToDatasetNode.js +115 -0
- package/dist/esm/model/nodes/ArrayNode.js +144 -0
- package/dist/esm/model/nodes/AssembleMessageNode.js +209 -0
- package/dist/esm/model/nodes/AssemblePromptNode.js +151 -0
- package/dist/esm/model/nodes/AudioNode.js +101 -0
- package/dist/esm/model/nodes/BooleanNode.js +74 -0
- package/dist/esm/model/nodes/CallGraphNode.js +135 -0
- package/dist/esm/model/nodes/ChatLoopNode.js +150 -0
- package/dist/esm/model/nodes/ChatNode.js +56 -0
- package/dist/esm/model/nodes/ChatNodeBase.js +912 -0
- package/dist/esm/model/nodes/ChunkNode.js +166 -0
- package/dist/esm/model/nodes/CoalesceNode.js +104 -0
- package/dist/esm/model/nodes/CodeNode.js +197 -0
- package/dist/esm/model/nodes/CommentNode.js +71 -0
- package/dist/esm/model/nodes/CompareNode.js +144 -0
- package/dist/esm/model/nodes/ContextNode.js +99 -0
- package/dist/esm/model/nodes/CreateDatasetNode.js +71 -0
- package/dist/esm/model/nodes/CronNode.js +248 -0
- package/dist/esm/model/nodes/DatasetNearestNeigborsNode.js +97 -0
- package/dist/esm/model/nodes/DelayNode.js +105 -0
- package/dist/esm/model/nodes/DelegateFunctionCallNode.js +175 -0
- package/dist/esm/model/nodes/DestructureNode.js +110 -0
- package/dist/esm/model/nodes/DocumentNode.js +183 -0
- package/dist/esm/model/nodes/EvaluateNode.js +141 -0
- package/dist/esm/model/nodes/ExpressionNode.js +143 -0
- package/dist/esm/model/nodes/ExternalCallNode.js +162 -0
- package/dist/esm/model/nodes/ExtractJsonNode.js +122 -0
- package/dist/esm/model/nodes/ExtractMarkdownCodeBlocksNode.js +100 -0
- package/dist/esm/model/nodes/ExtractObjectPathNode.js +159 -0
- package/dist/esm/model/nodes/ExtractRegexNode.js +200 -0
- package/dist/esm/model/nodes/ExtractYamlNode.js +214 -0
- package/dist/esm/model/nodes/FilterNode.js +73 -0
- package/dist/esm/model/nodes/GetAllDatasetsNode.js +53 -0
- package/dist/esm/model/nodes/GetDatasetRowNode.js +99 -0
- package/dist/esm/model/nodes/GetEmbeddingNode.js +130 -0
- package/dist/esm/model/nodes/GetGlobalNode.js +139 -0
- package/dist/esm/model/nodes/GraphInputNode.js +132 -0
- package/dist/esm/model/nodes/GraphOutputNode.js +104 -0
- package/dist/esm/model/nodes/GraphReferenceNode.js +128 -0
- package/dist/esm/model/nodes/HashNode.js +97 -0
- package/dist/esm/model/nodes/HttpCallNode.js +592 -0
- package/dist/esm/model/nodes/IfElseNode.js +138 -0
- package/dist/esm/model/nodes/IfNode.js +129 -0
- package/dist/esm/model/nodes/ImageNode.js +107 -0
- package/dist/esm/model/nodes/JSFilterNode.js +69 -0
- package/dist/esm/model/nodes/JSMapNode.js +69 -0
- package/dist/esm/model/nodes/JoinNode.js +135 -0
- package/dist/esm/model/nodes/LLMChatV2Node.js +234 -0
- package/dist/esm/model/nodes/ListGraphsNode.js +61 -0
- package/dist/esm/model/nodes/LoadDatasetNode.js +83 -0
- package/dist/esm/model/nodes/LoopControllerNode.js +206 -0
- package/dist/esm/model/nodes/LoopUntilNode.js +214 -0
- package/dist/esm/model/nodes/MCPDiscoveryNode.js +214 -0
- package/dist/esm/model/nodes/MCPGetPromptNode.js +234 -0
- package/dist/esm/model/nodes/MCPToolCallNode.js +262 -0
- package/dist/esm/model/nodes/MatchNode.js +160 -0
- package/dist/esm/model/nodes/NumberNode.js +86 -0
- package/dist/esm/model/nodes/ObjectNode.js +152 -0
- package/dist/esm/model/nodes/PassthroughNode.js +78 -0
- package/dist/esm/model/nodes/PlayAudioNode.js +61 -0
- package/dist/esm/model/nodes/PopNode.js +89 -0
- package/dist/esm/model/nodes/PromptNode.js +248 -0
- package/dist/esm/model/nodes/RaceInputsNode.js +85 -0
- package/dist/esm/model/nodes/RaiseEventNode.js +84 -0
- package/dist/esm/model/nodes/RandomNumberNode.js +117 -0
- package/dist/esm/model/nodes/ReadAllFilesNode.js +210 -0
- package/dist/esm/model/nodes/ReadDirectoryNode.js +171 -0
- package/dist/esm/model/nodes/ReadFileNode.js +114 -0
- package/dist/esm/model/nodes/ReferencedGraphAliasNode.js +199 -0
- package/dist/esm/model/nodes/ReplaceDatasetNode.js +118 -0
- package/dist/esm/model/nodes/SetGlobalNode.js +124 -0
- package/dist/esm/model/nodes/ShuffleNode.js +64 -0
- package/dist/esm/model/nodes/SliceNode.js +99 -0
- package/dist/esm/model/nodes/SplitNode.js +101 -0
- package/dist/esm/model/nodes/SubGraphNode.js +180 -0
- package/dist/esm/model/nodes/TextNode.js +125 -0
- package/dist/esm/model/nodes/ToJsonNode.js +78 -0
- package/dist/esm/model/nodes/ToMarkdownTableNode.js +119 -0
- package/dist/esm/model/nodes/ToTreeNode.js +133 -0
- package/dist/esm/model/nodes/ToYamlNode.js +68 -0
- package/dist/esm/model/nodes/ToolNode.js +172 -0
- package/dist/esm/model/nodes/TrimChatMessagesNode.js +120 -0
- package/dist/esm/model/nodes/URLReferenceNode.js +79 -0
- package/dist/esm/model/nodes/UserInputNode.js +109 -0
- package/dist/esm/model/nodes/VectorNearestNeighborsNode.js +127 -0
- package/dist/esm/model/nodes/VectorStoreNode.js +124 -0
- package/dist/esm/model/nodes/WaitForEventNode.js +88 -0
- package/dist/esm/model/nodes/codeNodeErrorDiagnostics.js +104 -0
- package/dist/esm/model/nodes/jsListCallbackHelpers.js +196 -0
- package/dist/esm/model/nodes/jsValueInterpolation.js +163 -0
- package/dist/esm/model/nodes/toolCallDelegation.js +159 -0
- package/dist/esm/native/BaseDir.js +32 -0
- package/dist/esm/native/BrowserNativeApi.js +19 -0
- package/dist/esm/native/NativeApi.js +1 -0
- package/dist/esm/plugins/anthropic/anthropic.js +208 -0
- package/dist/esm/plugins/anthropic/fetchEventSource.js +107 -0
- package/dist/esm/plugins/anthropic/index.js +2 -0
- package/dist/esm/plugins/anthropic/nodes/ChatAnthropicNode.js +767 -0
- package/dist/esm/plugins/anthropic/plugin.js +26 -0
- package/dist/esm/plugins/assemblyAi/LemurActionItemsNode.js +75 -0
- package/dist/esm/plugins/assemblyAi/LemurQaNode.js +155 -0
- package/dist/esm/plugins/assemblyAi/LemurSummaryNode.js +79 -0
- package/dist/esm/plugins/assemblyAi/LemurTaskNode.js +82 -0
- package/dist/esm/plugins/assemblyAi/TranscribeAudioNode.js +126 -0
- package/dist/esm/plugins/assemblyAi/index.js +2 -0
- package/dist/esm/plugins/assemblyAi/lemurHelpers.js +114 -0
- package/dist/esm/plugins/assemblyAi/plugin.js +32 -0
- package/dist/esm/plugins/autoevals/AutoEvalsNode.js +223 -0
- package/dist/esm/plugins/autoevals/index.js +2 -0
- package/dist/esm/plugins/autoevals/plugin.js +8 -0
- package/dist/esm/plugins/gentrace/index.js +3 -0
- package/dist/esm/plugins/gentrace/plugin.js +195 -0
- package/dist/esm/plugins/google/google.js +165 -0
- package/dist/esm/plugins/google/index.js +2 -0
- package/dist/esm/plugins/google/nodes/ChatGoogleNode.js +584 -0
- package/dist/esm/plugins/google/plugin.js +39 -0
- package/dist/esm/plugins/huggingface/index.js +2 -0
- package/dist/esm/plugins/huggingface/nodes/ChatHuggingFace.js +243 -0
- package/dist/esm/plugins/huggingface/nodes/TextToImageHuggingFace.js +189 -0
- package/dist/esm/plugins/huggingface/plugin.js +26 -0
- package/dist/esm/plugins/openai/handleOpenaiError.js +17 -0
- package/dist/esm/plugins/openai/index.js +2 -0
- package/dist/esm/plugins/openai/nodes/AttachAssistantFileNode.js +123 -0
- package/dist/esm/plugins/openai/nodes/CreateAssistantNode.js +289 -0
- package/dist/esm/plugins/openai/nodes/CreateThreadMessageNode.js +176 -0
- package/dist/esm/plugins/openai/nodes/CreateThreadNode.js +157 -0
- package/dist/esm/plugins/openai/nodes/DeleteAssistantNode.js +104 -0
- package/dist/esm/plugins/openai/nodes/DeleteThreadNode.js +97 -0
- package/dist/esm/plugins/openai/nodes/GetAssistantNode.js +118 -0
- package/dist/esm/plugins/openai/nodes/GetOpenAIFileNode.js +100 -0
- package/dist/esm/plugins/openai/nodes/GetThreadNode.js +108 -0
- package/dist/esm/plugins/openai/nodes/ListAssistantsNode.js +202 -0
- package/dist/esm/plugins/openai/nodes/ListOpenAIFilesNode.js +94 -0
- package/dist/esm/plugins/openai/nodes/ListThreadMessagesNode.js +224 -0
- package/dist/esm/plugins/openai/nodes/RunThreadNode.js +630 -0
- package/dist/esm/plugins/openai/nodes/ThreadMessageNode.js +143 -0
- package/dist/esm/plugins/openai/nodes/UploadFileNode.js +121 -0
- package/dist/esm/plugins/openai/plugin.js +44 -0
- package/dist/esm/plugins/pinecone/PineconeVectorDatabase.js +88 -0
- package/dist/esm/plugins/pinecone/index.js +2 -0
- package/dist/esm/plugins/pinecone/plugin.js +19 -0
- package/dist/esm/plugins.js +29 -0
- package/dist/esm/recording/ExecutionRecorder.js +273 -0
- package/dist/esm/recording/RecordedEvents.js +1 -0
- package/dist/esm/utils/assertNever.js +3 -0
- package/dist/esm/utils/base64.js +38 -0
- package/dist/esm/utils/chatMessageToOpenAIChatCompletionMessage.js +73 -0
- package/dist/esm/utils/coerceType.js +326 -0
- package/dist/esm/utils/compatibility.js +27 -0
- package/dist/esm/utils/copyToClipboard.js +10 -0
- package/dist/esm/utils/defaults.js +2 -0
- package/dist/esm/utils/emitDetached.js +12 -0
- package/dist/esm/utils/errors.js +7 -0
- package/dist/esm/utils/expectType.js +34 -0
- package/dist/esm/utils/fetchEventSource.js +120 -0
- package/dist/esm/utils/genericUtilFunctions.js +25 -0
- package/dist/esm/utils/getPluginConfig.js +23 -0
- package/dist/esm/utils/handleEscapeCharacters.js +11 -0
- package/dist/esm/utils/index.js +17 -0
- package/dist/esm/utils/inputs.js +16 -0
- package/dist/esm/utils/interpolation.js +286 -0
- package/dist/esm/utils/misc.js +1 -0
- package/dist/esm/utils/newId.js +4 -0
- package/dist/esm/utils/openai.js +206 -0
- package/dist/esm/utils/orderedStringPortIds.js +27 -0
- package/dist/esm/utils/outputs.js +14 -0
- package/dist/esm/utils/pQueueCompat.js +12 -0
- package/dist/esm/utils/paths.js +80 -0
- package/dist/esm/utils/providerStreamParsing.js +14 -0
- package/dist/esm/utils/runtimeLogging.js +121 -0
- package/dist/esm/utils/serialization/serialization.js +77 -0
- package/dist/esm/utils/serialization/serializationHelpers.js +63 -0
- package/dist/esm/utils/serialization/serializationUtils.js +112 -0
- package/dist/esm/utils/serialization/serialization_v1.js +19 -0
- package/dist/esm/utils/serialization/serialization_v2.js +24 -0
- package/dist/esm/utils/serialization/serialization_v3.js +100 -0
- package/dist/esm/utils/serialization/serialization_v4.js +156 -0
- package/dist/esm/utils/symbols.js +2 -0
- package/dist/esm/utils/time.js +14 -0
- package/dist/esm/utils/typeSafety.js +42 -0
- package/dist/esm/vendor/fnv1a.js +80 -0
- package/dist/types/api/createProcessor.d.ts +56 -0
- package/dist/types/api/looseDataValue.d.ts +4 -0
- package/dist/types/api/processSettings.d.ts +4 -0
- package/dist/types/api/streaming.d.ts +56 -0
- package/dist/types/exports.d.ts +49 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/integrations/AudioProvider.d.ts +4 -0
- package/dist/types/integrations/CodeRunner.d.ts +19 -0
- package/dist/types/integrations/DatasetProvider.d.ts +33 -0
- package/dist/types/integrations/EmbeddingGenerator.d.ts +3 -0
- package/dist/types/integrations/GptTokenizerTokenizer.d.ts +20 -0
- package/dist/types/integrations/LLMProvider.d.ts +7 -0
- package/dist/types/integrations/Tokenizer.d.ts +11 -0
- package/dist/types/integrations/VectorDatabase.d.ts +7 -0
- package/dist/types/integrations/enableIntegrations.d.ts +1 -0
- package/dist/types/integrations/integrations.d.ts +12 -0
- package/dist/types/integrations/mcp/MCPBase.d.ts +18 -0
- package/dist/types/integrations/mcp/MCPProvider.d.ts +153 -0
- package/dist/types/integrations/mcp/MCPUtils.d.ts +9 -0
- package/dist/types/integrations/openai/OpenAIEmbeddingGenerator.d.ts +10 -0
- package/dist/types/model/CycleDetector.d.ts +2 -0
- package/dist/types/model/DataValue.d.ts +160 -0
- package/dist/types/model/Dataset.d.ts +19 -0
- package/dist/types/model/EditorDefinition.d.ts +176 -0
- package/dist/types/model/ExecutorProtocol.d.ts +216 -0
- package/dist/types/model/GraphPreprocessor.d.ts +24 -0
- package/dist/types/model/GraphProcessor.d.ts +210 -0
- package/dist/types/model/NodeBase.d.ts +116 -0
- package/dist/types/model/NodeBodySpec.d.ts +19 -0
- package/dist/types/model/NodeDefinition.d.ts +13 -0
- package/dist/types/model/NodeExecutionPlanner.d.ts +28 -0
- package/dist/types/model/NodeGraph.d.ts +15 -0
- package/dist/types/model/NodeImpl.d.ts +56 -0
- package/dist/types/model/NodeRegistration.d.ts +29 -0
- package/dist/types/model/Nodes.d.ts +112 -0
- package/dist/types/model/PluginLoadSpec.d.ts +17 -0
- package/dist/types/model/ProcessContext.d.ts +110 -0
- package/dist/types/model/ProcessContextBuilder.d.ts +41 -0
- package/dist/types/model/Project.d.ts +31 -0
- package/dist/types/model/ProjectReferenceLoader.d.ts +5 -0
- package/dist/types/model/RecordingPlayer.d.ts +27 -0
- package/dist/types/model/RegistryAssembly.d.ts +42 -0
- package/dist/types/model/RivetPlugin.d.ts +51 -0
- package/dist/types/model/RivetUIContext.d.ts +27 -0
- package/dist/types/model/Settings.d.ts +20 -0
- package/dist/types/model/SplitRunProcessor.d.ts +31 -0
- package/dist/types/model/SubprocessorBridge.d.ts +13 -0
- package/dist/types/model/chat/aiSdkMessages.d.ts +3 -0
- package/dist/types/model/chat/aiSdkStreaming.d.ts +9 -0
- package/dist/types/model/chat/aiSdkTools.d.ts +3 -0
- package/dist/types/model/chat/chatCost.d.ts +30 -0
- package/dist/types/model/chat/chatMessages.d.ts +5 -0
- package/dist/types/model/chat/openAIChatRequest.d.ts +39 -0
- package/dist/types/model/chat/openAIChatRuntime.d.ts +61 -0
- package/dist/types/model/chat/streamChatResponse.d.ts +27 -0
- package/dist/types/model/chat/tokenBudget.d.ts +3 -0
- package/dist/types/model/chat-v2/aiSdkBridge.d.ts +2 -0
- package/dist/types/model/chat-v2/chatV2EditorCache.d.ts +25 -0
- package/dist/types/model/chat-v2/chatV2Errors.d.ts +23 -0
- package/dist/types/model/chat-v2/chatV2FeatureCompatibility.d.ts +12 -0
- package/dist/types/model/chat-v2/chatV2Pipeline.d.ts +2 -0
- package/dist/types/model/chat-v2/chatV2ResponseFormat.d.ts +24 -0
- package/dist/types/model/chat-v2/chatV2Retry.d.ts +5 -0
- package/dist/types/model/chat-v2/chatV2RuntimeOptions.d.ts +12 -0
- package/dist/types/model/chat-v2/chatV2Shared.d.ts +56 -0
- package/dist/types/model/chat-v2/chatV2Types.d.ts +110 -0
- package/dist/types/model/chat-v2/index.d.ts +10 -0
- package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +73 -0
- package/dist/types/model/chat-v2/llmChatV2NodeEditors.d.ts +4 -0
- package/dist/types/model/chat-v2/llmChatV2NodeRuntime.d.ts +23 -0
- package/dist/types/model/chat-v2/messageConverter.d.ts +8 -0
- package/dist/types/model/chat-v2/modelRegistry.d.ts +296 -0
- package/dist/types/model/chat-v2/providerOptions.d.ts +59 -0
- package/dist/types/model/chat-v2/toolContinuation.d.ts +15 -0
- package/dist/types/model/chat-v2/toolConverter.d.ts +3 -0
- package/dist/types/model/interpolationInputDefinition.d.ts +16 -0
- package/dist/types/model/loopControllerBreak.d.ts +3 -0
- package/dist/types/model/nodes/AbortGraphNode.d.ts +22 -0
- package/dist/types/model/nodes/AppendToDatasetNode.d.ts +21 -0
- package/dist/types/model/nodes/ArrayNode.d.ts +20 -0
- package/dist/types/model/nodes/AssembleMessageNode.d.ts +23 -0
- package/dist/types/model/nodes/AssemblePromptNode.d.ts +23 -0
- package/dist/types/model/nodes/AudioNode.d.ts +20 -0
- package/dist/types/model/nodes/BooleanNode.d.ts +19 -0
- package/dist/types/model/nodes/CallGraphNode.d.ts +16 -0
- package/dist/types/model/nodes/ChatLoopNode.d.ts +21 -0
- package/dist/types/model/nodes/ChatNode.d.ts +17 -0
- package/dist/types/model/nodes/ChatNodeBase.d.ts +85 -0
- package/dist/types/model/nodes/ChunkNode.d.ts +22 -0
- package/dist/types/model/nodes/CoalesceNode.d.ts +14 -0
- package/dist/types/model/nodes/CodeNode.d.ts +27 -0
- package/dist/types/model/nodes/CommentNode.d.ts +20 -0
- package/dist/types/model/nodes/CompareNode.d.ts +19 -0
- package/dist/types/model/nodes/ContextNode.d.ts +24 -0
- package/dist/types/model/nodes/CreateDatasetNode.d.ts +13 -0
- package/dist/types/model/nodes/CronNode.d.ts +34 -0
- package/dist/types/model/nodes/DatasetNearestNeigborsNode.d.ts +19 -0
- package/dist/types/model/nodes/DelayNode.d.ts +20 -0
- package/dist/types/model/nodes/DelegateFunctionCallNode.d.ts +28 -0
- package/dist/types/model/nodes/DestructureNode.d.ts +19 -0
- package/dist/types/model/nodes/DocumentNode.d.ts +28 -0
- package/dist/types/model/nodes/EvaluateNode.d.ts +19 -0
- package/dist/types/model/nodes/ExpressionNode.d.ts +21 -0
- package/dist/types/model/nodes/ExternalCallNode.d.ts +22 -0
- package/dist/types/model/nodes/ExtractJsonNode.d.ts +13 -0
- package/dist/types/model/nodes/ExtractMarkdownCodeBlocksNode.d.ts +12 -0
- package/dist/types/model/nodes/ExtractObjectPathNode.d.ts +22 -0
- package/dist/types/model/nodes/ExtractRegexNode.d.ts +22 -0
- package/dist/types/model/nodes/ExtractYamlNode.d.ts +21 -0
- package/dist/types/model/nodes/FilterNode.d.ts +13 -0
- package/dist/types/model/nodes/GetAllDatasetsNode.d.ts +14 -0
- package/dist/types/model/nodes/GetDatasetRowNode.d.ts +19 -0
- package/dist/types/model/nodes/GetEmbeddingNode.d.ts +24 -0
- package/dist/types/model/nodes/GetGlobalNode.d.ts +29 -0
- package/dist/types/model/nodes/GraphInputNode.d.ts +24 -0
- package/dist/types/model/nodes/GraphOutputNode.d.ts +22 -0
- package/dist/types/model/nodes/GraphReferenceNode.d.ts +22 -0
- package/dist/types/model/nodes/HashNode.d.ts +17 -0
- package/dist/types/model/nodes/HttpCallNode.d.ts +32 -0
- package/dist/types/model/nodes/IfElseNode.d.ts +18 -0
- package/dist/types/model/nodes/IfNode.d.ts +17 -0
- package/dist/types/model/nodes/ImageNode.d.ts +20 -0
- package/dist/types/model/nodes/JSFilterNode.d.ts +19 -0
- package/dist/types/model/nodes/JSMapNode.d.ts +19 -0
- package/dist/types/model/nodes/JoinNode.d.ts +21 -0
- package/dist/types/model/nodes/LLMChatV2Node.d.ts +20 -0
- package/dist/types/model/nodes/ListGraphsNode.d.ts +14 -0
- package/dist/types/model/nodes/LoadDatasetNode.d.ts +17 -0
- package/dist/types/model/nodes/LoopControllerNode.d.ts +20 -0
- package/dist/types/model/nodes/LoopUntilNode.d.ts +32 -0
- package/dist/types/model/nodes/MCPDiscoveryNode.d.ts +9 -0
- package/dist/types/model/nodes/MCPGetPromptNode.d.ts +23 -0
- package/dist/types/model/nodes/MCPToolCallNode.d.ts +26 -0
- package/dist/types/model/nodes/MatchNode.d.ts +20 -0
- package/dist/types/model/nodes/NumberNode.d.ts +21 -0
- package/dist/types/model/nodes/ObjectNode.d.ts +19 -0
- package/dist/types/model/nodes/PassthroughNode.d.ts +14 -0
- package/dist/types/model/nodes/PlayAudioNode.d.ts +15 -0
- package/dist/types/model/nodes/PopNode.d.ts +19 -0
- package/dist/types/model/nodes/PromptNode.d.ts +25 -0
- package/dist/types/model/nodes/RaceInputsNode.d.ts +16 -0
- package/dist/types/model/nodes/RaiseEventNode.d.ts +22 -0
- package/dist/types/model/nodes/RandomNumberNode.d.ts +23 -0
- package/dist/types/model/nodes/ReadAllFilesNode.d.ts +30 -0
- package/dist/types/model/nodes/ReadDirectoryNode.d.ts +30 -0
- package/dist/types/model/nodes/ReadFileNode.d.ts +23 -0
- package/dist/types/model/nodes/ReferencedGraphAliasNode.d.ts +31 -0
- package/dist/types/model/nodes/ReplaceDatasetNode.d.ts +21 -0
- package/dist/types/model/nodes/SetGlobalNode.d.ts +23 -0
- package/dist/types/model/nodes/ShuffleNode.d.ts +12 -0
- package/dist/types/model/nodes/SliceNode.d.ts +22 -0
- package/dist/types/model/nodes/SplitNode.d.ts +19 -0
- package/dist/types/model/nodes/SubGraphNode.d.ts +29 -0
- package/dist/types/model/nodes/TextNode.d.ts +19 -0
- package/dist/types/model/nodes/ToJsonNode.d.ts +18 -0
- package/dist/types/model/nodes/ToMarkdownTableNode.d.ts +19 -0
- package/dist/types/model/nodes/ToTreeNode.d.ts +21 -0
- package/dist/types/model/nodes/ToYamlNode.d.ts +13 -0
- package/dist/types/model/nodes/ToolNode.d.ts +25 -0
- package/dist/types/model/nodes/TrimChatMessagesNode.d.ts +20 -0
- package/dist/types/model/nodes/URLReferenceNode.d.ts +19 -0
- package/dist/types/model/nodes/UserInputNode.d.ts +20 -0
- package/dist/types/model/nodes/VectorNearestNeighborsNode.d.ts +24 -0
- package/dist/types/model/nodes/VectorStoreNode.d.ts +22 -0
- package/dist/types/model/nodes/WaitForEventNode.d.ts +21 -0
- package/dist/types/model/nodes/codeNodeErrorDiagnostics.d.ts +9 -0
- package/dist/types/model/nodes/jsListCallbackHelpers.d.ts +23 -0
- package/dist/types/model/nodes/jsValueInterpolation.d.ts +11 -0
- package/dist/types/model/nodes/toolCallDelegation.d.ts +29 -0
- package/dist/types/native/BaseDir.d.ts +29 -0
- package/dist/types/native/BrowserNativeApi.d.ts +9 -0
- package/dist/types/native/NativeApi.d.ts +17 -0
- package/dist/types/plugins/anthropic/anthropic.d.ts +315 -0
- package/dist/types/plugins/anthropic/fetchEventSource.d.ts +11 -0
- package/dist/types/plugins/anthropic/index.d.ts +2 -0
- package/dist/types/plugins/anthropic/nodes/ChatAnthropicNode.d.ts +40 -0
- package/dist/types/plugins/anthropic/plugin.d.ts +2 -0
- package/dist/types/plugins/assemblyAi/LemurActionItemsNode.d.ts +6 -0
- package/dist/types/plugins/assemblyAi/LemurQaNode.d.ts +22 -0
- package/dist/types/plugins/assemblyAi/LemurSummaryNode.d.ts +8 -0
- package/dist/types/plugins/assemblyAi/LemurTaskNode.d.ts +8 -0
- package/dist/types/plugins/assemblyAi/TranscribeAudioNode.d.ts +7 -0
- package/dist/types/plugins/assemblyAi/index.d.ts +2 -0
- package/dist/types/plugins/assemblyAi/lemurHelpers.d.ts +67 -0
- package/dist/types/plugins/assemblyAi/plugin.d.ts +2 -0
- package/dist/types/plugins/autoevals/AutoEvalsNode.d.ts +8 -0
- package/dist/types/plugins/autoevals/index.d.ts +2 -0
- package/dist/types/plugins/autoevals/plugin.d.ts +2 -0
- package/dist/types/plugins/gentrace/index.d.ts +2 -0
- package/dist/types/plugins/gentrace/plugin.d.ts +10 -0
- package/dist/types/plugins/google/google.d.ts +129 -0
- package/dist/types/plugins/google/index.d.ts +2 -0
- package/dist/types/plugins/google/nodes/ChatGoogleNode.d.ts +35 -0
- package/dist/types/plugins/google/plugin.d.ts +2 -0
- package/dist/types/plugins/huggingface/index.d.ts +2 -0
- package/dist/types/plugins/huggingface/nodes/ChatHuggingFace.d.ts +24 -0
- package/dist/types/plugins/huggingface/nodes/TextToImageHuggingFace.d.ts +20 -0
- package/dist/types/plugins/huggingface/plugin.d.ts +2 -0
- package/dist/types/plugins/openai/handleOpenaiError.d.ts +1 -0
- package/dist/types/plugins/openai/index.d.ts +2 -0
- package/dist/types/plugins/openai/nodes/AttachAssistantFileNode.d.ts +10 -0
- package/dist/types/plugins/openai/nodes/CreateAssistantNode.d.ts +26 -0
- package/dist/types/plugins/openai/nodes/CreateThreadMessageNode.d.ts +15 -0
- package/dist/types/plugins/openai/nodes/CreateThreadNode.d.ts +13 -0
- package/dist/types/plugins/openai/nodes/DeleteAssistantNode.d.ts +8 -0
- package/dist/types/plugins/openai/nodes/DeleteThreadNode.d.ts +8 -0
- package/dist/types/plugins/openai/nodes/GetAssistantNode.d.ts +8 -0
- package/dist/types/plugins/openai/nodes/GetOpenAIFileNode.d.ts +8 -0
- package/dist/types/plugins/openai/nodes/GetThreadNode.d.ts +8 -0
- package/dist/types/plugins/openai/nodes/ListAssistantsNode.d.ts +14 -0
- package/dist/types/plugins/openai/nodes/ListOpenAIFilesNode.d.ts +8 -0
- package/dist/types/plugins/openai/nodes/ListThreadMessagesNode.d.ts +16 -0
- package/dist/types/plugins/openai/nodes/RunThreadNode.d.ts +28 -0
- package/dist/types/plugins/openai/nodes/ThreadMessageNode.d.ts +14 -0
- package/dist/types/plugins/openai/nodes/UploadFileNode.d.ts +7 -0
- package/dist/types/plugins/openai/plugin.d.ts +2 -0
- package/dist/types/plugins/pinecone/PineconeVectorDatabase.d.ts +9 -0
- package/dist/types/plugins/pinecone/index.d.ts +2 -0
- package/dist/types/plugins/pinecone/plugin.d.ts +2 -0
- package/dist/types/plugins.d.ts +22 -0
- package/dist/types/recording/ExecutionRecorder.d.ts +27 -0
- package/dist/types/recording/RecordedEvents.d.ts +114 -0
- package/dist/types/utils/assertNever.d.ts +1 -0
- package/dist/types/utils/base64.d.ts +3 -0
- package/dist/types/utils/chatMessageToOpenAIChatCompletionMessage.d.ts +5 -0
- package/dist/types/utils/coerceType.d.ts +6 -0
- package/dist/types/utils/compatibility.d.ts +3 -0
- package/dist/types/utils/copyToClipboard.d.ts +1 -0
- package/dist/types/utils/defaults.d.ts +2 -0
- package/dist/types/utils/emitDetached.d.ts +11 -0
- package/dist/types/utils/errors.d.ts +2 -0
- package/dist/types/utils/expectType.d.ts +3 -0
- package/dist/types/utils/fetchEventSource.d.ts +12 -0
- package/dist/types/utils/genericUtilFunctions.d.ts +21 -0
- package/dist/types/utils/getPluginConfig.d.ts +2 -0
- package/dist/types/utils/handleEscapeCharacters.d.ts +2 -0
- package/dist/types/utils/index.d.ts +17 -0
- package/dist/types/utils/inputs.d.ts +3 -0
- package/dist/types/utils/interpolation.d.ts +26 -0
- package/dist/types/utils/misc.d.ts +1 -0
- package/dist/types/utils/newId.d.ts +1 -0
- package/dist/types/utils/openai.d.ts +784 -0
- package/dist/types/utils/orderedStringPortIds.d.ts +10 -0
- package/dist/types/utils/outputs.d.ts +3 -0
- package/dist/types/utils/pQueueCompat.d.ts +10 -0
- package/dist/types/utils/paths.d.ts +8 -0
- package/dist/types/utils/providerStreamParsing.d.ts +1 -0
- package/dist/types/utils/runtimeLogging.d.ts +10 -0
- package/dist/types/utils/serialization/serialization.d.ts +12 -0
- package/dist/types/utils/serialization/serializationHelpers.d.ts +27 -0
- package/dist/types/utils/serialization/serializationUtils.d.ts +16 -0
- package/dist/types/utils/serialization/serialization_v1.d.ts +3 -0
- package/dist/types/utils/serialization/serialization_v2.d.ts +3 -0
- package/dist/types/utils/serialization/serialization_v3.d.ts +19 -0
- package/dist/types/utils/serialization/serialization_v4.d.ts +9 -0
- package/dist/types/utils/symbols.d.ts +3 -0
- package/dist/types/utils/time.d.ts +22 -0
- package/dist/types/utils/typeSafety.d.ts +37 -0
- package/dist/types/vendor/fnv1a.d.ts +9 -0
- package/package.json +77 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { nanoid } from 'nanoid/non-secure';
|
|
2
|
+
import { dedent } from 'ts-dedent';
|
|
3
|
+
import { nodeDefinition } from '../NodeDefinition.js';
|
|
4
|
+
import { NodeImpl } from '../NodeImpl.js';
|
|
5
|
+
import { getCommonChatV2Inputs, getCommonChatV2Outputs } from '../chat-v2/chatV2Shared.js';
|
|
6
|
+
import { getLLMChatV2Editors } from '../chat-v2/llmChatV2NodeEditors.js';
|
|
7
|
+
import { createLLMChatV2NodeData, hasLLMChatV2BuiltInToolsEnabled, } from '../chat-v2/llmChatV2NodeData.js';
|
|
8
|
+
import { getChatV2ModelInfo } from '../chat-v2/modelRegistry.js';
|
|
9
|
+
import { buildLLMChatV2EditorCacheKey, cloneLLMChatV2EditorCacheOutputs, resolveLLMChatV2RuntimeConfig, resolveLLMChatV2RuntimeProviderOptions, } from '../chat-v2/llmChatV2NodeRuntime.js';
|
|
10
|
+
import { anthropicEffortOptions, getChatV2ProviderLabel, googleThinkingLevelOptions, openAIReasoningEffortOptions, } from '../chat-v2/providerOptions.js';
|
|
11
|
+
import { runChatV2Pipeline } from '../chat-v2/chatV2Pipeline.js';
|
|
12
|
+
import { runChatV2PipelineWithToolContinuation } from '../chat-v2/toolContinuation.js';
|
|
13
|
+
import { delegateToolCall } from './toolCallDelegation.js';
|
|
14
|
+
export { buildLLMChatV2EditorCacheKey, resolveLLMChatV2RuntimeProviderOptions };
|
|
15
|
+
function usesBaseURLInput(data) {
|
|
16
|
+
return data.provider === 'custom' ? data.useCustomProviderBaseURLInput : data.useBaseURLInput;
|
|
17
|
+
}
|
|
18
|
+
function getCustomProviderBaseURLBodyLine(data) {
|
|
19
|
+
if (data.provider !== 'custom') {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
if (data.useCustomProviderBaseURLInput) {
|
|
23
|
+
return 'Provider base URL: (Using Input)';
|
|
24
|
+
}
|
|
25
|
+
const baseURL = data.customProviderBaseURL.trim();
|
|
26
|
+
return baseURL ? `Provider base URL: ${baseURL}` : undefined;
|
|
27
|
+
}
|
|
28
|
+
function getOptionLabel(options, value) {
|
|
29
|
+
return options.find((option) => option.value === (value ?? ''))?.label ?? value ?? 'Default';
|
|
30
|
+
}
|
|
31
|
+
function getReasoningEffortBodyLine(data) {
|
|
32
|
+
switch (data.provider) {
|
|
33
|
+
case 'openai':
|
|
34
|
+
return `Reasoning effort: ${getOptionLabel(openAIReasoningEffortOptions, data.openAIReasoningEffort)}`;
|
|
35
|
+
case 'anthropic':
|
|
36
|
+
return `Reasoning effort: ${getOptionLabel(anthropicEffortOptions, data.anthropicEffort)}`;
|
|
37
|
+
case 'google':
|
|
38
|
+
return `Reasoning effort: ${getOptionLabel(googleThinkingLevelOptions, data.googleThinkingLevel)}`;
|
|
39
|
+
case 'custom':
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export class LLMChatV2NodeImpl extends NodeImpl {
|
|
44
|
+
static create() {
|
|
45
|
+
return {
|
|
46
|
+
type: 'llmChatV2',
|
|
47
|
+
title: 'LLM Chat',
|
|
48
|
+
id: nanoid(),
|
|
49
|
+
visualData: {
|
|
50
|
+
x: 0,
|
|
51
|
+
y: 0,
|
|
52
|
+
width: 260,
|
|
53
|
+
},
|
|
54
|
+
data: createLLMChatV2NodeData(),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
getInputDefinitions() {
|
|
58
|
+
const inputs = getCommonChatV2Inputs(this.data, {
|
|
59
|
+
includeFunctions: this.data.useToolCalling,
|
|
60
|
+
});
|
|
61
|
+
if (this.data.apiKeySource === 'input') {
|
|
62
|
+
inputs.push({
|
|
63
|
+
id: 'apiKey',
|
|
64
|
+
title: 'API Key',
|
|
65
|
+
dataType: 'string',
|
|
66
|
+
required: false,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
if (usesBaseURLInput(this.data)) {
|
|
70
|
+
inputs.unshift({
|
|
71
|
+
id: (this.data.provider === 'custom' ? 'customProviderBaseURL' : 'baseURL'),
|
|
72
|
+
title: this.data.provider === 'custom' ? 'Provider base URL' : 'Base URL',
|
|
73
|
+
dataType: 'string',
|
|
74
|
+
required: false,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (this.data.useHeadersInput) {
|
|
78
|
+
inputs.push({
|
|
79
|
+
id: 'headers',
|
|
80
|
+
title: 'Headers',
|
|
81
|
+
dataType: 'object',
|
|
82
|
+
required: false,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (this.data.useExtraProviderOptionsInput) {
|
|
86
|
+
inputs.push({
|
|
87
|
+
id: 'extraProviderOptions',
|
|
88
|
+
title: 'Extra Provider Options',
|
|
89
|
+
dataType: ['string', 'object'],
|
|
90
|
+
required: false,
|
|
91
|
+
coerced: true,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if (this.data.provider === 'openai' && this.data.useOpenAIPreviousResponseIdInput) {
|
|
95
|
+
inputs.push({
|
|
96
|
+
id: 'previousResponseId',
|
|
97
|
+
title: 'Previous Response ID',
|
|
98
|
+
dataType: 'string',
|
|
99
|
+
required: false,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
if (this.data.provider === 'anthropic' && this.data.useAnthropicThinkingBudgetInput) {
|
|
103
|
+
inputs.push({
|
|
104
|
+
id: 'anthropicThinkingBudget',
|
|
105
|
+
title: 'Thinking Budget',
|
|
106
|
+
dataType: 'number',
|
|
107
|
+
required: false,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
if (this.data.provider === 'google' && this.data.useGoogleThinkingBudgetInput) {
|
|
111
|
+
inputs.push({
|
|
112
|
+
id: 'googleThinkingBudget',
|
|
113
|
+
title: 'Thinking Budget',
|
|
114
|
+
dataType: 'number',
|
|
115
|
+
required: false,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
if (this.data.responseFormat === 'json_schema') {
|
|
119
|
+
inputs.push({
|
|
120
|
+
id: 'responseSchema',
|
|
121
|
+
title: 'Response Schema',
|
|
122
|
+
dataType: ['object', 'gpt-function'],
|
|
123
|
+
required: true,
|
|
124
|
+
coerced: true,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
if ((this.data.responseFormat === 'json' || this.data.responseFormat === 'json_schema') &&
|
|
128
|
+
this.data.useResponseSchemaNameInput) {
|
|
129
|
+
inputs.push({
|
|
130
|
+
id: 'responseSchemaName',
|
|
131
|
+
title: 'Schema Name',
|
|
132
|
+
dataType: 'string',
|
|
133
|
+
required: false,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
if ((this.data.responseFormat === 'json' || this.data.responseFormat === 'json_schema') &&
|
|
137
|
+
this.data.useResponseSchemaDescriptionInput) {
|
|
138
|
+
inputs.push({
|
|
139
|
+
id: 'responseSchemaDescription',
|
|
140
|
+
title: 'Schema Description',
|
|
141
|
+
dataType: 'string',
|
|
142
|
+
required: false,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
return inputs;
|
|
146
|
+
}
|
|
147
|
+
getOutputDefinitions() {
|
|
148
|
+
const outputs = getCommonChatV2Outputs(this.data, {
|
|
149
|
+
includeFunctionCalls: this.data.useToolCalling || hasLLMChatV2BuiltInToolsEnabled(this.data),
|
|
150
|
+
includeUsage: this.data.outputUsage,
|
|
151
|
+
includeReasoning: this.data.outputReasoning,
|
|
152
|
+
});
|
|
153
|
+
if (this.data.outputRequestStatus) {
|
|
154
|
+
outputs.push({
|
|
155
|
+
id: 'requestStatus',
|
|
156
|
+
title: 'Response Status',
|
|
157
|
+
dataType: this.data.retryOnNon200 ? 'number[]' : 'number',
|
|
158
|
+
}, {
|
|
159
|
+
id: 'requestError',
|
|
160
|
+
title: 'Response Error',
|
|
161
|
+
dataType: this.data.retryOnNon200 ? 'string[]' : 'string',
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
return outputs;
|
|
165
|
+
}
|
|
166
|
+
static getUIData() {
|
|
167
|
+
return {
|
|
168
|
+
infoBoxBody: dedent `
|
|
169
|
+
Vendor-agnostic chat node built on the Vercel AI SDK.
|
|
170
|
+
|
|
171
|
+
Choose OpenAI, Anthropic, Google, or a custom OpenAI-compatible provider inside the node without rewiring the graph.
|
|
172
|
+
Common behavior stays shared; provider-specific settings only appear in advanced sections when relevant.
|
|
173
|
+
`,
|
|
174
|
+
contextMenuTitle: 'LLM Chat',
|
|
175
|
+
infoBoxTitle: 'LLM Chat Node',
|
|
176
|
+
group: ['Common', 'AI'],
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
async getEditors(context) {
|
|
180
|
+
return getLLMChatV2Editors(this.data, context);
|
|
181
|
+
}
|
|
182
|
+
getBody() {
|
|
183
|
+
const modelInfo = getChatV2ModelInfo(this.data.provider, this.data.model);
|
|
184
|
+
const providerLabel = getChatV2ProviderLabel(this.data.provider);
|
|
185
|
+
const baseURLLine = getCustomProviderBaseURLBodyLine(this.data);
|
|
186
|
+
const modelLine = modelInfo?.displayName ?? this.data.model;
|
|
187
|
+
const providerDetails = baseURLLine ? [providerLabel, baseURLLine, modelLine] : [providerLabel, modelLine];
|
|
188
|
+
const reasoningEffortLine = getReasoningEffortBodyLine(this.data);
|
|
189
|
+
return [
|
|
190
|
+
...providerDetails,
|
|
191
|
+
...(reasoningEffortLine ? [reasoningEffortLine] : []),
|
|
192
|
+
`Temperature: ${this.data.useTemperatureInput ? '(Using Input)' : this.data.temperature}`,
|
|
193
|
+
`Max output tokens: ${this.data.useMaxTokensInput ? '(Using Input)' : this.data.maxTokens}`,
|
|
194
|
+
].join('\n');
|
|
195
|
+
}
|
|
196
|
+
async process(inputs, context) {
|
|
197
|
+
const runtime = await resolveLLMChatV2RuntimeConfig({
|
|
198
|
+
data: this.data,
|
|
199
|
+
nodeId: this.chartNode.id,
|
|
200
|
+
inputs,
|
|
201
|
+
context,
|
|
202
|
+
});
|
|
203
|
+
if (runtime.cachedOutputs != null) {
|
|
204
|
+
return runtime.cachedOutputs;
|
|
205
|
+
}
|
|
206
|
+
const result = runtime.shouldAutoContinueToolCalls
|
|
207
|
+
? await runChatV2PipelineWithToolContinuation({
|
|
208
|
+
...runtime.runOptions,
|
|
209
|
+
autoContinue: true,
|
|
210
|
+
maxToolRounds: runtime.maxToolRounds,
|
|
211
|
+
functions: runtime.functions,
|
|
212
|
+
delegateToolCall: async (toolCall) => {
|
|
213
|
+
const delegated = await delegateToolCall(toolCall, context, {
|
|
214
|
+
handlers: [],
|
|
215
|
+
unknownHandler: undefined,
|
|
216
|
+
autoDelegate: true,
|
|
217
|
+
fallBackToExternalCall: true,
|
|
218
|
+
passthroughErrors: true,
|
|
219
|
+
});
|
|
220
|
+
return {
|
|
221
|
+
type: 'chat-message',
|
|
222
|
+
value: delegated.message,
|
|
223
|
+
delegatedToolCall: delegated.record,
|
|
224
|
+
};
|
|
225
|
+
},
|
|
226
|
+
})
|
|
227
|
+
: await runChatV2Pipeline(runtime.runOptions);
|
|
228
|
+
if (runtime.cacheKey != null && runtime.editorCache != null) {
|
|
229
|
+
runtime.editorCache.set(runtime.cacheKey, cloneLLMChatV2EditorCacheOutputs(result.commonOutputs));
|
|
230
|
+
}
|
|
231
|
+
return result.commonOutputs;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
export const llmChatV2Node = nodeDefinition(LLMChatV2NodeImpl, 'LLM Chat');
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { NodeImpl } from '../NodeImpl.js';
|
|
2
|
+
import { dedent, newId } from '../../utils/index.js';
|
|
3
|
+
import { nodeDefinition } from '../NodeDefinition.js';
|
|
4
|
+
export class ListGraphsNodeImpl extends NodeImpl {
|
|
5
|
+
static create() {
|
|
6
|
+
return {
|
|
7
|
+
id: newId(),
|
|
8
|
+
type: 'listGraphs',
|
|
9
|
+
title: 'List Graphs',
|
|
10
|
+
visualData: { x: 0, y: 0, width: 250 },
|
|
11
|
+
data: {},
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
getInputDefinitions() {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
getOutputDefinitions() {
|
|
18
|
+
return [
|
|
19
|
+
{
|
|
20
|
+
id: 'graphs',
|
|
21
|
+
title: 'Graphs',
|
|
22
|
+
dataType: 'graph-reference[]',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: 'graph-names',
|
|
26
|
+
title: 'Graph Names',
|
|
27
|
+
dataType: 'string[]',
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
static getUIData() {
|
|
32
|
+
return {
|
|
33
|
+
infoBoxBody: dedent `
|
|
34
|
+
Lists all graphs in the project.
|
|
35
|
+
`,
|
|
36
|
+
infoBoxTitle: 'List Graphs Node',
|
|
37
|
+
contextMenuTitle: 'List Graphs',
|
|
38
|
+
group: ['Input/Output'],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
getEditors() {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
async process(_inputs, context) {
|
|
45
|
+
const graphs = Object.values(context.project.graphs);
|
|
46
|
+
return {
|
|
47
|
+
['graphs']: {
|
|
48
|
+
type: 'graph-reference[]',
|
|
49
|
+
value: graphs.map((graph) => ({
|
|
50
|
+
graphId: graph.metadata.id ?? '',
|
|
51
|
+
graphName: graph.metadata.name ?? '',
|
|
52
|
+
})),
|
|
53
|
+
},
|
|
54
|
+
['graph-names']: {
|
|
55
|
+
type: 'string[]',
|
|
56
|
+
value: graphs.map((graph) => graph.metadata.name ?? ''),
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export const listGraphsNode = nodeDefinition(ListGraphsNodeImpl, 'List Graphs');
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { NodeImpl } from '../NodeImpl.js';
|
|
2
|
+
import { coerceTypeOptional, dedent, newId } from '../../utils/index.js';
|
|
3
|
+
import { nodeDefinition } from '../NodeDefinition.js';
|
|
4
|
+
export class LoadDatasetNodeImpl extends NodeImpl {
|
|
5
|
+
static create() {
|
|
6
|
+
return {
|
|
7
|
+
id: newId(),
|
|
8
|
+
type: 'loadDataset',
|
|
9
|
+
title: 'Load Dataset',
|
|
10
|
+
visualData: { x: 0, y: 0, width: 250 },
|
|
11
|
+
data: {
|
|
12
|
+
datasetId: '',
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
getInputDefinitions() {
|
|
17
|
+
const inputs = [];
|
|
18
|
+
if (this.data.useDatasetIdInput) {
|
|
19
|
+
inputs.push({
|
|
20
|
+
id: 'datasetId',
|
|
21
|
+
title: 'Dataset ID',
|
|
22
|
+
dataType: 'string',
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return inputs;
|
|
26
|
+
}
|
|
27
|
+
getOutputDefinitions() {
|
|
28
|
+
return [
|
|
29
|
+
{
|
|
30
|
+
id: 'dataset',
|
|
31
|
+
title: 'Dataset',
|
|
32
|
+
dataType: 'object[]',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'datasetId_out',
|
|
36
|
+
title: 'Dataset ID',
|
|
37
|
+
dataType: 'string',
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
static getUIData() {
|
|
42
|
+
return {
|
|
43
|
+
infoBoxBody: dedent `
|
|
44
|
+
Loads a dataset with the provided ID. If the dataset does not exist, it throws an error.
|
|
45
|
+
`,
|
|
46
|
+
infoBoxTitle: 'Load Dataset Node',
|
|
47
|
+
contextMenuTitle: 'Load Dataset',
|
|
48
|
+
group: ['Input/Output'],
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
getEditors() {
|
|
52
|
+
return [
|
|
53
|
+
{
|
|
54
|
+
type: 'datasetSelector',
|
|
55
|
+
label: 'Dataset',
|
|
56
|
+
dataKey: 'datasetId',
|
|
57
|
+
useInputToggleDataKey: 'useDatasetIdInput',
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
async process(inputs, context) {
|
|
62
|
+
const { datasetProvider } = context;
|
|
63
|
+
if (datasetProvider == null) {
|
|
64
|
+
throw new Error('datasetProvider is required');
|
|
65
|
+
}
|
|
66
|
+
const datasetId = coerceTypeOptional(inputs['datasetId'], 'string') || this.data.datasetId;
|
|
67
|
+
const dataset = await datasetProvider.getDatasetData(datasetId);
|
|
68
|
+
if (!dataset) {
|
|
69
|
+
throw new Error(`Dataset with ID ${datasetId} does not exist`);
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
['dataset']: {
|
|
73
|
+
type: 'object[]',
|
|
74
|
+
value: dataset.rows,
|
|
75
|
+
},
|
|
76
|
+
['datasetId_out']: {
|
|
77
|
+
type: 'string',
|
|
78
|
+
value: datasetId,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export const loadDatasetNode = nodeDefinition(LoadDatasetNodeImpl, 'Load Dataset');
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import {} from '../NodeBase.js';
|
|
2
|
+
import { nanoid } from 'nanoid/non-secure';
|
|
3
|
+
import { NodeImpl } from '../NodeImpl.js';
|
|
4
|
+
import { nodeDefinition } from '../NodeDefinition.js';
|
|
5
|
+
import {} from '../GraphProcessor.js';
|
|
6
|
+
import { coerceType } from '../../utils/coerceType.js';
|
|
7
|
+
import {} from '../ProcessContext.js';
|
|
8
|
+
import { dedent } from 'ts-dedent';
|
|
9
|
+
import {} from '../../index.js';
|
|
10
|
+
import { entries } from '../../utils/typeSafety.js';
|
|
11
|
+
export class LoopControllerNodeImpl extends NodeImpl {
|
|
12
|
+
static create() {
|
|
13
|
+
const chartNode = {
|
|
14
|
+
type: 'loopController',
|
|
15
|
+
title: 'Loop Controller',
|
|
16
|
+
id: nanoid(),
|
|
17
|
+
visualData: {
|
|
18
|
+
x: 0,
|
|
19
|
+
y: 0,
|
|
20
|
+
width: 250,
|
|
21
|
+
},
|
|
22
|
+
data: {
|
|
23
|
+
maxIterations: 100,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
return chartNode;
|
|
27
|
+
}
|
|
28
|
+
getInputDefinitions(connections, nodes) {
|
|
29
|
+
const inputs = [];
|
|
30
|
+
const messageCount = this.#getInputPortCount(connections);
|
|
31
|
+
inputs.push({
|
|
32
|
+
dataType: 'any',
|
|
33
|
+
id: 'continue',
|
|
34
|
+
title: 'Continue',
|
|
35
|
+
});
|
|
36
|
+
let i = 1;
|
|
37
|
+
for (; i <= messageCount + 1; i++) {
|
|
38
|
+
const input = {
|
|
39
|
+
dataType: 'any',
|
|
40
|
+
id: `input${i}`,
|
|
41
|
+
title: `Input ${i}`,
|
|
42
|
+
};
|
|
43
|
+
const inputConnection = connections.find((connection) => connection.inputId === input.id && connection.inputNodeId === this.id);
|
|
44
|
+
if (inputConnection && nodes[inputConnection.outputNodeId]) {
|
|
45
|
+
input.title = nodes[inputConnection.outputNodeId].title;
|
|
46
|
+
}
|
|
47
|
+
const inputDefault = {
|
|
48
|
+
dataType: 'any',
|
|
49
|
+
id: `input${i}Default`,
|
|
50
|
+
title: `Input ${i} Default`,
|
|
51
|
+
};
|
|
52
|
+
const inputDefaultConnection = connections.find((connection) => connection.inputId === inputDefault.id && connection.inputNodeId === this.id);
|
|
53
|
+
if (inputDefaultConnection && nodes[inputDefaultConnection.outputNodeId]) {
|
|
54
|
+
inputDefault.title = `${nodes[inputDefaultConnection.outputNodeId].title} (Default)`;
|
|
55
|
+
}
|
|
56
|
+
inputs.push(input);
|
|
57
|
+
inputs.push(inputDefault);
|
|
58
|
+
}
|
|
59
|
+
return inputs;
|
|
60
|
+
}
|
|
61
|
+
getOutputDefinitions(connections, nodes) {
|
|
62
|
+
const messageCount = this.#getInputPortCount(connections);
|
|
63
|
+
const outputs = [];
|
|
64
|
+
outputs.push({
|
|
65
|
+
dataType: 'any',
|
|
66
|
+
id: 'break',
|
|
67
|
+
title: 'Break',
|
|
68
|
+
});
|
|
69
|
+
outputs.push({
|
|
70
|
+
dataType: 'number',
|
|
71
|
+
id: 'iteration',
|
|
72
|
+
title: 'Iteration',
|
|
73
|
+
});
|
|
74
|
+
for (let i = 1; i <= messageCount; i++) {
|
|
75
|
+
const output = {
|
|
76
|
+
dataType: 'any',
|
|
77
|
+
id: `output${i}`,
|
|
78
|
+
title: `Output ${i}`,
|
|
79
|
+
};
|
|
80
|
+
const inputConnection = connections.find((connection) => connection.inputId === `input${i}` && connection.inputNodeId === this.id);
|
|
81
|
+
if (inputConnection && nodes[inputConnection.outputNodeId]) {
|
|
82
|
+
output.title = `${nodes[inputConnection.outputNodeId].title}?`;
|
|
83
|
+
}
|
|
84
|
+
outputs.push(output);
|
|
85
|
+
}
|
|
86
|
+
return outputs;
|
|
87
|
+
}
|
|
88
|
+
getEditors() {
|
|
89
|
+
return [
|
|
90
|
+
{
|
|
91
|
+
type: 'number',
|
|
92
|
+
label: 'Max Iterations',
|
|
93
|
+
dataKey: 'maxIterations',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
type: 'dropdown',
|
|
97
|
+
options: [
|
|
98
|
+
{
|
|
99
|
+
label: 'Break',
|
|
100
|
+
value: 'break',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
label: 'Error',
|
|
104
|
+
value: 'error',
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
label: 'At Max Iterations',
|
|
108
|
+
dataKey: 'atMaxIterationsAction',
|
|
109
|
+
defaultValue: 'error',
|
|
110
|
+
helperMessage: 'What should happen when the max iterations is reached?',
|
|
111
|
+
},
|
|
112
|
+
];
|
|
113
|
+
}
|
|
114
|
+
static getUIData() {
|
|
115
|
+
return {
|
|
116
|
+
infoBoxBody: dedent `
|
|
117
|
+
Defines the entry point for a loop. Values from inside the loop should be passed back through the "Input" ports, and their corresponding "Default" values can be specified on the input ports as well.
|
|
118
|
+
|
|
119
|
+
If the "continue" input is falsey, then the "break" output will run.
|
|
120
|
+
`,
|
|
121
|
+
infoBoxTitle: 'Loop Controller Node',
|
|
122
|
+
contextMenuTitle: 'Loop Controller',
|
|
123
|
+
group: ['Logic'],
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
#getInputPortCount(connections) {
|
|
127
|
+
const inputNodeId = this.chartNode.id;
|
|
128
|
+
const messageConnections = connections.filter((connection) => connection.inputNodeId === inputNodeId && connection.inputId.startsWith('input'));
|
|
129
|
+
let maxMessageNumber = 0;
|
|
130
|
+
for (const connection of messageConnections) {
|
|
131
|
+
const messageNumber = parseInt(connection.inputId.replace('input', ''));
|
|
132
|
+
if (messageNumber > maxMessageNumber) {
|
|
133
|
+
maxMessageNumber = messageNumber;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return maxMessageNumber;
|
|
137
|
+
}
|
|
138
|
+
async process(inputs, context) {
|
|
139
|
+
const output = {};
|
|
140
|
+
let inputCount = 0;
|
|
141
|
+
while (inputs[`input${inputCount + 1}`] || inputs[`input${inputCount + 1}Default`]) {
|
|
142
|
+
inputCount++;
|
|
143
|
+
}
|
|
144
|
+
const defaultInputs = entries(inputs).filter(([key]) => key.endsWith('Default'));
|
|
145
|
+
// If any of the default inputs are control-flow-excluded, then exclude all outputs.
|
|
146
|
+
// Technically, it should be "any node outside of the cycle" but this should be good enough?
|
|
147
|
+
if (defaultInputs.some(([, value]) => value?.type === 'control-flow-excluded')) {
|
|
148
|
+
for (let i = 0; i <= inputCount; i++) {
|
|
149
|
+
output[`output${i}`] = { type: 'control-flow-excluded', value: undefined };
|
|
150
|
+
}
|
|
151
|
+
output['break'] = { type: 'control-flow-excluded', value: undefined };
|
|
152
|
+
return output;
|
|
153
|
+
}
|
|
154
|
+
const iterationCount = context.attachedData.loopInfo?.iterationCount ?? 0;
|
|
155
|
+
output['iteration'] = { type: 'number', value: iterationCount + 1 };
|
|
156
|
+
if (iterationCount >= (this.data.maxIterations ?? 100) && this.data.atMaxIterationsAction !== 'break') {
|
|
157
|
+
throw new Error(`Loop controller exceeded max iterations of ${this.data.maxIterations ?? 100}`);
|
|
158
|
+
}
|
|
159
|
+
// If the continue port is not connected (so undefined), or if it's undefined before it's
|
|
160
|
+
// inside the loop itself (connection has not ran yet), then we should continue by default.
|
|
161
|
+
let continueValue = false;
|
|
162
|
+
if (inputs['continue'] === undefined) {
|
|
163
|
+
continueValue = true;
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
const continueDataValue = inputs['continue'];
|
|
167
|
+
if (continueDataValue.type === 'control-flow-excluded') {
|
|
168
|
+
continueValue = false;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
continueValue = coerceType(continueDataValue, 'boolean');
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (iterationCount >= (this.data.maxIterations ?? 100) && this.data.atMaxIterationsAction === 'break') {
|
|
175
|
+
continueValue = false;
|
|
176
|
+
}
|
|
177
|
+
if (continueValue) {
|
|
178
|
+
output['break'] = { type: 'control-flow-excluded', value: 'loop-not-broken' };
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
const inputValues = [];
|
|
182
|
+
for (let i = 1; i <= inputCount; i++) {
|
|
183
|
+
inputValues.push(inputs[`input${i}`]?.value);
|
|
184
|
+
}
|
|
185
|
+
// Break gets an array of all the input values
|
|
186
|
+
output['break'] = { type: 'any[]', value: inputValues };
|
|
187
|
+
}
|
|
188
|
+
for (let i = 1; i <= inputCount; i++) {
|
|
189
|
+
if (continueValue) {
|
|
190
|
+
const inputId = `input${i}`;
|
|
191
|
+
const outputId = `output${i}`;
|
|
192
|
+
if (inputs[inputId]) {
|
|
193
|
+
output[outputId] = inputs[inputId];
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
output[outputId] = inputs[`${inputId}Default`];
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
output[`output${i}`] = { type: 'control-flow-excluded', value: undefined };
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return output;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
export const loopControllerNode = nodeDefinition(LoopControllerNodeImpl, 'Loop Controller');
|