mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-04 22:23:50 +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 | ||
test_aiter.py | ||
test_env.py | ||
test_function_calling.py | ||
test_html.py | ||
test_imports.py | ||
test_iter.py | ||
test_json_schema.py | ||
test_pydantic.py | ||
test_rm_titles.py | ||
test_utils.py |