Skip to main content
Execution context. Provides access to various information about the execution, to node execution config and to the DataStore.

Methods

getDatastore

getDatastore(): DataStore
Gets the DataStore for the execution.

Returns

DataStore

getEmbedderInterface

getEmbedderInterface(componentId: string): TextEmbedderInterface
Gets a TextEmbedderInterface for accessing remote text embedder components within custom nodes. Allows embedding text strings into numerical vector representations for similarity search, clustering, or ML applications.

Parameters

componentId
string
required
The ID of the text embedder component to access

Returns

TextEmbedderInterface

Example

const customNode = new CustomNode({
  id: 'my_node',
  process: async (input, context) => {
    const embedder = context.getEmbedderInterface('my_embedder');
    const embedding = await embedder.embed("Hello world");
    console.log(embedding.length);  // e.g., 768 dimensions
    return input;
  }
});

getExecutionConfig

getExecutionConfig<T = Record<string, any>>(): ExecutionConfig<T>
Gets the execution configuration for the node.

Type Parameters

T = Record<string, any>

Returns

ExecutionConfig<T> - The execution configuration

getExecutionId

getExecutionId(): string
Gets the execution ID from the context.

Returns

string - The execution ID

getLLMInterface

getLLMInterface(componentId: string): LLMInterface
Gets an LLMInterface for accessing LLM components within custom nodes. Provides methods for generating content using the specified LLM component.

Parameters

componentId
string
required
The ID of the LLM component to access

Returns

LLMInterface

Example

const customNode = new CustomNode({
  id: 'my_node',
  process: async (input, context) => {
    const llm = context.getLLMInterface('my_llm');
    const stream = await llm.generateContent("Tell me a joke");
    for await (const chunk of stream) {
      console.log(chunk);
    }
    return input;
  }
});

getVariant

getVariant(): string
Gets the variant string from the context.

Returns

string - The variant string