docs(api): Add documentation for `extract_variable_selector_to_variable_mapping`

Add a detail description about the arguments and
the return value of
`BaseNode.extract_variable_selector_to_variable_mapping`.
pull/20699/head
QuantumGhost 1 year ago
parent 85ab1dc8d9
commit c4e7489be5

@ -90,8 +90,28 @@ class BaseNode(Generic[GenericNodeData]):
graph_config: Mapping[str, Any], graph_config: Mapping[str, Any],
config: Mapping[str, Any], config: Mapping[str, Any],
) -> Mapping[str, Sequence[str]]: ) -> Mapping[str, Sequence[str]]:
""" """Extracts references variable selectors from node configuration.
Extract variable selector to variable mapping
The `config` parameter represents the configuration for a specific node type and corresponds
to the `data` field in the node definition object.
The returned mapping has the following structure:
{'1747829548239.#1747829667553.result#': ['1747829667553', 'result']}
Here, the key consists of two parts: the current node ID (provided as the `node_id`
parameter to `_extract_variable_selector_to_variable_mapping`) and the variable selector,
enclosed in `#` symbols. These two parts are separated by a dot (`.`).
The value is a list of string representing the variable selector, where the first element is the node ID
of the referenced variable, and the second element is the variable name within that node.
The meaning of the above response is:
The node with ID `1747829548239` references the variable `result` from the node with
ID `1747829667553`. For example, if `1747829548239` is a LLM node, its prompt may contain a
reference to the `result` output variable of node `1747829667553`.
:param graph_config: graph config :param graph_config: graph config
:param config: node config :param config: node config
:return: :return:

Loading…
Cancel
Save