Skip to main content

module aixplain.modules.pipeline.designer.pipeline


class DesignerPipeline

method __init__

__init__()

add_link(link: Link) → Link

Add a link to the current pipeline. :param link: the link :return: the link


method add_node

add_node(node: Node)

Add a node to the current pipeline.

This method will take care of setting the pipeline instance to the node and setting the node number if it's not set.

:param node: the node :return: the node


method add_nodes

add_nodes(*nodes: Node) → List[Node]

Add multiple nodes to the current pipeline.

:param nodes: the nodes :return: the nodes


method asset

asset(
asset_id: str,
*args,
asset_class: Type[~T] = <class 'aixplain.modules.pipeline.designer.nodes.AssetNode'>,
**kwargs
)~T

Shortcut to create an asset node for the current pipeline. All params will be passed as keyword arguments to the node constructor.

:param kwargs: keyword arguments :return: the node


method auto_infer

auto_infer()

Automatically infer the data types of the nodes in the pipeline. This method will automatically infer the data types of the nodes in the pipeline by traversing the pipeline and setting the data types of the nodes based on the data types of the connected nodes.


method bare_reconstructor

bare_reconstructor(*args, **kwargs) → BareReconstructor

Shortcut to create an reconstructor node for the current pipeline. All params will be passed as keyword arguments to the node constructor.

:param kwargs: keyword arguments :return: the node


method bare_segmentor

bare_segmentor(*args, **kwargs) → BareSegmentor

Shortcut to create an segmentor node for the current pipeline. All params will be passed as keyword arguments to the node constructor.

:param kwargs: keyword arguments :return: the node


method decision

decision(*args, **kwargs) → Decision

Shortcut to create an decision node for the current pipeline. All params will be passed as keyword arguments to the node constructor.

:param kwargs: keyword arguments :return: the node


get_link(from_node: int, to_node: int) → Link

Get the link between two nodes. This method will return the link between two nodes.

:param from_node: the from node number :param to_node: the to node number :return: the link


method get_node

get_node(node_number: int) → Node

Get the node by its number. This method will return the node with the given number.

:param node_number: the node number :return: the node


method input

input(*args, **kwargs) → Input

Shortcut to create an input node for the current pipeline. All params will be passed as keyword arguments to the node constructor.

:param kwargs: keyword arguments :return: the node


method is_param_linked

is_param_linked(node, param)

Check if the param is linked to another node. This method will check if the param is linked to another node. :param node: the node :param param: the param :return: True if the param is linked, False otherwise


method is_param_set

is_param_set(node, param)

Check if the param is set. This method will check if the param is set or linked to another node. :param node: the node :param param: the param :return: True if the param is set, False otherwise


method metric

metric(*args, **kwargs) → BareMetric

Shortcut to create an metric node for the current pipeline. All params will be passed as keyword arguments to the node constructor.

:param kwargs: keyword arguments :return: the node


method output

output(*args, **kwargs) → Output

Shortcut to create an output node for the current pipeline. All params will be passed as keyword arguments to the node constructor.

:param kwargs: keyword arguments :return: the node


method router

router(routes: Tuple[DataType, Node], *args, **kwargs) → Router

Shortcut to create an decision node for the current pipeline. All params will be passed as keyword arguments to the node constructor. The routes will be handled specially and will be converted to Route instances in a convenient way.

:param routes: the routes :param kwargs: keyword arguments :return: the node


method script

script(*args, **kwargs) → Script

Shortcut to create an script node for the current pipeline. All params will be passed as keyword arguments to the node constructor.

:param kwargs: keyword arguments :return: the node


method serialize

serialize()dict

Serialize the pipeline to a dictionary. This method will serialize the pipeline to a dictionary.

:return: the pipeline as a dictionary


method special_prompt_validation

special_prompt_validation(node: Node)

This method will handle the special rule for asset nodes having text-generation function type where if any prompt variable exists then the text param is not required but the prompt param are.

:param node: the node :raises ValueError: if the pipeline is not valid


method validate

validate()

Validate the pipeline. This method will validate the pipeline by series of checks:

  • Validate all nodes are linked correctly
  • Validate all required params are set or linked

Any other validation checks can be added here.

:raises ValueError: if the pipeline is not valid


method validate_nodes

validate_nodes()

Validate the linkage of the pipeline. This method will validate the linkage of the pipeline by applying the following checks:

  • All input nodes are linked out
  • All output nodes are linked in
  • All other nodes are linked in and out

:raises ValueError: if the pipeline is not valid


method validate_params

validate_params()

This method will check if all required params are either set or linked

:raises ValueError: if the pipeline is not valid