Class EmbeddingExecutor
java.lang.Object
ai.nervemind.app.executor.EmbeddingExecutor
- All Implemented Interfaces:
NodeExecutor
Executor for the "embedding" node type - generates vector embeddings for
text.
Creates dense vector representations of text using embedding models from various providers. Essential for semantic search, similarity matching, and building RAG (Retrieval-Augmented Generation) pipelines.
Node Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| provider | String | "openai" | "openai", "ollama", "azure", "cohere" |
| model | String | provider-specific | Embedding model name |
| apiKey | String | from settings | API key for the provider |
| baseUrl | String | provider default | Custom base URL |
| input | String/List | - | Text(s) to embed (supports ${interpolation}) |
| dimensions | Integer | model default | Output dimensions (for dimension reduction) |
| timeout | Integer | 60 | Request timeout in seconds |
Supported Models
- OpenAI: text-embedding-3-small, text-embedding-3-large, text-embedding-ada-002
- Ollama: nomic-embed-text, mxbai-embed-large, all-minilm
- Cohere: embed-english-v3.0, embed-multilingual-v3.0
Output Data
| Key | Type | Description |
|---|---|---|
| embedding | List<Double> | Vector embedding (or list of vectors for batch) |
| dimensions | Integer | Number of dimensions in the vector |
| model | String | Model that was used |
| usage | Map | Token usage information |
Batch Processing
When input is a list of strings, embeddings are generated for each
item in a single API call (if supported by provider), improving efficiency.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecute(ai.nervemind.common.domain.Node node, Map<String, Object> input, ExecutionService.ExecutionContext context) Executes the business logic for this node type.Unique identifier for the node type this executor handles.
-
Constructor Details
-
EmbeddingExecutor
public EmbeddingExecutor()Default constructor for EmbeddingExecutor. Initializes the HttpClient with a 30-second connection timeout.
-
-
Method Details
-
execute
public Map<String,Object> execute(ai.nervemind.common.domain.Node node, Map<String, Object> input, ExecutionService.ExecutionContext context) Description copied from interface:NodeExecutorExecutes the business logic for this node type.- Specified by:
executein interfaceNodeExecutor- Parameters:
node- The node definition containing parameters and configuration. UseNode.parameters()to access user settings.input- Combined output from all upstream nodes that connected to this node. For simple flows, this contains the direct predecessor's output. For merge nodes, it contains combined data.context- Verification context providing access to workflow-scoped services, logger, and execution metadata.- Returns:
- A Map containing the results of this node's execution.
Keys in this map become available variables for downstream nodes.
Note: Returningnullis treated as an empty map.
-
getNodeType
Description copied from interface:NodeExecutorUnique identifier for the node type this executor handles. This must match the 'type' field in the JSON definition of the node.- Specified by:
getNodeTypein interfaceNodeExecutor- Returns:
- the node type identifier ("embedding")
-