mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-19 09:30:15 +00:00
Add deprecation warnings (#11899)
Add deprecation warnings Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
parent
8b79cf9566
commit
5f4a697ce3
@ -1,6 +1,7 @@
|
||||
"""Agent for working with pandas objects."""
|
||||
from typing import Any, Dict, List, Optional, Sequence, Tuple
|
||||
|
||||
from langchain._api import warn_deprecated
|
||||
from langchain.agents.agent import AgentExecutor, BaseSingleActionAgent
|
||||
from langchain.agents.agent_toolkits.pandas.prompt import (
|
||||
FUNCTIONS_WITH_DF,
|
||||
@ -285,6 +286,16 @@ def create_pandas_dataframe_agent(
|
||||
**kwargs: Dict[str, Any],
|
||||
) -> AgentExecutor:
|
||||
"""Construct a pandas agent from an LLM and dataframe."""
|
||||
warn_deprecated(
|
||||
since="0.0.314",
|
||||
message=(
|
||||
"On 2023-10-27 this module will be be deprecated from langchain, and "
|
||||
"will be available from the langchain-experimental package."
|
||||
"This code is already available in langchain-experimental."
|
||||
"See https://github.com/langchain-ai/langchain/discussions/11680."
|
||||
),
|
||||
pending=True,
|
||||
)
|
||||
agent: BaseSingleActionAgent
|
||||
if agent_type == AgentType.ZERO_SHOT_REACT_DESCRIPTION:
|
||||
prompt, base_tools = _get_prompt_and_tools(
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from langchain._api import warn_deprecated
|
||||
from langchain.agents.agent import AgentExecutor, BaseSingleActionAgent
|
||||
from langchain.agents.agent_toolkits.python.prompt import PREFIX
|
||||
from langchain.agents.mrkl.base import ZeroShotAgent
|
||||
@ -25,6 +26,16 @@ def create_python_agent(
|
||||
**kwargs: Dict[str, Any],
|
||||
) -> AgentExecutor:
|
||||
"""Construct a python agent from an LLM and tool."""
|
||||
warn_deprecated(
|
||||
since="0.0.314",
|
||||
message=(
|
||||
"On 2023-10-27 this module will be be deprecated from langchain, and "
|
||||
"will be available from the langchain-experimental package."
|
||||
"This code is already available in langchain-experimental."
|
||||
"See https://github.com/langchain-ai/langchain/discussions/11680."
|
||||
),
|
||||
pending=True,
|
||||
)
|
||||
tools = [tool]
|
||||
agent: BaseSingleActionAgent
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Agent for working with pandas objects."""
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from langchain._api import warn_deprecated
|
||||
from langchain.agents.agent import AgentExecutor
|
||||
from langchain.agents.agent_toolkits.spark.prompt import PREFIX, SUFFIX
|
||||
from langchain.agents.mrkl.base import ZeroShotAgent
|
||||
@ -44,6 +45,16 @@ def create_spark_dataframe_agent(
|
||||
**kwargs: Dict[str, Any],
|
||||
) -> AgentExecutor:
|
||||
"""Construct a Spark agent from an LLM and dataframe."""
|
||||
warn_deprecated(
|
||||
since="0.0.314",
|
||||
message=(
|
||||
"On 2023-10-27 this module will be be deprecated from langchain, and "
|
||||
"will be available from the langchain-experimental package."
|
||||
"This code is already available in langchain-experimental."
|
||||
"See https://github.com/langchain-ai/langchain/discussions/11680."
|
||||
),
|
||||
pending=True,
|
||||
)
|
||||
|
||||
if not _validate_spark_df(df) and not _validate_spark_connect_df(df):
|
||||
raise ImportError("Spark is not installed. run `pip install pyspark`.")
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Agent for working with xorbits objects."""
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from langchain._api import warn_deprecated
|
||||
from langchain.agents.agent import AgentExecutor
|
||||
from langchain.agents.agent_toolkits.xorbits.prompt import (
|
||||
NP_PREFIX,
|
||||
@ -31,6 +32,16 @@ def create_xorbits_agent(
|
||||
**kwargs: Dict[str, Any],
|
||||
) -> AgentExecutor:
|
||||
"""Construct a xorbits agent from an LLM and dataframe."""
|
||||
warn_deprecated(
|
||||
since="0.0.314",
|
||||
message=(
|
||||
"On 2023-10-27 this module will be be deprecated from langchain, and "
|
||||
"will be available from the langchain-experimental package."
|
||||
"This code is already available in langchain-experimental."
|
||||
"See https://github.com/langchain-ai/langchain/discussions/11680."
|
||||
),
|
||||
pending=True,
|
||||
)
|
||||
try:
|
||||
from xorbits import numpy as np
|
||||
from xorbits import pandas as pd
|
||||
|
@ -8,6 +8,7 @@ from contextlib import redirect_stdout
|
||||
from io import StringIO
|
||||
from typing import Any, Dict, Optional, Type
|
||||
|
||||
from langchain._api import warn_deprecated
|
||||
from langchain.callbacks.manager import (
|
||||
AsyncCallbackManagerForToolRun,
|
||||
CallbackManagerForToolRun,
|
||||
@ -58,6 +59,16 @@ class PythonREPLTool(BaseTool):
|
||||
run_manager: Optional[CallbackManagerForToolRun] = None,
|
||||
) -> Any:
|
||||
"""Use the tool."""
|
||||
warn_deprecated(
|
||||
since="0.0.314",
|
||||
message=(
|
||||
"On 2023-10-27 this module will be be deprecated from langchain, and "
|
||||
"will be available from the langchain-experimental package."
|
||||
"This code is already available in langchain-experimental."
|
||||
"See https://github.com/langchain-ai/langchain/discussions/11680."
|
||||
),
|
||||
pending=True,
|
||||
)
|
||||
if self.sanitize_input:
|
||||
query = sanitize_input(query)
|
||||
return self.python_repl.run(query)
|
||||
@ -68,6 +79,16 @@ class PythonREPLTool(BaseTool):
|
||||
run_manager: Optional[AsyncCallbackManagerForToolRun] = None,
|
||||
) -> Any:
|
||||
"""Use the tool asynchronously."""
|
||||
warn_deprecated(
|
||||
since="0.0.314",
|
||||
message=(
|
||||
"On 2023-10-27 this module will be be deprecated from langchain, and "
|
||||
"will be available from the langchain-experimental package."
|
||||
"This code is already available in langchain-experimental."
|
||||
"See https://github.com/langchain-ai/langchain/discussions/11680."
|
||||
),
|
||||
pending=True,
|
||||
)
|
||||
if self.sanitize_input:
|
||||
query = sanitize_input(query)
|
||||
|
||||
@ -113,6 +134,17 @@ class PythonAstREPLTool(BaseTool):
|
||||
run_manager: Optional[CallbackManagerForToolRun] = None,
|
||||
) -> str:
|
||||
"""Use the tool."""
|
||||
warn_deprecated(
|
||||
since="0.0.314",
|
||||
message=(
|
||||
"On 2023-10-27 this module will be be deprecated from langchain, and "
|
||||
"will be available from the langchain-experimental package."
|
||||
"This code is already available in langchain-experimental."
|
||||
"See https://github.com/langchain-ai/langchain/discussions/11680."
|
||||
),
|
||||
pending=True,
|
||||
)
|
||||
|
||||
try:
|
||||
if self.sanitize_input:
|
||||
query = sanitize_input(query)
|
||||
@ -143,6 +175,16 @@ class PythonAstREPLTool(BaseTool):
|
||||
) -> Any:
|
||||
"""Use the tool asynchronously."""
|
||||
|
||||
warn_deprecated(
|
||||
since="0.0.314",
|
||||
message=(
|
||||
"On 2023-10-27 this module will be be deprecated from langchain, and "
|
||||
"will be available from the langchain-experimental package."
|
||||
"This code is already available in langchain-experimental."
|
||||
"See https://github.com/langchain-ai/langchain/discussions/11680."
|
||||
),
|
||||
pending=True,
|
||||
)
|
||||
loop = asyncio.get_running_loop()
|
||||
result = await loop.run_in_executor(None, self._run, query)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user