From f510940bdea5a46ec3dc8522d6288037287651e8 Mon Sep 17 00:00:00 2001 From: Harrison Chase Date: Mon, 8 May 2023 08:31:05 -0700 Subject: [PATCH] add check for lower bound of lark (#4287) --- langchain/chains/query_constructor/parser.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/langchain/chains/query_constructor/parser.py b/langchain/chains/query_constructor/parser.py index 83672e6c3b..22cfc90a56 100644 --- a/langchain/chains/query_constructor/parser.py +++ b/langchain/chains/query_constructor/parser.py @@ -1,6 +1,13 @@ from typing import Any, Optional, Sequence, Union try: + import lark + from packaging import version + + if version.parse(lark.__version__) < version.parse("1.1.5"): + raise ValueError( + f"Lark should be at least version 1.1.5, got {lark.__version__}" + ) from lark import Lark, Transformer, v_args except ImportError: pass