Solving anthropic packaging version issue (#7306)

- Description: Solving, anthropic packaging version issue by clearing
the mixup from package.version that is being confused with version from
- importlib.metadata.version.

  - Issue: it fixes the issue #7283 
  - Maintainer: @hwchase17 

The following change has been explained in the comment -
https://github.com/hwchase17/langchain/issues/7283#issuecomment-1624328978
pull/7313/head
Sparsh Jain 1 year ago committed by GitHub
parent d642609a23
commit bac56618b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,7 +4,7 @@ import warnings
from importlib.metadata import version
from typing import Any, Callable, Dict, Generator, List, Mapping, Optional
import packaging
from packaging.version import parse
from pydantic import BaseModel, root_validator
from langchain.callbacks.manager import (
@ -64,8 +64,8 @@ class _AnthropicCommon(BaseModel):
try:
import anthropic
anthropic_version = packaging.version.parse(version("anthropic"))
if anthropic_version < packaging.version.parse("0.3"):
anthropic_version = parse(version("anthropic"))
if anthropic_version < parse("0.3"):
raise ValueError(
f"Anthropic client version must be > 0.3, got {anthropic_version}. "
f"To update the client, please run "

Loading…
Cancel
Save