Skip to content

Commit

Permalink
Add try/except for metadata.version
Browse files Browse the repository at this point in the history
- TODO: Undo this change
  • Loading branch information
holtskinner committed Feb 5, 2024
1 parent efb15d7 commit a6a738a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libs/community/langchain_community/utilities/vertexai.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ def raise_vertex_import_error(minimum_expected_version: str = "1.40.0") -> None:


def _get_user_agent(module: Optional[str] = None) -> Tuple[str, str]:
langchain_version = metadata.version("langchain")
try:
langchain_version = metadata.version("langchain-google-vertexai")
langchain_version = metadata.version("langchain-core")
langchain_version = metadata.version("langchain")
except metadata.PackageNotFoundError as ex:
print(ex)
client_library_version = (
f"{langchain_version}-{module}" if module else langchain_version
)
Expand Down

0 comments on commit a6a738a

Please sign in to comment.