Add exeption for when version metadata cannot be found for package (#3107)

Solves #3097

Already ran tests and lint.
This commit is contained in:
Francesco 2023-04-18 20:44:40 -03:00 committed by GitHub
parent d54c88aa21
commit 19116010ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,7 +55,11 @@ from langchain.utilities.wikipedia import WikipediaAPIWrapper
from langchain.utilities.wolfram_alpha import WolframAlphaAPIWrapper
from langchain.vectorstores import FAISS, ElasticVectorSearch
__version__ = metadata.version(__package__)
try:
__version__ = metadata.version(__package__)
except metadata.PackageNotFoundError:
# Case where package metadata is not available.
__version__ = ""
del metadata # optional, avoids polluting the results of dir(__package__)
verbose: bool = False