mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-29 09:58:44 +00:00
fix imports from core (#14430)
This commit is contained in:
parent
a05230a4ba
commit
7be3eb6fbd
@ -82,7 +82,11 @@ DEPRECATED_CODE = [
|
|||||||
def __getattr__(name: str) -> Any:
|
def __getattr__(name: str) -> Any:
|
||||||
"""Get attr name."""
|
"""Get attr name."""
|
||||||
if name in DEPRECATED_CODE:
|
if name in DEPRECATED_CODE:
|
||||||
relative_path = as_import_path(Path(__file__).parent, suffix=name)
|
# Get directory of langchain package
|
||||||
|
HERE = Path(__file__).parents[1]
|
||||||
|
relative_path = as_import_path(
|
||||||
|
Path(__file__).parent, suffix=name, relative_to=HERE
|
||||||
|
)
|
||||||
old_path = "langchain." + relative_path
|
old_path = "langchain." + relative_path
|
||||||
new_path = "langchain_experimental." + relative_path
|
new_path = "langchain_experimental." + relative_path
|
||||||
raise ImportError(
|
raise ImportError(
|
||||||
|
@ -7,11 +7,14 @@ from langchain_core._api.path import as_import_path
|
|||||||
def __getattr__(name: str) -> Any:
|
def __getattr__(name: str) -> Any:
|
||||||
"""Get attr name."""
|
"""Get attr name."""
|
||||||
|
|
||||||
here = as_import_path(Path(__file__).parent)
|
if name == "create_csv_agent":
|
||||||
|
# Get directory of langchain package
|
||||||
|
HERE = Path(__file__).parents[3]
|
||||||
|
here = as_import_path(Path(__file__).parent, relative_to=HERE)
|
||||||
|
|
||||||
old_path = "langchain." + here + "." + name
|
old_path = "langchain." + here + "." + name
|
||||||
new_path = "langchain_experimental." + here + "." + name
|
new_path = "langchain_experimental." + here + "." + name
|
||||||
raise AttributeError(
|
raise ImportError(
|
||||||
"This agent has been moved to langchain experiment. "
|
"This agent has been moved to langchain experiment. "
|
||||||
"This agent relies on python REPL tool under the hood, so to use it "
|
"This agent relies on python REPL tool under the hood, so to use it "
|
||||||
"safely please sandbox the python REPL. "
|
"safely please sandbox the python REPL. "
|
||||||
@ -20,3 +23,4 @@ def __getattr__(name: str) -> Any:
|
|||||||
"To keep using this code as is, install langchain experimental and "
|
"To keep using this code as is, install langchain experimental and "
|
||||||
f"update your import statement from:\n `{old_path}` to `{new_path}`."
|
f"update your import statement from:\n `{old_path}` to `{new_path}`."
|
||||||
)
|
)
|
||||||
|
raise AttributeError(f"{name} does not exist")
|
||||||
|
@ -7,11 +7,14 @@ from langchain_core._api.path import as_import_path
|
|||||||
def __getattr__(name: str) -> Any:
|
def __getattr__(name: str) -> Any:
|
||||||
"""Get attr name."""
|
"""Get attr name."""
|
||||||
|
|
||||||
here = as_import_path(Path(__file__).parent)
|
if name == "create_pandas_dataframe_agent":
|
||||||
|
# Get directory of langchain package
|
||||||
|
HERE = Path(__file__).parents[3]
|
||||||
|
here = as_import_path(Path(__file__).parent, relative_to=HERE)
|
||||||
|
|
||||||
old_path = "langchain." + here + "." + name
|
old_path = "langchain." + here + "." + name
|
||||||
new_path = "langchain_experimental." + here + "." + name
|
new_path = "langchain_experimental." + here + "." + name
|
||||||
raise AttributeError(
|
raise ImportError(
|
||||||
"This agent has been moved to langchain experiment. "
|
"This agent has been moved to langchain experiment. "
|
||||||
"This agent relies on python REPL tool under the hood, so to use it "
|
"This agent relies on python REPL tool under the hood, so to use it "
|
||||||
"safely please sandbox the python REPL. "
|
"safely please sandbox the python REPL. "
|
||||||
@ -20,3 +23,4 @@ def __getattr__(name: str) -> Any:
|
|||||||
"To keep using this code as is, install langchain experimental and "
|
"To keep using this code as is, install langchain experimental and "
|
||||||
f"update your import statement from:\n `{old_path}` to `{new_path}`."
|
f"update your import statement from:\n `{old_path}` to `{new_path}`."
|
||||||
)
|
)
|
||||||
|
raise AttributeError(f"{name} does not exist")
|
||||||
|
@ -7,11 +7,14 @@ from langchain_core._api.path import as_import_path
|
|||||||
def __getattr__(name: str) -> Any:
|
def __getattr__(name: str) -> Any:
|
||||||
"""Get attr name."""
|
"""Get attr name."""
|
||||||
|
|
||||||
here = as_import_path(Path(__file__).parent)
|
if name == "create_python_agent":
|
||||||
|
# Get directory of langchain package
|
||||||
|
HERE = Path(__file__).parents[3]
|
||||||
|
here = as_import_path(Path(__file__).parent, relative_to=HERE)
|
||||||
|
|
||||||
old_path = "langchain." + here + "." + name
|
old_path = "langchain." + here + "." + name
|
||||||
new_path = "langchain_experimental." + here + "." + name
|
new_path = "langchain_experimental." + here + "." + name
|
||||||
raise AttributeError(
|
raise ImportError(
|
||||||
"This agent has been moved to langchain experiment. "
|
"This agent has been moved to langchain experiment. "
|
||||||
"This agent relies on python REPL tool under the hood, so to use it "
|
"This agent relies on python REPL tool under the hood, so to use it "
|
||||||
"safely please sandbox the python REPL. "
|
"safely please sandbox the python REPL. "
|
||||||
@ -20,3 +23,4 @@ def __getattr__(name: str) -> Any:
|
|||||||
"To keep using this code as is, install langchain experimental and "
|
"To keep using this code as is, install langchain experimental and "
|
||||||
f"update your import statement from:\n `{old_path}` to `{new_path}`."
|
f"update your import statement from:\n `{old_path}` to `{new_path}`."
|
||||||
)
|
)
|
||||||
|
raise AttributeError(f"{name} does not exist")
|
||||||
|
@ -7,11 +7,14 @@ from langchain_core._api.path import as_import_path
|
|||||||
def __getattr__(name: str) -> Any:
|
def __getattr__(name: str) -> Any:
|
||||||
"""Get attr name."""
|
"""Get attr name."""
|
||||||
|
|
||||||
here = as_import_path(Path(__file__).parent)
|
if name == "create_spark_dataframe_agent":
|
||||||
|
# Get directory of langchain package
|
||||||
|
HERE = Path(__file__).parents[3]
|
||||||
|
here = as_import_path(Path(__file__).parent, relative_to=HERE)
|
||||||
|
|
||||||
old_path = "langchain." + here + "." + name
|
old_path = "langchain." + here + "." + name
|
||||||
new_path = "langchain_experimental." + here + "." + name
|
new_path = "langchain_experimental." + here + "." + name
|
||||||
raise AttributeError(
|
raise ImportError(
|
||||||
"This agent has been moved to langchain experiment. "
|
"This agent has been moved to langchain experiment. "
|
||||||
"This agent relies on python REPL tool under the hood, so to use it "
|
"This agent relies on python REPL tool under the hood, so to use it "
|
||||||
"safely please sandbox the python REPL. "
|
"safely please sandbox the python REPL. "
|
||||||
@ -20,3 +23,4 @@ def __getattr__(name: str) -> Any:
|
|||||||
"To keep using this code as is, install langchain experimental and "
|
"To keep using this code as is, install langchain experimental and "
|
||||||
f"update your import statement from:\n `{old_path}` to `{new_path}`."
|
f"update your import statement from:\n `{old_path}` to `{new_path}`."
|
||||||
)
|
)
|
||||||
|
raise AttributeError(f"{name} does not exist")
|
||||||
|
@ -7,11 +7,14 @@ from langchain_core._api.path import as_import_path
|
|||||||
def __getattr__(name: str) -> Any:
|
def __getattr__(name: str) -> Any:
|
||||||
"""Get attr name."""
|
"""Get attr name."""
|
||||||
|
|
||||||
here = as_import_path(Path(__file__).parent)
|
if name == "create_xorbits_agent":
|
||||||
|
# Get directory of langchain package
|
||||||
|
HERE = Path(__file__).parents[3]
|
||||||
|
here = as_import_path(Path(__file__).parent, relative_to=HERE)
|
||||||
|
|
||||||
old_path = "langchain." + here + "." + name
|
old_path = "langchain." + here + "." + name
|
||||||
new_path = "langchain_experimental." + here + "." + name
|
new_path = "langchain_experimental." + here + "." + name
|
||||||
raise AttributeError(
|
raise ImportError(
|
||||||
"This agent has been moved to langchain experiment. "
|
"This agent has been moved to langchain experiment. "
|
||||||
"This agent relies on python REPL tool under the hood, so to use it "
|
"This agent relies on python REPL tool under the hood, so to use it "
|
||||||
"safely please sandbox the python REPL. "
|
"safely please sandbox the python REPL. "
|
||||||
@ -20,3 +23,4 @@ def __getattr__(name: str) -> Any:
|
|||||||
"To keep using this code as is, install langchain experimental and "
|
"To keep using this code as is, install langchain experimental and "
|
||||||
f"update your import statement from:\n `{old_path}` to `{new_path}`."
|
f"update your import statement from:\n `{old_path}` to `{new_path}`."
|
||||||
)
|
)
|
||||||
|
raise AttributeError(f"{name} does not exist")
|
||||||
|
Loading…
Reference in New Issue
Block a user