mirror of
https://github.com/hwchase17/langchain
synced 2024-11-06 03:20:49 +00:00
Fix Lark import error (#4421)
Any import that touches langchain.retrievers currently requires Lark. Here's one attempt to fix. Not very pretty, very open to other ideas. Alternatives I thought of are 1) make Lark requirement, 2) put everything in parser.py in the try/except. Neither sounds much better Related to #4316, #4275
This commit is contained in:
parent
f0cfed636f
commit
f6c97e6af4
@ -10,7 +10,12 @@ try:
|
||||
)
|
||||
from lark import Lark, Transformer, v_args
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
def v_args(*args: Any, **kwargs: Any) -> Any: # type: ignore
|
||||
return lambda _: None
|
||||
|
||||
Transformer = object # type: ignore
|
||||
Lark = object # type: ignore
|
||||
|
||||
from langchain.chains.query_constructor.ir import (
|
||||
Comparator,
|
||||
|
Loading…
Reference in New Issue
Block a user