Add __version__ (#2221)

# What does this PR do? 

This PR adds the `__version__` variable in the main `__init__.py` to
easily retrieve the version, e.g., for debugging purposes or when a user
wants to open an issue and provide information.

Usage
```python
>>> import langchain
>>> langchain.__version__
'0.0.127'
```


![Bildschirmfoto 2023-03-31 um 10 30
18](https://user-images.githubusercontent.com/32632186/229068621-53d068b5-32f4-4154-ad2c-a3e1cc7e1ef3.png)
This commit is contained in:
Philipp Schmid 2023-03-31 18:49:12 +02:00 committed by GitHub
parent 6c66f51fb8
commit 0ce4767076
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
"""Main entrypoint into package.""" """Main entrypoint into package."""
from importlib import metadata
from typing import Optional from typing import Optional
from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
@ -53,6 +54,9 @@ from langchain.utilities.wikipedia import WikipediaAPIWrapper
from langchain.utilities.wolfram_alpha import WolframAlphaAPIWrapper from langchain.utilities.wolfram_alpha import WolframAlphaAPIWrapper
from langchain.vectorstores import FAISS, ElasticVectorSearch from langchain.vectorstores import FAISS, ElasticVectorSearch
__version__ = metadata.version(__package__)
del metadata # optional, avoids polluting the results of dir(__package__)
verbose: bool = False verbose: bool = False
llm_cache: Optional[BaseCache] = None llm_cache: Optional[BaseCache] = None
set_default_callback_manager() set_default_callback_manager()