Class EmbeddingExecutor

java.lang.Object
ai.nervemind.app.executor.EmbeddingExecutor
All Implemented Interfaces:
NodeExecutor

@Component public class EmbeddingExecutor extends Object implements 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

Embedding node configuration 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

Output keys added by this executor
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 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: NodeExecutor
      Executes the business logic for this node type.
      Specified by:
      execute in interface NodeExecutor
      Parameters:
      node - The node definition containing parameters and configuration. Use Node.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: Returning null is treated as an empty map.
    • getNodeType

      public String getNodeType()
      Description copied from interface: NodeExecutor
      Unique identifier for the node type this executor handles. This must match the 'type' field in the JSON definition of the node.
      Specified by:
      getNodeType in interface NodeExecutor
      Returns:
      the node type identifier ("embedding")