Toggle Menu
Prev Up Next

# `langchain_experimental.pal_chain.base`.PALValidation

class langchain_experimental.pal_chain.base.PALValidation(solution_expression_name: Optional[str] = None, solution_expression_type: Optional[type] = None, allow_imports: bool = False, allow_command_exec: bool = False)

  Validation for PAL generated code.

  Initialize a PALValidation instance.

  Parameters

    - solution_expression_name (str) – Name of the expected solution expression. If passed, solution_expression_type must be passed as well.

    - solution_expression_type (str) – AST type of the expected solution expression. If passed, solution_expression_name must be passed as well. Must be one of PALValidation.SOLUTION_EXPRESSION_TYPE_FUNCTION, PALValidation.SOLUTION_EXPRESSION_TYPE_VARIABLE.

    - allow_imports (bool) – Allow import statements.

    - allow_command_exec (bool) – Allow using known command execution functions.

  Methods

  `__init__`([solution_expression_name, ...]) | Initialize a PALValidation instance.

  __init__(solution_expression_name: Optional[str] = None, solution_expression_type: Optional[type] = None, allow_imports: bool = False, allow_command_exec: bool = False)

    Initialize a PALValidation instance.

    Parameters

      - solution_expression_name (str) – Name of the expected solution expression. If passed, solution_expression_type must be passed as well.

      - solution_expression_type (str) – AST type of the expected solution expression. If passed, solution_expression_name must be passed as well. Must be one of PALValidation.SOLUTION_EXPRESSION_TYPE_FUNCTION, PALValidation.SOLUTION_EXPRESSION_TYPE_VARIABLE.

      - allow_imports (bool) – Allow import statements.

      - allow_command_exec (bool) – Allow using known command execution functions.