Skip to content

validate_condition.py§

validate_condition(state) §

Validate the condition for the next node to visit.

Parameters:

Name Type Description Default
state Dict[str, Any]

The current state containing the validation result.

required

Returns:

Type Description
Literal['schema_to_ttl', '__end__']

Literal["schema_to_ttl", "end"]: The next node to visit.

Source code in brickllm/edges/validate_condition.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
def validate_condition(state: Dict[str, Any]) -> Literal["schema_to_ttl", "__end__"]:
    """
    Validate the condition for the next node to visit.

    Args:
        state (Dict[str, Any]): The current state containing the validation result.

    Returns:
        Literal["schema_to_ttl", "__end__"]: The next node to visit.
    """

    is_valid = state.get("is_valid", False)
    max_iter = state.get("validation_max_iter", 0)

    if max_iter > 0 and not is_valid:
        return "schema_to_ttl"

    return "__end__"