@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,145 @@
|
|
|
1
|
+
import {} from '../../../index.js';
|
|
2
|
+
import { dedent, newId, coerceTypeOptional, getInputOrData, coerceType } from '../../../utils/index.js';
|
|
3
|
+
import { interpolate } from '../../../utils/interpolation.js';
|
|
4
|
+
import { pluginNodeDefinition } from '../../../model/NodeDefinition.js';
|
|
5
|
+
import { mapValues } from 'lodash-es';
|
|
6
|
+
export const ThreadMessageNodeImpl = {
|
|
7
|
+
create() {
|
|
8
|
+
return {
|
|
9
|
+
id: newId(),
|
|
10
|
+
type: 'threadMessage',
|
|
11
|
+
data: {
|
|
12
|
+
text: '{{input}}',
|
|
13
|
+
fileIds: [],
|
|
14
|
+
useFileIdsInput: false,
|
|
15
|
+
metadata: [],
|
|
16
|
+
useMetadataInput: false,
|
|
17
|
+
},
|
|
18
|
+
title: 'Thread Message',
|
|
19
|
+
visualData: {
|
|
20
|
+
x: 0,
|
|
21
|
+
y: 0,
|
|
22
|
+
width: 225,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
getUIData() {
|
|
27
|
+
return {
|
|
28
|
+
group: 'OpenAI',
|
|
29
|
+
contextMenuTitle: 'Thread Message',
|
|
30
|
+
infoBoxTitle: 'Thread Message Node',
|
|
31
|
+
infoBoxBody: 'Create a new message for a thread.',
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
getInputDefinitions(data) {
|
|
35
|
+
let inputs = [];
|
|
36
|
+
if (data.useFileIdsInput) {
|
|
37
|
+
inputs.push({
|
|
38
|
+
id: 'fileIds',
|
|
39
|
+
dataType: 'string[]',
|
|
40
|
+
title: 'File IDs',
|
|
41
|
+
coerced: true,
|
|
42
|
+
defaultValue: [],
|
|
43
|
+
description: 'The IDs of the files to attach to the message.',
|
|
44
|
+
required: false,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
if (data.useMetadataInput) {
|
|
48
|
+
inputs.push({
|
|
49
|
+
id: 'metadata',
|
|
50
|
+
dataType: 'object',
|
|
51
|
+
title: 'Metadata',
|
|
52
|
+
coerced: true,
|
|
53
|
+
defaultValue: {},
|
|
54
|
+
description: 'Metadata to attach to the message.',
|
|
55
|
+
required: false,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
// Extract inputs from promptText, everything like {{input}}
|
|
59
|
+
const inputNames = [...new Set(data.text.match(/\{\{([^}]+)\}\}/g))];
|
|
60
|
+
inputs = [
|
|
61
|
+
...inputs,
|
|
62
|
+
...(inputNames?.map((inputName) => {
|
|
63
|
+
return {
|
|
64
|
+
// id and title should not have the {{ and }}
|
|
65
|
+
id: inputName.slice(2, -2),
|
|
66
|
+
title: inputName.slice(2, -2),
|
|
67
|
+
dataType: 'string',
|
|
68
|
+
required: false,
|
|
69
|
+
};
|
|
70
|
+
}) ?? []),
|
|
71
|
+
];
|
|
72
|
+
return inputs;
|
|
73
|
+
},
|
|
74
|
+
getOutputDefinitions() {
|
|
75
|
+
return [
|
|
76
|
+
{
|
|
77
|
+
id: 'message',
|
|
78
|
+
dataType: 'object',
|
|
79
|
+
title: 'Message',
|
|
80
|
+
description: 'The created message.',
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
},
|
|
84
|
+
getEditors() {
|
|
85
|
+
return [
|
|
86
|
+
{
|
|
87
|
+
type: 'code',
|
|
88
|
+
label: 'Text',
|
|
89
|
+
dataKey: 'text',
|
|
90
|
+
language: 'prompt-interpolation-markdown',
|
|
91
|
+
theme: 'prompt-interpolation',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: 'keyValuePair',
|
|
95
|
+
dataKey: 'metadata',
|
|
96
|
+
useInputToggleDataKey: 'useMetadataInput',
|
|
97
|
+
label: 'Metadata',
|
|
98
|
+
keyPlaceholder: 'Key',
|
|
99
|
+
valuePlaceholder: 'Value',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
type: 'stringList',
|
|
103
|
+
dataKey: 'fileIds',
|
|
104
|
+
useInputToggleDataKey: 'useFileIdsInput',
|
|
105
|
+
label: 'File IDs',
|
|
106
|
+
placeholder: 'File ID',
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
},
|
|
110
|
+
getBody(data) {
|
|
111
|
+
return {
|
|
112
|
+
type: 'colorized',
|
|
113
|
+
text: data.text.split('\n').slice(0, 15).join('\n').trim(),
|
|
114
|
+
language: 'prompt-interpolation-markdown',
|
|
115
|
+
theme: 'prompt-interpolation',
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
async process(data, inputData) {
|
|
119
|
+
const text = getInputOrData(data, inputData, 'text', 'string');
|
|
120
|
+
const fileIds = getInputOrData(data, inputData, 'fileIds', 'string[]') ?? [];
|
|
121
|
+
let metadata = data.metadata.reduce((acc, { key, value }) => {
|
|
122
|
+
acc[key] = value;
|
|
123
|
+
return acc;
|
|
124
|
+
}, {});
|
|
125
|
+
if (data.useMetadataInput && inputData['metadata']) {
|
|
126
|
+
metadata = coerceTypeOptional(inputData['metadata'], 'object');
|
|
127
|
+
}
|
|
128
|
+
const inputMap = mapValues(inputData, (input) => coerceType(input, 'string'));
|
|
129
|
+
const interpolated = interpolate(text, inputMap);
|
|
130
|
+
// Here you would typically make a call to an API to create the message
|
|
131
|
+
// For the sake of this example, we'll just return the data as is
|
|
132
|
+
return {
|
|
133
|
+
['message']: {
|
|
134
|
+
type: 'object',
|
|
135
|
+
value: {
|
|
136
|
+
role: 'user',
|
|
137
|
+
content: interpolated,
|
|
138
|
+
file_ids: fileIds,
|
|
139
|
+
metadata,
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
export const threadMessageNode = pluginNodeDefinition(ThreadMessageNodeImpl, 'Thread Message');
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import {} from '../../../index.js';
|
|
2
|
+
import { newId, dedent, getInputOrData, coerceType, coerceTypeOptional } from '../../../utils/index.js';
|
|
3
|
+
import { pluginNodeDefinition } from '../../../model/NodeDefinition.js';
|
|
4
|
+
import { handleOpenAIError } from '../handleOpenaiError.js';
|
|
5
|
+
import { openAIFileUploadPurposeOptions } from '../../../utils/openai.js';
|
|
6
|
+
export const UploadFileNodeImpl = {
|
|
7
|
+
create() {
|
|
8
|
+
return {
|
|
9
|
+
id: newId(),
|
|
10
|
+
type: 'openaiUploadFile',
|
|
11
|
+
data: {
|
|
12
|
+
purpose: 'assistants',
|
|
13
|
+
},
|
|
14
|
+
title: 'Upload File to OpenAI',
|
|
15
|
+
visualData: {
|
|
16
|
+
x: 0,
|
|
17
|
+
y: 0,
|
|
18
|
+
width: 300,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
getUIData() {
|
|
23
|
+
return {
|
|
24
|
+
group: 'OpenAI',
|
|
25
|
+
contextMenuTitle: 'Upload File to OpenAI',
|
|
26
|
+
infoBoxTitle: 'Upload File to OpenAI Node',
|
|
27
|
+
infoBoxBody: 'Upload a file to OpenAI.',
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
getInputDefinitions() {
|
|
31
|
+
const inputs = [];
|
|
32
|
+
inputs.push({
|
|
33
|
+
id: 'data',
|
|
34
|
+
dataType: 'binary',
|
|
35
|
+
title: 'Data',
|
|
36
|
+
coerced: true,
|
|
37
|
+
defaultValue: '',
|
|
38
|
+
description: 'The binary data of the file to upload.',
|
|
39
|
+
required: true,
|
|
40
|
+
});
|
|
41
|
+
inputs.push({
|
|
42
|
+
id: 'file-name',
|
|
43
|
+
dataType: 'string',
|
|
44
|
+
title: 'File Name',
|
|
45
|
+
coerced: true,
|
|
46
|
+
description: 'An optional file name to use for the uploaded file.',
|
|
47
|
+
required: false,
|
|
48
|
+
});
|
|
49
|
+
return inputs;
|
|
50
|
+
},
|
|
51
|
+
getOutputDefinitions() {
|
|
52
|
+
return [
|
|
53
|
+
{
|
|
54
|
+
id: 'fileId',
|
|
55
|
+
dataType: 'string',
|
|
56
|
+
title: 'File ID',
|
|
57
|
+
description: 'The ID of the uploaded file.',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'file',
|
|
61
|
+
dataType: 'object',
|
|
62
|
+
title: 'File',
|
|
63
|
+
description: 'The full uploaded file object.',
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
},
|
|
67
|
+
getEditors() {
|
|
68
|
+
return [
|
|
69
|
+
{
|
|
70
|
+
type: 'dropdown',
|
|
71
|
+
dataKey: 'purpose',
|
|
72
|
+
label: 'Purpose',
|
|
73
|
+
options: openAIFileUploadPurposeOptions,
|
|
74
|
+
defaultValue: 'assistants',
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
},
|
|
78
|
+
getBody(data) {
|
|
79
|
+
return dedent `
|
|
80
|
+
Purpose: ${openAIFileUploadPurposeOptions.find(({ value }) => value === data.purpose)?.label ?? 'Unknown'}
|
|
81
|
+
`;
|
|
82
|
+
},
|
|
83
|
+
async process(data, inputData, context) {
|
|
84
|
+
const purpose = getInputOrData(data, inputData, 'purpose');
|
|
85
|
+
const fileData = coerceType(inputData['data'], 'binary');
|
|
86
|
+
const fileName = coerceTypeOptional(inputData['file-name'], 'string');
|
|
87
|
+
if (!fileData) {
|
|
88
|
+
throw new Error('File data is required.');
|
|
89
|
+
}
|
|
90
|
+
if (!context.settings.openAiKey) {
|
|
91
|
+
throw new Error('OpenAI key is not set.');
|
|
92
|
+
}
|
|
93
|
+
const file = fileName
|
|
94
|
+
? new File([fileData], fileName, { type: 'application/octet-stream' })
|
|
95
|
+
: new Blob([fileData], { type: 'application/octet-stream' });
|
|
96
|
+
const formData = new FormData();
|
|
97
|
+
formData.append('purpose', purpose);
|
|
98
|
+
formData.append('file', file);
|
|
99
|
+
const response = await fetch('https://api.openai.com/v1/files', {
|
|
100
|
+
method: 'POST',
|
|
101
|
+
headers: {
|
|
102
|
+
Authorization: `Bearer ${context.settings.openAiKey}`,
|
|
103
|
+
'OpenAI-Organization': context.settings.openAiOrganization ?? '',
|
|
104
|
+
},
|
|
105
|
+
body: formData,
|
|
106
|
+
});
|
|
107
|
+
await handleOpenAIError(response);
|
|
108
|
+
const body = await response.json();
|
|
109
|
+
return {
|
|
110
|
+
['fileId']: {
|
|
111
|
+
type: 'string',
|
|
112
|
+
value: body.id,
|
|
113
|
+
},
|
|
114
|
+
['file']: {
|
|
115
|
+
type: 'object',
|
|
116
|
+
value: body,
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
export const uploadFileNode = pluginNodeDefinition(UploadFileNodeImpl, 'Upload File to OpenAI');
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {} from '../../index.js';
|
|
2
|
+
import { createThreadNode } from './nodes/CreateThreadNode.js';
|
|
3
|
+
import { getThreadNode } from './nodes/GetThreadNode.js';
|
|
4
|
+
import { deleteThreadNode } from './nodes/DeleteThreadNode.js';
|
|
5
|
+
import { createAssistantNode } from './nodes/CreateAssistantNode.js';
|
|
6
|
+
import { getAssistantNode } from './nodes/GetAssistantNode.js';
|
|
7
|
+
import { listAssistantsNode } from './nodes/ListAssistantsNode.js';
|
|
8
|
+
import { deleteAssistantNode } from './nodes/DeleteAssistantNode.js';
|
|
9
|
+
import { uploadFileNode } from './nodes/UploadFileNode.js';
|
|
10
|
+
import { listOpenAIFilesNode } from './nodes/ListOpenAIFilesNode.js';
|
|
11
|
+
import { getOpenAIFileNode } from './nodes/GetOpenAIFileNode.js';
|
|
12
|
+
import { attachAssistantFileNode } from './nodes/AttachAssistantFileNode.js';
|
|
13
|
+
import { createThreadMessageNode } from './nodes/CreateThreadMessageNode.js';
|
|
14
|
+
import { listThreadMessagesNode } from './nodes/ListThreadMessagesNode.js';
|
|
15
|
+
import { runThreadNode } from './nodes/RunThreadNode.js';
|
|
16
|
+
import { threadMessageNode } from './nodes/ThreadMessageNode.js';
|
|
17
|
+
export const openAIPlugin = {
|
|
18
|
+
id: 'openai',
|
|
19
|
+
name: 'OpenAI',
|
|
20
|
+
configSpec: {},
|
|
21
|
+
contextMenuGroups: [
|
|
22
|
+
{
|
|
23
|
+
id: 'openai',
|
|
24
|
+
label: 'OpenAI',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
register(register) {
|
|
28
|
+
register(createThreadNode);
|
|
29
|
+
register(getThreadNode);
|
|
30
|
+
register(deleteThreadNode);
|
|
31
|
+
register(createAssistantNode);
|
|
32
|
+
register(getAssistantNode);
|
|
33
|
+
register(listAssistantsNode);
|
|
34
|
+
register(deleteAssistantNode);
|
|
35
|
+
register(uploadFileNode);
|
|
36
|
+
register(listOpenAIFilesNode);
|
|
37
|
+
register(getOpenAIFileNode);
|
|
38
|
+
register(attachAssistantFileNode);
|
|
39
|
+
register(createThreadMessageNode);
|
|
40
|
+
register(listThreadMessagesNode);
|
|
41
|
+
register(runThreadNode);
|
|
42
|
+
register(threadMessageNode);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import {} from '../../index.js';
|
|
2
|
+
import * as CryptoJS from 'crypto-js';
|
|
3
|
+
import { coerceType } from '../../utils/coerceType.js';
|
|
4
|
+
export class PineconeVectorDatabase {
|
|
5
|
+
#apiKey;
|
|
6
|
+
constructor(settings) {
|
|
7
|
+
this.#apiKey = settings.pluginSettings?.pinecone?.pineconeApiKey;
|
|
8
|
+
}
|
|
9
|
+
async store(collection, vector, data, { id }) {
|
|
10
|
+
const collectionDetails = getCollection(coerceType(collection, 'string'));
|
|
11
|
+
if (!id) {
|
|
12
|
+
id = CryptoJS.SHA256(vector.value.join(',')).toString(CryptoJS.enc.Hex);
|
|
13
|
+
}
|
|
14
|
+
let metadata = {};
|
|
15
|
+
if (data.type === 'object') {
|
|
16
|
+
metadata = data.value;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
metadata = { data: data.value };
|
|
20
|
+
}
|
|
21
|
+
const response = await fetch(`${collectionDetails.host}/vectors/upsert`, {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
body: JSON.stringify({
|
|
24
|
+
vectors: [
|
|
25
|
+
{
|
|
26
|
+
id,
|
|
27
|
+
values: vector.value,
|
|
28
|
+
metadata,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
...collectionDetails.options,
|
|
32
|
+
}),
|
|
33
|
+
headers: {
|
|
34
|
+
'Content-Type': 'application/json',
|
|
35
|
+
Accept: 'application/json',
|
|
36
|
+
'api-key': this.#apiKey,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
if (response.status !== 200) {
|
|
40
|
+
throw new Error(`Pinecone error: ${await response.text()}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async nearestNeighbors(collection, vector, k) {
|
|
44
|
+
const collectionDetails = getCollection(coerceType(collection, 'string'));
|
|
45
|
+
const response = await fetch(`${collectionDetails.host}/query`, {
|
|
46
|
+
method: 'POST',
|
|
47
|
+
body: JSON.stringify({
|
|
48
|
+
vector: vector.value,
|
|
49
|
+
topK: k,
|
|
50
|
+
includeMetadata: true,
|
|
51
|
+
...collectionDetails.options,
|
|
52
|
+
}),
|
|
53
|
+
headers: {
|
|
54
|
+
'Content-Type': 'application/json',
|
|
55
|
+
Accept: 'application/json',
|
|
56
|
+
'api-key': this.#apiKey,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
if (response.status !== 200) {
|
|
60
|
+
throw new Error(`Pinecone error: ${await response.text()}`);
|
|
61
|
+
}
|
|
62
|
+
const responseData = await response.json();
|
|
63
|
+
const { matches } = responseData;
|
|
64
|
+
return {
|
|
65
|
+
type: 'object[]',
|
|
66
|
+
value: matches.map(({ id, metadata }) => ({ id, data: metadata.data, metadata })),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function getCollection(collectionString) {
|
|
71
|
+
let collectionURL;
|
|
72
|
+
if (!collectionString.startsWith('http://') && !collectionString.startsWith('https://')) {
|
|
73
|
+
collectionString = `https://${collectionString}`;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
collectionURL = new URL(collectionString);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
throw new Error(`Incorrectly formatted Pinecone collection: ${error}`);
|
|
80
|
+
}
|
|
81
|
+
const host = `${collectionURL.protocol}//${collectionURL.host}`;
|
|
82
|
+
const options = {};
|
|
83
|
+
if (collectionURL.pathname !== '/') {
|
|
84
|
+
// Chop off the leading slash.
|
|
85
|
+
options.namespace = collectionURL.pathname.slice(1);
|
|
86
|
+
}
|
|
87
|
+
return { host, options };
|
|
88
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {} from '../../index.js';
|
|
2
|
+
import { PineconeVectorDatabase } from './PineconeVectorDatabase.js';
|
|
3
|
+
import { registerIntegration } from '../../integrations/integrations.js';
|
|
4
|
+
export const pineconePlugin = {
|
|
5
|
+
id: 'pinecone',
|
|
6
|
+
name: 'Pinecone',
|
|
7
|
+
register: () => {
|
|
8
|
+
registerIntegration('vectorDatabase', 'pinecone', (context) => new PineconeVectorDatabase(context.settings));
|
|
9
|
+
},
|
|
10
|
+
configSpec: {
|
|
11
|
+
pineconeApiKey: {
|
|
12
|
+
type: 'secret',
|
|
13
|
+
label: 'Pinecone API Key',
|
|
14
|
+
description: 'The API key for the Pinecone service.',
|
|
15
|
+
pullEnvironmentVariable: 'PINECONE_API_KEY',
|
|
16
|
+
helperText: 'You may also set the PINECONE_API_KEY environment variable.',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import aidonPlugin from './plugins/aidon/index.js';
|
|
2
|
+
import anthropicPlugin from './plugins/anthropic/index.js';
|
|
3
|
+
import autoevalsPlugin from './plugins/autoevals/index.js';
|
|
4
|
+
import assemblyAiPlugin from './plugins/assemblyAi/index.js';
|
|
5
|
+
import { huggingFacePlugin } from './plugins/huggingface/plugin.js';
|
|
6
|
+
import pineconePlugin from './plugins/pinecone/index.js';
|
|
7
|
+
import gentracePlugin from './plugins/gentrace/index.js';
|
|
8
|
+
import { openAIPlugin } from './plugins/openai/plugin.js';
|
|
9
|
+
import { googlePlugin } from './plugins/google/plugin.js';
|
|
10
|
+
export { aidonPlugin, anthropicPlugin, autoevalsPlugin, assemblyAiPlugin, pineconePlugin, huggingFacePlugin, gentracePlugin, googlePlugin, };
|
|
11
|
+
export const plugins = {
|
|
12
|
+
aidon: aidonPlugin,
|
|
13
|
+
anthropic: anthropicPlugin,
|
|
14
|
+
autoevals: autoevalsPlugin,
|
|
15
|
+
assemblyAi: assemblyAiPlugin,
|
|
16
|
+
pinecone: pineconePlugin,
|
|
17
|
+
huggingFace: huggingFacePlugin,
|
|
18
|
+
gentrace: gentracePlugin,
|
|
19
|
+
openai: openAIPlugin,
|
|
20
|
+
google: googlePlugin,
|
|
21
|
+
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { nanoid } from 'nanoid/non-secure';
|
|
2
|
+
import {} from '../index.js';
|
|
3
|
+
import Emittery from 'emittery';
|
|
4
|
+
const toRecordedEventMap = {
|
|
5
|
+
graphStart: ({ graph, inputs }) => ({ graphId: graph.metadata.id, inputs }),
|
|
6
|
+
graphFinish: ({ graph, outputs }) => ({ graphId: graph.metadata.id, outputs }),
|
|
7
|
+
graphError: ({ graph, error }) => ({
|
|
8
|
+
graphId: graph.metadata.id,
|
|
9
|
+
error: typeof error === 'string' ? error : error.stack,
|
|
10
|
+
}),
|
|
11
|
+
nodeStart: ({ node, inputs, processId }) => ({
|
|
12
|
+
nodeId: node.id,
|
|
13
|
+
inputs,
|
|
14
|
+
processId,
|
|
15
|
+
}),
|
|
16
|
+
nodeFinish: ({ node, outputs, processId }) => ({
|
|
17
|
+
nodeId: node.id,
|
|
18
|
+
outputs,
|
|
19
|
+
processId,
|
|
20
|
+
}),
|
|
21
|
+
nodeError: ({ node, error, processId }) => ({
|
|
22
|
+
nodeId: node.id,
|
|
23
|
+
error: typeof error === 'string' ? error : error.stack,
|
|
24
|
+
processId,
|
|
25
|
+
}),
|
|
26
|
+
abort: ({ successful, error }) => ({ successful, error: typeof error === 'string' ? error : error?.stack }),
|
|
27
|
+
graphAbort: ({ successful, error, graph }) => ({
|
|
28
|
+
successful,
|
|
29
|
+
error: typeof error === 'string' ? error : error?.stack,
|
|
30
|
+
graphId: graph.metadata.id,
|
|
31
|
+
}),
|
|
32
|
+
nodeExcluded: ({ node, processId, inputs, outputs, reason }) => ({
|
|
33
|
+
nodeId: node.id,
|
|
34
|
+
processId,
|
|
35
|
+
inputs,
|
|
36
|
+
outputs,
|
|
37
|
+
reason,
|
|
38
|
+
}),
|
|
39
|
+
userInput: ({ node, inputs, callback, processId }) => ({
|
|
40
|
+
nodeId: node.id,
|
|
41
|
+
inputs,
|
|
42
|
+
callback,
|
|
43
|
+
processId,
|
|
44
|
+
}),
|
|
45
|
+
partialOutput: ({ node, outputs, index, processId }) => ({
|
|
46
|
+
nodeId: node.id,
|
|
47
|
+
outputs,
|
|
48
|
+
index,
|
|
49
|
+
processId,
|
|
50
|
+
}),
|
|
51
|
+
nodeOutputsCleared: ({ node, processId }) => ({
|
|
52
|
+
nodeId: node.id,
|
|
53
|
+
processId,
|
|
54
|
+
}),
|
|
55
|
+
error: ({ error }) => ({
|
|
56
|
+
error: typeof error === 'string' ? error : error.stack,
|
|
57
|
+
}),
|
|
58
|
+
done: ({ results }) => ({ results }),
|
|
59
|
+
globalSet: ({ id, processId, value }) => ({ id, processId, value }),
|
|
60
|
+
pause: () => void 0,
|
|
61
|
+
resume: () => void 0,
|
|
62
|
+
start: ({ contextValues, inputs, project, startGraph }) => ({
|
|
63
|
+
contextValues,
|
|
64
|
+
inputs,
|
|
65
|
+
projectId: project.metadata.id,
|
|
66
|
+
startGraph: startGraph.metadata.id,
|
|
67
|
+
}),
|
|
68
|
+
trace: (message) => message,
|
|
69
|
+
newAbortController: () => { },
|
|
70
|
+
finish: () => void 0,
|
|
71
|
+
};
|
|
72
|
+
const isPrefix = (s, prefix) => s.startsWith(prefix);
|
|
73
|
+
function toRecordedEvent(event, data) {
|
|
74
|
+
if (isPrefix(event, 'globalSet:')) {
|
|
75
|
+
return {
|
|
76
|
+
type: event,
|
|
77
|
+
data: data,
|
|
78
|
+
ts: Date.now(),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (isPrefix(event, 'userEvent:')) {
|
|
82
|
+
return {
|
|
83
|
+
type: event,
|
|
84
|
+
data: data,
|
|
85
|
+
ts: Date.now(),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
type: event,
|
|
90
|
+
data: toRecordedEventMap[event](data),
|
|
91
|
+
ts: Date.now(),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export class ExecutionRecorder {
|
|
95
|
+
#events = [];
|
|
96
|
+
recordingId;
|
|
97
|
+
#emitter;
|
|
98
|
+
#includePartialOutputs;
|
|
99
|
+
#includeTrace;
|
|
100
|
+
constructor(options = {}) {
|
|
101
|
+
this.#emitter = new Emittery();
|
|
102
|
+
this.#emitter.bindMethods(this, ['on', 'off', 'once']);
|
|
103
|
+
this.#includePartialOutputs = options.includePartialOutputs ?? false;
|
|
104
|
+
this.#includeTrace = options.includeTrace ?? false;
|
|
105
|
+
}
|
|
106
|
+
on = undefined;
|
|
107
|
+
off = undefined;
|
|
108
|
+
once = undefined;
|
|
109
|
+
recordSocket(channel) {
|
|
110
|
+
return new Promise((resolve, reject) => {
|
|
111
|
+
this.recordingId = nanoid();
|
|
112
|
+
const listener = (event) => {
|
|
113
|
+
const { message, data } = JSON.parse(event.data);
|
|
114
|
+
if (this.#includePartialOutputs === false && message === 'partialOutput') {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (this.#includeTrace === false && message === 'trace') {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
this.#events.push(toRecordedEvent(message, data));
|
|
121
|
+
if (message === 'done' || message === 'abort' || message === 'error') {
|
|
122
|
+
this.#emitter.emit('finish', {
|
|
123
|
+
recording: this.getRecording(),
|
|
124
|
+
});
|
|
125
|
+
channel.removeEventListener('message', listener);
|
|
126
|
+
resolve();
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
channel.addEventListener('message', listener);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
record(processor) {
|
|
133
|
+
this.recordingId = nanoid();
|
|
134
|
+
processor.onAny((event, data) => {
|
|
135
|
+
if (this.#includePartialOutputs === false && event === 'partialOutput') {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (this.#includeTrace === false && event === 'trace') {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
this.#events.push(toRecordedEvent(event, data));
|
|
142
|
+
if (event === 'done' || event === 'abort' || event === 'error') {
|
|
143
|
+
this.#emitter.emit('finish', {
|
|
144
|
+
recording: this.getRecording(),
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
getRecording() {
|
|
150
|
+
return {
|
|
151
|
+
recordingId: this.recordingId,
|
|
152
|
+
events: this.#events,
|
|
153
|
+
startTs: this.#events[0]?.ts ?? 0,
|
|
154
|
+
finishTs: this.#events[this.#events.length - 1]?.ts ?? 0,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
get events() {
|
|
158
|
+
return this.#events;
|
|
159
|
+
}
|
|
160
|
+
static deserializeFromString(serialized) {
|
|
161
|
+
const recorder = new ExecutionRecorder();
|
|
162
|
+
const serializedRecording = JSON.parse(serialized);
|
|
163
|
+
if (serializedRecording.version !== 1) {
|
|
164
|
+
throw new Error('Unsupported serialized events version');
|
|
165
|
+
}
|
|
166
|
+
recorder.recordingId = serializedRecording.recording.recordingId;
|
|
167
|
+
recorder.#events = serializedRecording.recording.events;
|
|
168
|
+
return recorder;
|
|
169
|
+
}
|
|
170
|
+
serialize() {
|
|
171
|
+
const serialized = {
|
|
172
|
+
version: 1,
|
|
173
|
+
recording: this.getRecording(),
|
|
174
|
+
};
|
|
175
|
+
return JSON.stringify(serialized);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {} from '../index.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export async function uint8ArrayToBase64(uint8Array) {
|
|
2
|
+
if (typeof window === 'undefined') {
|
|
3
|
+
// Node executor
|
|
4
|
+
return Buffer.from(uint8Array).toString('base64');
|
|
5
|
+
}
|
|
6
|
+
else {
|
|
7
|
+
// Browser executor
|
|
8
|
+
const blob = new Blob([uint8Array], { type: 'application/octet-stream' });
|
|
9
|
+
const dataUrl = await new Promise((resolve) => {
|
|
10
|
+
const reader = new FileReader();
|
|
11
|
+
reader.onload = () => resolve(reader.result);
|
|
12
|
+
reader.readAsDataURL(blob);
|
|
13
|
+
});
|
|
14
|
+
return dataUrl.split(',')[1];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function base64ToUint8Array(base64) {
|
|
18
|
+
const binaryString = atob(base64);
|
|
19
|
+
const len = binaryString.length;
|
|
20
|
+
const bytes = new Uint8Array(len);
|
|
21
|
+
for (let i = 0; i < len; i++) {
|
|
22
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
23
|
+
}
|
|
24
|
+
return bytes;
|
|
25
|
+
}
|