@alpic80/rivet-core 1.19.1-aidon.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/LICENSE +7 -0
- package/README.md +176 -0
- package/dist/cjs/bundle.cjs +18915 -0
- package/dist/cjs/bundle.cjs.map +7 -0
- package/dist/esm/api/createProcessor.js +131 -0
- package/dist/esm/api/streaming.js +116 -0
- package/dist/esm/exports.js +32 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/integrations/AudioProvider.js +1 -0
- package/dist/esm/integrations/DatasetProvider.js +92 -0
- package/dist/esm/integrations/EmbeddingGenerator.js +1 -0
- package/dist/esm/integrations/GptTokenizerTokenizer.js +65 -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/openai/OpenAIEmbeddingGenerator.js +23 -0
- package/dist/esm/model/DataValue.js +176 -0
- package/dist/esm/model/Dataset.js +1 -0
- package/dist/esm/model/EditorDefinition.js +1 -0
- package/dist/esm/model/GraphProcessor.js +1198 -0
- package/dist/esm/model/NodeBase.js +1 -0
- package/dist/esm/model/NodeBodySpec.js +1 -0
- package/dist/esm/model/NodeDefinition.js +12 -0
- package/dist/esm/model/NodeGraph.js +14 -0
- package/dist/esm/model/NodeImpl.js +49 -0
- package/dist/esm/model/NodeRegistration.js +144 -0
- package/dist/esm/model/Nodes.js +227 -0
- package/dist/esm/model/PluginLoadSpec.js +1 -0
- package/dist/esm/model/ProcessContext.js +1 -0
- package/dist/esm/model/Project.js +2 -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/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 +199 -0
- package/dist/esm/model/nodes/AssemblePromptNode.js +129 -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 +136 -0
- package/dist/esm/model/nodes/ChatNode.js +964 -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 +136 -0
- package/dist/esm/model/nodes/CommentNode.js +69 -0
- package/dist/esm/model/nodes/CompareNode.js +138 -0
- package/dist/esm/model/nodes/ContextNode.js +99 -0
- package/dist/esm/model/nodes/CreateDatasetNode.js +71 -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 +136 -0
- package/dist/esm/model/nodes/DestructureNode.js +86 -0
- package/dist/esm/model/nodes/EvaluateNode.js +141 -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 +128 -0
- package/dist/esm/model/nodes/ExtractRegexNode.js +201 -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/GptFunctionNode.js +169 -0
- package/dist/esm/model/nodes/GraphInputNode.js +130 -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 +257 -0
- package/dist/esm/model/nodes/IfElseNode.js +138 -0
- package/dist/esm/model/nodes/IfNode.js +124 -0
- package/dist/esm/model/nodes/ImageNode.js +107 -0
- package/dist/esm/model/nodes/JoinNode.js +135 -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/MatchNode.js +137 -0
- package/dist/esm/model/nodes/NumberNode.js +86 -0
- package/dist/esm/model/nodes/ObjectNode.js +121 -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 +227 -0
- package/dist/esm/model/nodes/RaceInputsNode.js +86 -0
- package/dist/esm/model/nodes/RaiseEventNode.js +84 -0
- package/dist/esm/model/nodes/RandomNumberNode.js +106 -0
- package/dist/esm/model/nodes/ReadDirectoryNode.js +165 -0
- package/dist/esm/model/nodes/ReadFileNode.js +114 -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 +100 -0
- package/dist/esm/model/nodes/SplitNode.js +101 -0
- package/dist/esm/model/nodes/SubGraphNode.js +181 -0
- package/dist/esm/model/nodes/TextNode.js +97 -0
- package/dist/esm/model/nodes/ToJsonNode.js +78 -0
- package/dist/esm/model/nodes/ToYamlNode.js +68 -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 +111 -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/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/aidon/index.js +2 -0
- package/dist/esm/plugins/aidon/nodes/ChatAidonNode.js +215 -0
- package/dist/esm/plugins/aidon/plugin.js +9 -0
- package/dist/esm/plugins/anthropic/anthropic.js +187 -0
- package/dist/esm/plugins/anthropic/fetchEventSource.js +106 -0
- package/dist/esm/plugins/anthropic/index.js +2 -0
- package/dist/esm/plugins/anthropic/nodes/ChatAnthropicNode.js +652 -0
- package/dist/esm/plugins/anthropic/plugin.js +18 -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 +125 -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 +2 -0
- package/dist/esm/plugins/gentrace/plugin.js +192 -0
- package/dist/esm/plugins/google/google.js +60 -0
- package/dist/esm/plugins/google/index.js +2 -0
- package/dist/esm/plugins/google/nodes/ChatGoogleNode.js +364 -0
- package/dist/esm/plugins/google/plugin.js +32 -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 +145 -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 +21 -0
- package/dist/esm/recording/ExecutionRecorder.js +177 -0
- package/dist/esm/recording/RecordedEvents.js +1 -0
- package/dist/esm/utils/assertNever.js +3 -0
- package/dist/esm/utils/base64.js +25 -0
- package/dist/esm/utils/chatMessageToOpenAIChatCompletionMessage.js +60 -0
- package/dist/esm/utils/coerceType.js +322 -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/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 +14 -0
- package/dist/esm/utils/inputs.js +16 -0
- package/dist/esm/utils/interpolation.js +6 -0
- package/dist/esm/utils/misc.js +1 -0
- package/dist/esm/utils/newId.js +4 -0
- package/dist/esm/utils/openai.js +219 -0
- package/dist/esm/utils/outputs.js +14 -0
- package/dist/esm/utils/serialization/serialization.js +86 -0
- package/dist/esm/utils/serialization/serializationUtils.js +13 -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 +145 -0
- package/dist/esm/utils/serialization/serialization_v4.js +200 -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/types/api/createProcessor.d.ts +37 -0
- package/dist/types/api/streaming.d.ts +56 -0
- package/dist/types/exports.d.ts +33 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/integrations/AudioProvider.d.ts +4 -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/openai/OpenAIEmbeddingGenerator.d.ts +10 -0
- package/dist/types/model/DataValue.d.ts +138 -0
- package/dist/types/model/Dataset.d.ts +19 -0
- package/dist/types/model/EditorDefinition.d.ts +142 -0
- package/dist/types/model/GraphProcessor.d.ts +192 -0
- package/dist/types/model/NodeBase.d.ts +110 -0
- package/dist/types/model/NodeBodySpec.d.ts +19 -0
- package/dist/types/model/NodeDefinition.d.ts +13 -0
- package/dist/types/model/NodeGraph.d.ts +15 -0
- package/dist/types/model/NodeImpl.d.ts +55 -0
- package/dist/types/model/NodeRegistration.d.ts +24 -0
- package/dist/types/model/Nodes.d.ts +84 -0
- package/dist/types/model/PluginLoadSpec.d.ts +17 -0
- package/dist/types/model/ProcessContext.d.ts +69 -0
- package/dist/types/model/Project.d.ts +17 -0
- package/dist/types/model/RivetPlugin.d.ts +45 -0
- package/dist/types/model/RivetUIContext.d.ts +18 -0
- package/dist/types/model/Settings.d.ts +15 -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 +20 -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/ChatNode.d.ts +77 -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 +21 -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/DatasetNearestNeigborsNode.d.ts +19 -0
- package/dist/types/model/nodes/DelayNode.d.ts +20 -0
- package/dist/types/model/nodes/DelegateFunctionCallNode.d.ts +25 -0
- package/dist/types/model/nodes/DestructureNode.d.ts +18 -0
- package/dist/types/model/nodes/EvaluateNode.d.ts +19 -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 +19 -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/GptFunctionNode.d.ts +25 -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 +27 -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/JoinNode.d.ts +21 -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/MatchNode.d.ts +19 -0
- package/dist/types/model/nodes/NumberNode.d.ts +21 -0
- package/dist/types/model/nodes/ObjectNode.d.ts +18 -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 +23 -0
- package/dist/types/model/nodes/RaceInputsNode.d.ts +17 -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/ReadDirectoryNode.d.ts +30 -0
- package/dist/types/model/nodes/ReadFileNode.d.ts +23 -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 +18 -0
- package/dist/types/model/nodes/ToJsonNode.d.ts +18 -0
- package/dist/types/model/nodes/ToYamlNode.d.ts +13 -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 +21 -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/native/BaseDir.d.ts +29 -0
- package/dist/types/native/BrowserNativeApi.d.ts +11 -0
- package/dist/types/native/NativeApi.d.ts +17 -0
- package/dist/types/plugins/aidon/index.d.ts +2 -0
- package/dist/types/plugins/aidon/nodes/ChatAidonNode.d.ts +3 -0
- package/dist/types/plugins/aidon/plugin.d.ts +2 -0
- package/dist/types/plugins/anthropic/anthropic.d.ts +216 -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 +30 -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 +5 -0
- package/dist/types/plugins/google/google.d.ts +60 -0
- package/dist/types/plugins/google/index.d.ts +2 -0
- package/dist/types/plugins/google/nodes/ChatGoogleNode.d.ts +27 -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 +20 -0
- package/dist/types/recording/ExecutionRecorder.d.ts +25 -0
- package/dist/types/recording/RecordedEvents.d.ts +100 -0
- package/dist/types/utils/assertNever.d.ts +1 -0
- package/dist/types/utils/base64.d.ts +2 -0
- package/dist/types/utils/chatMessageToOpenAIChatCompletionMessage.d.ts +3 -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/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 +14 -0
- package/dist/types/utils/inputs.d.ts +3 -0
- package/dist/types/utils/interpolation.d.ts +1 -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 +739 -0
- package/dist/types/utils/outputs.d.ts +3 -0
- package/dist/types/utils/serialization/serialization.d.ts +12 -0
- package/dist/types/utils/serialization/serializationUtils.d.ts +6 -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/package.json +97 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {} from '../NodeBase.js';
|
|
2
|
+
import { NodeImpl } from '../NodeImpl.js';
|
|
3
|
+
import { nodeDefinition } from '../NodeDefinition.js';
|
|
4
|
+
import { nanoid } from 'nanoid/non-secure';
|
|
5
|
+
import {} from '../GraphProcessor.js';
|
|
6
|
+
import {} from '../ProcessContext.js';
|
|
7
|
+
import {} from '../../index.js';
|
|
8
|
+
import { dedent } from 'ts-dedent';
|
|
9
|
+
import { coerceType } from '../../utils/coerceType.js';
|
|
10
|
+
import { getIntegration } from '../../integrations/integrations.js';
|
|
11
|
+
export class GetEmbeddingNodeImpl extends NodeImpl {
|
|
12
|
+
static create() {
|
|
13
|
+
return {
|
|
14
|
+
id: nanoid(),
|
|
15
|
+
type: 'getEmbedding',
|
|
16
|
+
title: 'Get Embedding',
|
|
17
|
+
visualData: { x: 0, y: 0, width: 250 },
|
|
18
|
+
data: {
|
|
19
|
+
integration: 'openai',
|
|
20
|
+
useIntegrationInput: false,
|
|
21
|
+
model: undefined,
|
|
22
|
+
dimensions: undefined
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
getInputDefinitions() {
|
|
27
|
+
const inputDefinitions = [];
|
|
28
|
+
inputDefinitions.push({
|
|
29
|
+
id: 'input',
|
|
30
|
+
title: 'Input',
|
|
31
|
+
dataType: 'string',
|
|
32
|
+
required: true,
|
|
33
|
+
});
|
|
34
|
+
if (this.data.useIntegrationInput) {
|
|
35
|
+
inputDefinitions.push({
|
|
36
|
+
id: 'integration',
|
|
37
|
+
title: 'Integration',
|
|
38
|
+
dataType: 'string',
|
|
39
|
+
required: true,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (this.data.useModelInput) {
|
|
43
|
+
inputDefinitions.push({
|
|
44
|
+
id: 'model',
|
|
45
|
+
title: 'Model',
|
|
46
|
+
dataType: 'string',
|
|
47
|
+
required: false,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (this.data.useDimensionsInput) {
|
|
51
|
+
inputDefinitions.push({
|
|
52
|
+
id: 'dimensions',
|
|
53
|
+
title: 'Dimensions',
|
|
54
|
+
dataType: 'number',
|
|
55
|
+
required: false,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return inputDefinitions;
|
|
59
|
+
}
|
|
60
|
+
getOutputDefinitions() {
|
|
61
|
+
const outputs = [
|
|
62
|
+
{
|
|
63
|
+
id: 'embedding',
|
|
64
|
+
title: 'Embedding',
|
|
65
|
+
dataType: 'vector',
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
return outputs;
|
|
69
|
+
}
|
|
70
|
+
getEditors() {
|
|
71
|
+
return [
|
|
72
|
+
{
|
|
73
|
+
type: 'dropdown',
|
|
74
|
+
label: 'Integration',
|
|
75
|
+
dataKey: 'integration',
|
|
76
|
+
options: [{ label: 'OpenAI', value: 'openai' }],
|
|
77
|
+
useInputToggleDataKey: 'useIntegrationInput',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
type: 'string',
|
|
81
|
+
label: 'Model',
|
|
82
|
+
dataKey: 'model',
|
|
83
|
+
useInputToggleDataKey: 'useModelInput',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
type: 'number',
|
|
87
|
+
label: 'Dimensions',
|
|
88
|
+
dataKey: 'dimensions',
|
|
89
|
+
useInputToggleDataKey: 'useDimensionsInput',
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
getBody() {
|
|
94
|
+
return `Using ${this.data.useIntegrationInput ? '(input)' : this.data.integration}`;
|
|
95
|
+
}
|
|
96
|
+
static getUIData() {
|
|
97
|
+
return {
|
|
98
|
+
infoBoxBody: dedent `
|
|
99
|
+
Gets a OpenAI vector embedding for the input text provided.
|
|
100
|
+
|
|
101
|
+
Can be used with the Vector Store and Vector KNN nodes.
|
|
102
|
+
`,
|
|
103
|
+
infoBoxTitle: 'Get Embedding Node',
|
|
104
|
+
contextMenuTitle: 'Get Embedding',
|
|
105
|
+
group: ['AI'],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
async process(inputs, context) {
|
|
109
|
+
const input = coerceType(inputs['input'], 'string');
|
|
110
|
+
const integrationName = this.data.useIntegrationInput
|
|
111
|
+
? coerceType(inputs['integration'], 'string')
|
|
112
|
+
: this.data.integration;
|
|
113
|
+
const model = this.data.useModelInput ? coerceType(inputs['model'], 'string') : this.data.model;
|
|
114
|
+
const dimensions = this.data.useDimensionsInput
|
|
115
|
+
? coerceType(inputs['dimensions'], 'number')
|
|
116
|
+
: this.data.dimensions;
|
|
117
|
+
const embeddingGenerator = getIntegration('embeddingGenerator', integrationName, context);
|
|
118
|
+
const embedding = await embeddingGenerator.generateEmbedding(input, {
|
|
119
|
+
model,
|
|
120
|
+
dimensions,
|
|
121
|
+
});
|
|
122
|
+
return {
|
|
123
|
+
['embedding']: {
|
|
124
|
+
type: 'vector',
|
|
125
|
+
value: embedding,
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
export const getEmbeddingNode = nodeDefinition(GetEmbeddingNodeImpl, 'Get Embedding');
|
|
@@ -0,0 +1,139 @@
|
|
|
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 { isArrayDataType, isScalarDataType, scalarDefaults, } from '../DataValue.js';
|
|
6
|
+
import {} from '../GraphProcessor.js';
|
|
7
|
+
import { coerceType } from '../../utils/coerceType.js';
|
|
8
|
+
import {} from '../ProcessContext.js';
|
|
9
|
+
import { dedent } from 'ts-dedent';
|
|
10
|
+
import {} from '../../index.js';
|
|
11
|
+
export class GetGlobalNodeImpl extends NodeImpl {
|
|
12
|
+
static create() {
|
|
13
|
+
const chartNode = {
|
|
14
|
+
type: 'getGlobal',
|
|
15
|
+
title: 'Get Global',
|
|
16
|
+
id: nanoid(),
|
|
17
|
+
visualData: {
|
|
18
|
+
x: 0,
|
|
19
|
+
y: 0,
|
|
20
|
+
width: 200,
|
|
21
|
+
},
|
|
22
|
+
data: {
|
|
23
|
+
id: 'variable-name',
|
|
24
|
+
dataType: 'string',
|
|
25
|
+
onDemand: true,
|
|
26
|
+
useIdInput: false,
|
|
27
|
+
wait: false,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
return chartNode;
|
|
31
|
+
}
|
|
32
|
+
getInputDefinitions() {
|
|
33
|
+
if (this.data.useIdInput) {
|
|
34
|
+
return [
|
|
35
|
+
{
|
|
36
|
+
id: 'id',
|
|
37
|
+
title: 'Variable ID',
|
|
38
|
+
dataType: this.data.dataType,
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
getOutputDefinitions() {
|
|
45
|
+
const { onDemand, dataType } = this.chartNode.data;
|
|
46
|
+
return [
|
|
47
|
+
{
|
|
48
|
+
id: 'value',
|
|
49
|
+
title: 'Value',
|
|
50
|
+
dataType: onDemand ? `fn<${dataType}>` : dataType,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: 'variable_id_out',
|
|
54
|
+
title: 'Variable ID',
|
|
55
|
+
dataType: 'string',
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
getEditors() {
|
|
60
|
+
return [
|
|
61
|
+
{
|
|
62
|
+
type: 'string',
|
|
63
|
+
label: 'Variable ID',
|
|
64
|
+
dataKey: 'id',
|
|
65
|
+
useInputToggleDataKey: 'useIdInput',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: 'dataTypeSelector',
|
|
69
|
+
label: 'Data Type',
|
|
70
|
+
dataKey: 'dataType',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
type: 'toggle',
|
|
74
|
+
label: 'On Demand',
|
|
75
|
+
dataKey: 'onDemand',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
type: 'toggle',
|
|
79
|
+
label: 'Wait',
|
|
80
|
+
dataKey: 'wait',
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
getBody() {
|
|
85
|
+
return dedent `
|
|
86
|
+
${this.data.useIdInput ? '(ID from input)' : this.data.id}
|
|
87
|
+
Type: ${this.data.dataType}
|
|
88
|
+
${this.data.wait ? 'Waits for available data' : ''}
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
91
|
+
static getUIData() {
|
|
92
|
+
return {
|
|
93
|
+
infoBoxBody: dedent `
|
|
94
|
+
Retrieves a global value that is shared across all graphs and subgraphs. The id of the global value is configured in this node.
|
|
95
|
+
`,
|
|
96
|
+
infoBoxTitle: 'Get Global Node',
|
|
97
|
+
contextMenuTitle: 'Get Global',
|
|
98
|
+
group: ['Advanced'],
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
async process(inputs, context) {
|
|
102
|
+
if (this.data.onDemand) {
|
|
103
|
+
if (this.data.wait) {
|
|
104
|
+
throw new Error('Cannot use onDemand and wait together');
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
['value']: {
|
|
108
|
+
type: `fn<${this.data.dataType}>`,
|
|
109
|
+
value: () => {
|
|
110
|
+
const id = this.data.useIdInput ? coerceType(inputs['id'], 'string') : this.data.id;
|
|
111
|
+
const value = context.getGlobal(id);
|
|
112
|
+
if (value) {
|
|
113
|
+
return value.value;
|
|
114
|
+
}
|
|
115
|
+
// Have some useful defaults before the value is set
|
|
116
|
+
if (isArrayDataType(this.data.dataType)) {
|
|
117
|
+
return [];
|
|
118
|
+
}
|
|
119
|
+
return scalarDefaults[this.data.dataType];
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
const id = this.data.useIdInput ? coerceType(inputs['id'], 'string') : this.data.id;
|
|
125
|
+
let value = this.data.wait ? await context.waitForGlobal(id) : context.getGlobal(id);
|
|
126
|
+
// Have some useful defaults before the value is set
|
|
127
|
+
if (!value && isArrayDataType(this.data.dataType)) {
|
|
128
|
+
value = { type: this.data.dataType, value: [] };
|
|
129
|
+
}
|
|
130
|
+
if (!value && isScalarDataType(this.data.dataType)) {
|
|
131
|
+
value = { type: this.data.dataType, value: scalarDefaults[this.data.dataType] };
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
['value']: value,
|
|
135
|
+
['variable_id_out']: { type: 'string', value: id },
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
export const getGlobalNode = nodeDefinition(GetGlobalNodeImpl, 'Get Global');
|
|
@@ -0,0 +1,169 @@
|
|
|
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 { dedent } from 'ts-dedent';
|
|
6
|
+
import {} from '../EditorDefinition.js';
|
|
7
|
+
import {} from '../NodeBodySpec.js';
|
|
8
|
+
import { interpolate } from '../../utils/interpolation.js';
|
|
9
|
+
import { keys } from '../../utils/typeSafety.js';
|
|
10
|
+
import { coerceTypeOptional, coerceType } from '../../utils/coerceType.js';
|
|
11
|
+
import { getInputOrData } from '../../utils/index.js';
|
|
12
|
+
export class GptFunctionNodeImpl extends NodeImpl {
|
|
13
|
+
static create() {
|
|
14
|
+
const chartNode = {
|
|
15
|
+
type: 'gptFunction',
|
|
16
|
+
title: 'GPT Function',
|
|
17
|
+
id: nanoid(),
|
|
18
|
+
visualData: {
|
|
19
|
+
x: 0,
|
|
20
|
+
y: 0,
|
|
21
|
+
width: 250,
|
|
22
|
+
},
|
|
23
|
+
data: {
|
|
24
|
+
name: 'newFunction',
|
|
25
|
+
description: 'No description provided',
|
|
26
|
+
schema: dedent `
|
|
27
|
+
{
|
|
28
|
+
"type": "object",
|
|
29
|
+
"properties": {}
|
|
30
|
+
}`,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
return chartNode;
|
|
34
|
+
}
|
|
35
|
+
getInputDefinitions() {
|
|
36
|
+
let inputs = [];
|
|
37
|
+
if (this.data.useNameInput) {
|
|
38
|
+
inputs.push({
|
|
39
|
+
id: 'name',
|
|
40
|
+
title: 'Name',
|
|
41
|
+
dataType: 'string',
|
|
42
|
+
description: 'The name of the function that GPT will see as available to call',
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (this.data.useDescriptionInput) {
|
|
46
|
+
inputs.push({
|
|
47
|
+
id: 'description',
|
|
48
|
+
title: 'Description',
|
|
49
|
+
dataType: 'string',
|
|
50
|
+
description: 'The description of the function that GPT will see as available to call',
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (this.data.useSchemaInput) {
|
|
54
|
+
inputs.push({
|
|
55
|
+
id: 'schema',
|
|
56
|
+
title: 'Schema',
|
|
57
|
+
dataType: 'object',
|
|
58
|
+
description: 'The schema of the function that GPT will see as available to call',
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
// Extract inputs from promptText, everything like {{input}}
|
|
62
|
+
const inputNames = this.data.useSchemaInput ? [] : [...new Set(this.data.schema.match(/\{\{([^}]+)\}\}/g))];
|
|
63
|
+
inputs = [
|
|
64
|
+
...inputs,
|
|
65
|
+
...(inputNames?.map((inputName) => {
|
|
66
|
+
const name = inputName.slice(2, -2);
|
|
67
|
+
return {
|
|
68
|
+
// id and title should not have the {{ and }}
|
|
69
|
+
id: `input-${name}`,
|
|
70
|
+
title: name,
|
|
71
|
+
dataType: 'string',
|
|
72
|
+
description: `An interpolated value in the schema named '${name}'`,
|
|
73
|
+
};
|
|
74
|
+
}) ?? []),
|
|
75
|
+
];
|
|
76
|
+
return inputs;
|
|
77
|
+
}
|
|
78
|
+
getOutputDefinitions() {
|
|
79
|
+
return [
|
|
80
|
+
{
|
|
81
|
+
id: 'function',
|
|
82
|
+
title: 'Function',
|
|
83
|
+
dataType: 'gpt-function',
|
|
84
|
+
description: 'The GPT function that can be called by the LLM.',
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
}
|
|
88
|
+
getEditors() {
|
|
89
|
+
return [
|
|
90
|
+
{
|
|
91
|
+
type: 'string',
|
|
92
|
+
label: 'Name',
|
|
93
|
+
dataKey: 'name',
|
|
94
|
+
useInputToggleDataKey: 'useNameInput',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
type: 'toggle',
|
|
98
|
+
label: 'Strict',
|
|
99
|
+
dataKey: 'strict',
|
|
100
|
+
helperMessage: 'Sets the strict parameter, which determines if OpenAI Structured Outputs are used.',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
type: 'code',
|
|
104
|
+
label: 'Description',
|
|
105
|
+
dataKey: 'description',
|
|
106
|
+
useInputToggleDataKey: 'useDescriptionInput',
|
|
107
|
+
language: 'markdown',
|
|
108
|
+
height: 100,
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: 'custom',
|
|
112
|
+
customEditorId: 'GptFunctionNodeJsonSchemaAiAssist',
|
|
113
|
+
label: 'AI Assist',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
type: 'code',
|
|
117
|
+
label: 'Schema',
|
|
118
|
+
dataKey: 'schema',
|
|
119
|
+
language: 'json',
|
|
120
|
+
useInputToggleDataKey: 'useSchemaInput',
|
|
121
|
+
},
|
|
122
|
+
];
|
|
123
|
+
}
|
|
124
|
+
getBody() {
|
|
125
|
+
return `!markdown_${this.data.name}_: ${this.data.description}`;
|
|
126
|
+
}
|
|
127
|
+
static getUIData() {
|
|
128
|
+
return {
|
|
129
|
+
infoBoxBody: dedent `
|
|
130
|
+
Defines a GPT function, which is a method that the LLM can call in its responses.
|
|
131
|
+
`,
|
|
132
|
+
infoBoxTitle: 'GPT Function Node',
|
|
133
|
+
contextMenuTitle: 'GPT Function',
|
|
134
|
+
group: ['AI'],
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
async process(inputs) {
|
|
138
|
+
const name = getInputOrData(this.data, inputs, 'name');
|
|
139
|
+
const description = getInputOrData(this.data, inputs, 'description');
|
|
140
|
+
let schema;
|
|
141
|
+
if (this.data.useSchemaInput) {
|
|
142
|
+
schema = coerceType(inputs['schema'], 'object');
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
const inputMap = keys(inputs)
|
|
146
|
+
.filter((key) => key.startsWith('input'))
|
|
147
|
+
.reduce((acc, key) => {
|
|
148
|
+
const stringValue = coerceTypeOptional(inputs[key], 'string') ?? '';
|
|
149
|
+
const interpolationKey = key.slice('input-'.length);
|
|
150
|
+
acc[interpolationKey] = stringValue;
|
|
151
|
+
return acc;
|
|
152
|
+
}, {});
|
|
153
|
+
const interpolated = interpolate(this.data.schema, inputMap);
|
|
154
|
+
schema = JSON.parse(interpolated);
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
['function']: {
|
|
158
|
+
type: 'gpt-function',
|
|
159
|
+
value: {
|
|
160
|
+
name,
|
|
161
|
+
description,
|
|
162
|
+
parameters: schema,
|
|
163
|
+
strict: this.data.strict ?? false,
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
export const gptFunctionNode = nodeDefinition(GptFunctionNodeImpl, 'GPT Function');
|
|
@@ -0,0 +1,130 @@
|
|
|
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 { getDefaultValue, isArrayDataType } from '../DataValue.js';
|
|
6
|
+
import {} from '../GraphProcessor.js';
|
|
7
|
+
import {} from '../ProcessContext.js';
|
|
8
|
+
import {} from '../../index.js';
|
|
9
|
+
import { dedent } from 'ts-dedent';
|
|
10
|
+
import { coerceTypeOptional, inferType } from '../../utils/coerceType.js';
|
|
11
|
+
export class GraphInputNodeImpl extends NodeImpl {
|
|
12
|
+
static create() {
|
|
13
|
+
const chartNode = {
|
|
14
|
+
type: 'graphInput',
|
|
15
|
+
title: 'Graph Input',
|
|
16
|
+
id: nanoid(),
|
|
17
|
+
visualData: {
|
|
18
|
+
x: 0,
|
|
19
|
+
y: 0,
|
|
20
|
+
width: 300,
|
|
21
|
+
},
|
|
22
|
+
data: {
|
|
23
|
+
id: 'input',
|
|
24
|
+
dataType: 'string',
|
|
25
|
+
defaultValue: undefined,
|
|
26
|
+
useDefaultValueInput: false,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
return chartNode;
|
|
30
|
+
}
|
|
31
|
+
getInputDefinitions() {
|
|
32
|
+
if (this.data.useDefaultValueInput) {
|
|
33
|
+
return [
|
|
34
|
+
{
|
|
35
|
+
id: 'default',
|
|
36
|
+
title: 'Default Value',
|
|
37
|
+
dataType: this.chartNode.data.dataType,
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
getOutputDefinitions() {
|
|
44
|
+
return [
|
|
45
|
+
{
|
|
46
|
+
id: 'data',
|
|
47
|
+
title: this.data.id,
|
|
48
|
+
dataType: this.chartNode.data.dataType,
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
getEditors() {
|
|
53
|
+
return [
|
|
54
|
+
{
|
|
55
|
+
type: 'string',
|
|
56
|
+
label: 'ID',
|
|
57
|
+
dataKey: 'id',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
type: 'dataTypeSelector',
|
|
61
|
+
label: 'Data Type',
|
|
62
|
+
dataKey: 'dataType',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: 'anyData',
|
|
66
|
+
label: 'Default Value',
|
|
67
|
+
dataKey: 'defaultValue',
|
|
68
|
+
useInputToggleDataKey: 'useDefaultValueInput',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
type: 'dropdown',
|
|
72
|
+
label: 'Editor',
|
|
73
|
+
dataKey: 'editor',
|
|
74
|
+
defaultValue: 'auto',
|
|
75
|
+
options: [
|
|
76
|
+
{ label: 'None', value: 'none' },
|
|
77
|
+
{ label: 'Auto', value: 'auto' },
|
|
78
|
+
{ label: 'String', value: 'string' },
|
|
79
|
+
{ label: 'Number', value: 'number' },
|
|
80
|
+
{ label: 'Code', value: 'code' },
|
|
81
|
+
{ label: 'Data Type', value: 'dataTypeSelector' },
|
|
82
|
+
{ label: 'String List', value: 'stringList' },
|
|
83
|
+
{ label: 'Key Value Pairs', value: 'keyValuePair' },
|
|
84
|
+
{ label: 'Toggle', value: 'toggle' },
|
|
85
|
+
],
|
|
86
|
+
helperMessage: 'The editor to use when editing this value in the UI. Make sure this matches the data type.',
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
getBody() {
|
|
91
|
+
return dedent `
|
|
92
|
+
${this.data.id}
|
|
93
|
+
Type: ${this.data.dataType}
|
|
94
|
+
${this.data.defaultValue == null ? '' : `Default: ${this.data.defaultValue}`}
|
|
95
|
+
`;
|
|
96
|
+
}
|
|
97
|
+
static getUIData() {
|
|
98
|
+
return {
|
|
99
|
+
infoBoxBody: dedent `
|
|
100
|
+
Defines an input for the graph which can be passed in when the graph is called, or defines one of the input ports when the graph is a subgraph.
|
|
101
|
+
`,
|
|
102
|
+
infoBoxTitle: 'Graph Input Node',
|
|
103
|
+
contextMenuTitle: 'Graph Input',
|
|
104
|
+
group: ['Input/Output'],
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
async process(inputs, context) {
|
|
108
|
+
let inputValue = context.graphInputs[this.data.id] == null
|
|
109
|
+
? undefined
|
|
110
|
+
: coerceTypeOptional(context.graphInputs[this.data.id], this.data.dataType);
|
|
111
|
+
if (inputValue == null && this.data.useDefaultValueInput) {
|
|
112
|
+
inputValue = coerceTypeOptional(inputs['default'], this.data.dataType);
|
|
113
|
+
}
|
|
114
|
+
if (inputValue == null) {
|
|
115
|
+
inputValue =
|
|
116
|
+
coerceTypeOptional(inferType(this.data.defaultValue), this.data.dataType) ||
|
|
117
|
+
getDefaultValue(this.data.dataType);
|
|
118
|
+
}
|
|
119
|
+
// Resolve undefined for array inputs to empty array
|
|
120
|
+
if (inputValue == null && isArrayDataType(this.data.dataType)) {
|
|
121
|
+
inputValue = { type: this.data.dataType, value: [] };
|
|
122
|
+
}
|
|
123
|
+
const value = {
|
|
124
|
+
type: this.data.dataType,
|
|
125
|
+
value: inputValue,
|
|
126
|
+
};
|
|
127
|
+
return { ['data']: value };
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
export const graphInputNode = nodeDefinition(GraphInputNodeImpl, 'Graph Input');
|
|
@@ -0,0 +1,104 @@
|
|
|
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 '../DataValue.js';
|
|
6
|
+
import {} from '../GraphProcessor.js';
|
|
7
|
+
import {} from '../ProcessContext.js';
|
|
8
|
+
import { dedent } from 'ts-dedent';
|
|
9
|
+
import {} from '../EditorDefinition.js';
|
|
10
|
+
import {} from '../NodeBodySpec.js';
|
|
11
|
+
export class GraphOutputNodeImpl extends NodeImpl {
|
|
12
|
+
static create() {
|
|
13
|
+
const chartNode = {
|
|
14
|
+
type: 'graphOutput',
|
|
15
|
+
title: 'Graph Output',
|
|
16
|
+
id: nanoid(),
|
|
17
|
+
visualData: {
|
|
18
|
+
x: 0,
|
|
19
|
+
y: 0,
|
|
20
|
+
width: 300,
|
|
21
|
+
},
|
|
22
|
+
data: {
|
|
23
|
+
id: 'output',
|
|
24
|
+
dataType: 'string',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
return chartNode;
|
|
28
|
+
}
|
|
29
|
+
getInputDefinitions() {
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
id: 'value',
|
|
33
|
+
title: this.data.id,
|
|
34
|
+
dataType: this.chartNode.data.dataType,
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
getOutputDefinitions() {
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
id: 'valueOutput',
|
|
42
|
+
title: this.data.id,
|
|
43
|
+
dataType: this.chartNode.data.dataType,
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
getEditors() {
|
|
48
|
+
return [
|
|
49
|
+
{
|
|
50
|
+
type: 'string',
|
|
51
|
+
label: 'ID',
|
|
52
|
+
dataKey: 'id',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: 'dataTypeSelector',
|
|
56
|
+
label: 'Data Type',
|
|
57
|
+
dataKey: 'dataType',
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
getBody() {
|
|
62
|
+
return dedent `
|
|
63
|
+
${this.data.id}
|
|
64
|
+
Type: ${this.data.dataType}
|
|
65
|
+
`;
|
|
66
|
+
}
|
|
67
|
+
static getUIData() {
|
|
68
|
+
return {
|
|
69
|
+
infoBoxBody: dedent `
|
|
70
|
+
Each instance of this node represents an individual output of the graph. The value passed into this node becomes part of the overall output of the graph.
|
|
71
|
+
`,
|
|
72
|
+
infoBoxTitle: 'Graph Output Node',
|
|
73
|
+
contextMenuTitle: 'Graph Output',
|
|
74
|
+
group: ['Input/Output'],
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
async process(inputs, context) {
|
|
78
|
+
const value = inputs['value'] ?? { type: 'any', value: undefined };
|
|
79
|
+
const isExcluded = value.type === 'control-flow-excluded';
|
|
80
|
+
if (isExcluded && context.graphOutputs[this.data.id] == null) {
|
|
81
|
+
context.graphOutputs[this.data.id] = {
|
|
82
|
+
type: 'control-flow-excluded',
|
|
83
|
+
value: undefined,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
else if ((context.graphOutputs[this.data.id] == null ||
|
|
87
|
+
context.graphOutputs[this.data.id]?.type === 'control-flow-excluded') &&
|
|
88
|
+
inputs['value']) {
|
|
89
|
+
context.graphOutputs[this.data.id] = value;
|
|
90
|
+
}
|
|
91
|
+
if (isExcluded) {
|
|
92
|
+
return {
|
|
93
|
+
['valueOutput']: {
|
|
94
|
+
type: 'control-flow-excluded',
|
|
95
|
+
value: undefined,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
['valueOutput']: context.graphOutputs[this.data.id],
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
export const graphOutputNode = nodeDefinition(GraphOutputNodeImpl, 'Graph Output');
|