From 59157b6891f22b87a099479cf0c6627fa805be0a Mon Sep 17 00:00:00 2001 From: Ryan Dao Date: Wed, 1 Mar 2023 21:15:27 -0800 Subject: [PATCH] Bug: Fix Python version validation in PythonAstREPLTool (#1373) The current logic checks if the Python major version is < 8, which is wrong. This checks if the major and minor version is < 3.9. --- langchain/tools/python/tool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain/tools/python/tool.py b/langchain/tools/python/tool.py index 270bbec2..0a1adb46 100644 --- a/langchain/tools/python/tool.py +++ b/langchain/tools/python/tool.py @@ -51,7 +51,7 @@ class PythonAstREPLTool(BaseTool): @root_validator(pre=True) def validate_python_version(cls, values: Dict) -> Dict: """Validate valid python version.""" - if sys.version_info[0] <= 8: + if sys.version_info < (3, 9): raise ValueError( "This tool relies on Python 3.9 or higher " "(as it uses new functionality in the `ast` module, "