promptflow.executor.flow_validator module#
- class promptflow.executor.flow_validator.FlowValidator#
Bases:
object
This is a validation class designed to verify the integrity and validity of flow definitions and input data.
- static convert_flow_inputs_for_node(flow: Flow, node: Node, inputs: Mapping[str, Any]) Mapping[str, Any] #
Filter the flow inputs for node and resolve the value by type.
- Parameters:
flow (Flow) – The flow parameter is an instance of the Flow class. It represents the flow or workflow that contains the node and inputs
node (Node) – The node parameter is an instance of the Node class
inputs (Mapping[str, Any]) – A dictionary containing the input values for the node. The keys are the names of the input variables, and the values are the corresponding input values
- Returns:
the resolved flow inputs which are needed by the node only by the node only.
- Return type:
Mapping[str, Any]
- static ensure_flow_inputs_type(flow: Flow, inputs: Mapping[str, Any], idx: Optional[int] = None) Mapping[str, Any] #
Make sure the inputs are completed and in the correct type. Raise Exception if not valid.
- Parameters:
flow (Flow) – The flow parameter is of type Flow and represents a flow object
inputs (Mapping[str, Any]) – A dictionary containing the input values for the flow. The keys are the names of the flow inputs, and the values are the corresponding input values
idx (Optional[int]) – The idx parameter is an optional integer that represents the line index of the input data. It is used to provide additional information in case there is an error with the input data
- Returns:
The updated inputs, where the values are type-converted based on the expected type specified in the flow object.
- Return type:
Mapping[str, Any]
- static resolve_aggregated_flow_inputs_type(flow: Flow, inputs: Mapping[str, List[Any]]) Mapping[str, Any] #
- static resolve_flow_inputs_type(flow: Flow, inputs: Mapping[str, Any], idx: Optional[int] = None) Mapping[str, Any] #
Resolve inputs by type if existing. Ignore missing inputs.
- Parameters:
flow (Flow) – The flow parameter is of type Flow and represents a flow object
inputs (Mapping[str, Any]) – A dictionary containing the input values for the flow. The keys are the names of the flow inputs, and the values are the corresponding input values
idx (Optional[int]) – The idx parameter is an optional integer that represents the line index of the input data. It is used to provide additional information in case there is an error with the input data
- Returns:
The updated inputs with values are type-converted based on the expected type specified in the flow object.
- Return type:
Mapping[str, Any]