mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-02 03:26:17 +00:00
fix: handle TypeGuard import for compatibility with older Python versions
This commit is contained in:
@@ -103,9 +103,14 @@ The module defines several types of content blocks, including:
|
|||||||
""" # noqa: E501
|
""" # noqa: E501
|
||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Any, Literal, Optional, TypeGuard, Union
|
from typing import Any, Literal, Optional, Union
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
|
try:
|
||||||
|
from typing import TypeGuard
|
||||||
|
except ImportError:
|
||||||
|
from typing_extensions import TypeGuard
|
||||||
|
|
||||||
from typing_extensions import NotRequired, TypedDict, get_args, get_origin
|
from typing_extensions import NotRequired, TypedDict, get_args, get_origin
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user