mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-24 15:43:54 +00:00
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
This commit is contained in:
parent
d642609a23
commit
bac56618b4
@ -4,7 +4,7 @@ import warnings
|
|||||||
from importlib.metadata import version
|
from importlib.metadata import version
|
||||||
from typing import Any, Callable, Dict, Generator, List, Mapping, Optional
|
from typing import Any, Callable, Dict, Generator, List, Mapping, Optional
|
||||||
|
|
||||||
import packaging
|
from packaging.version import parse
|
||||||
from pydantic import BaseModel, root_validator
|
from pydantic import BaseModel, root_validator
|
||||||
|
|
||||||
from langchain.callbacks.manager import (
|
from langchain.callbacks.manager import (
|
||||||
@ -64,8 +64,8 @@ class _AnthropicCommon(BaseModel):
|
|||||||
try:
|
try:
|
||||||
import anthropic
|
import anthropic
|
||||||
|
|
||||||
anthropic_version = packaging.version.parse(version("anthropic"))
|
anthropic_version = parse(version("anthropic"))
|
||||||
if anthropic_version < packaging.version.parse("0.3"):
|
if anthropic_version < parse("0.3"):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Anthropic client version must be > 0.3, got {anthropic_version}. "
|
f"Anthropic client version must be > 0.3, got {anthropic_version}. "
|
||||||
f"To update the client, please run "
|
f"To update the client, please run "
|
||||||
|
Loading…
Reference in New Issue
Block a user