mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-01 04:29:09 +00:00
[langchain_core] Fix UnionType type var replacement - Added types.UnionType to typing.Union mapping Type replacement cause `TypeError: 'type' object is not subscriptable` if any of union type comes as function `_py_38_safe_origin` return `types.UnionType` instead of `typing.Union` ```python >>> from types import UnionType >>> from typing import Union, get_origin >>> type_ = get_origin(str | None) >>> type_ <class 'types.UnionType'> >>> UnionType[(str, None)] Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'type' object is not subscriptable >>> Union[(str, None)] typing.Optional[str] ``` --------- Co-authored-by: Chester Curme <chester.curme@gmail.com> |
||
---|---|---|
.. | ||
__init__.py | ||
_merge.py | ||
aiter.py | ||
env.py | ||
formatting.py | ||
function_calling.py | ||
html.py | ||
image.py | ||
input.py | ||
interactive_env.py | ||
iter.py | ||
json_schema.py | ||
json.py | ||
loading.py | ||
mustache.py | ||
pydantic.py | ||
strings.py | ||
utils.py |