Skip to main content
Version: 1.0

aixplain.modules.pipeline.designer.pipeline

DesignerPipeline Objects

class DesignerPipeline(Serializable)

[view_source]

add_node

def add_node(node: Node)

[view_source]

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.

Arguments:

  • node: the node

Returns:

the node

add_nodes

def add_nodes(*nodes: Node) -> List[Node]

[view_source]

Add multiple nodes to the current pipeline.

Arguments:

  • nodes: the nodes

Returns:

the nodes

def add_link(link: Link) -> Link

[view_source]

Add a link to the current pipeline.

Arguments:

  • link: the link

Returns:

the link

serialize

def serialize() -> dict

[view_source]

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

pipeline to a dictionary.

Returns:

the pipeline as a dictionary

validate_nodes

def validate_nodes()

[view_source]

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

is_param_linked

def is_param_linked(node, param)

[view_source]

Check if the param is linked to another node. This method will check

if the param is linked to another node.

Arguments:

  • node: the node
  • param: the param

Returns:

True if the param is linked, False otherwise

is_param_set

def is_param_set(node, param)

[view_source]

Check if the param is set. This method will check if the param is set

or linked to another node.

Arguments:

  • node: the node
  • param: the param

Returns:

True if the param is set, False otherwise

special_prompt_validation

def special_prompt_validation(node: Node)

[view_source]

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.

Arguments:

  • node: the node

Raises:

  • ValueError: if the pipeline is not valid

validate_params

def validate_params()

[view_source]

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

Raises:

  • ValueError: if the pipeline is not valid

validate

def validate()

[view_source]

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
def get_link(from_node: int, to_node: int) -> Link

[view_source]

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

between two nodes.

Arguments:

  • from_node: the from node number
  • to_node: the to node number

Returns:

the link

get_node

def get_node(node_number: int) -> Node

[view_source]

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

given number.

Arguments:

  • node_number: the node number

Returns:

the node

auto_infer

def auto_infer()

[view_source]

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.

asset

def asset(asset_id: str,
*args,
asset_class: Type[T] = AssetNode,
**kwargs) -> T

[view_source]

Shortcut to create an asset node for the current pipeline.

All params will be passed as keyword arguments to the node constructor.

Arguments:

  • kwargs: keyword arguments

Returns:

the node

utility

def utility(asset_id: str,
*args,
asset_class: Type[T] = Utility,
**kwargs) -> T

[view_source]

Shortcut to create an utility nodes for the current pipeline.

All params will be passed as keyword arguments to the node constructor.

Arguments:

  • kwargs: keyword arguments

Returns:

the node

decision

def decision(*args, **kwargs) -> Decision

[view_source]

Shortcut to create an decision node for the current pipeline.

All params will be passed as keyword arguments to the node constructor.

Arguments:

  • kwargs: keyword arguments

Returns:

the node

script

def script(*args, **kwargs) -> Script

[view_source]

Shortcut to create an script node for the current pipeline.

All params will be passed as keyword arguments to the node constructor.

Arguments:

  • kwargs: keyword arguments

Returns:

the node

input

def input(*args, **kwargs) -> Input

[view_source]

Shortcut to create an input node for the current pipeline.

All params will be passed as keyword arguments to the node constructor.

Arguments:

  • kwargs: keyword arguments

Returns:

the node

output

def output(*args, **kwargs) -> Output

[view_source]

Shortcut to create an output node for the current pipeline.

All params will be passed as keyword arguments to the node constructor.

Arguments:

  • kwargs: keyword arguments

Returns:

the node

router

def router(routes: Tuple[DataType, Node], *args, **kwargs) -> Router

[view_source]

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.

Arguments:

  • routes: the routes
  • kwargs: keyword arguments

Returns:

the node

bare_reconstructor

def bare_reconstructor(*args, **kwargs) -> BareReconstructor

[view_source]

Shortcut to create an reconstructor node for the current pipeline.

All params will be passed as keyword arguments to the node constructor.

Arguments:

  • kwargs: keyword arguments

Returns:

the node

bare_segmentor

def bare_segmentor(*args, **kwargs) -> BareSegmentor

[view_source]

Shortcut to create an segmentor node for the current pipeline.

All params will be passed as keyword arguments to the node constructor.

Arguments:

  • kwargs: keyword arguments

Returns:

the node

metric

def metric(*args, **kwargs) -> BareMetric

[view_source]

Shortcut to create an metric node for the current pipeline.

All params will be passed as keyword arguments to the node constructor.

Arguments:

  • kwargs: keyword arguments

Returns:

the node