initial commit
This commit is contained in:
164
venv/Lib/site-packages/langchain_classic/agents/__init__.py
Normal file
164
venv/Lib/site-packages/langchain_classic/agents/__init__.py
Normal file
@@ -0,0 +1,164 @@
|
||||
"""**Agent** is a class that uses an LLM to choose a sequence of actions to take.
|
||||
|
||||
In Chains, a sequence of actions is hardcoded. In Agents,
|
||||
a language model is used as a reasoning engine to determine which actions
|
||||
to take and in which order.
|
||||
|
||||
Agents select and use **Tools** and **Toolkits** for actions.
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_core._api.path import as_import_path
|
||||
from langchain_core.tools import Tool
|
||||
from langchain_core.tools.convert import tool
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
from langchain_classic.agents.agent import (
|
||||
Agent,
|
||||
AgentExecutor,
|
||||
AgentOutputParser,
|
||||
BaseMultiActionAgent,
|
||||
BaseSingleActionAgent,
|
||||
LLMSingleActionAgent,
|
||||
)
|
||||
from langchain_classic.agents.agent_iterator import AgentExecutorIterator
|
||||
from langchain_classic.agents.agent_toolkits.vectorstore.base import (
|
||||
create_vectorstore_agent,
|
||||
create_vectorstore_router_agent,
|
||||
)
|
||||
from langchain_classic.agents.agent_types import AgentType
|
||||
from langchain_classic.agents.conversational.base import ConversationalAgent
|
||||
from langchain_classic.agents.conversational_chat.base import ConversationalChatAgent
|
||||
from langchain_classic.agents.initialize import initialize_agent
|
||||
from langchain_classic.agents.json_chat.base import create_json_chat_agent
|
||||
from langchain_classic.agents.loading import load_agent
|
||||
from langchain_classic.agents.mrkl.base import MRKLChain, ZeroShotAgent
|
||||
from langchain_classic.agents.openai_functions_agent.base import (
|
||||
OpenAIFunctionsAgent,
|
||||
create_openai_functions_agent,
|
||||
)
|
||||
from langchain_classic.agents.openai_functions_multi_agent.base import (
|
||||
OpenAIMultiFunctionsAgent,
|
||||
)
|
||||
from langchain_classic.agents.openai_tools.base import create_openai_tools_agent
|
||||
from langchain_classic.agents.react.agent import create_react_agent
|
||||
from langchain_classic.agents.react.base import ReActChain, ReActTextWorldAgent
|
||||
from langchain_classic.agents.self_ask_with_search.base import (
|
||||
SelfAskWithSearchChain,
|
||||
create_self_ask_with_search_agent,
|
||||
)
|
||||
from langchain_classic.agents.structured_chat.base import (
|
||||
StructuredChatAgent,
|
||||
create_structured_chat_agent,
|
||||
)
|
||||
from langchain_classic.agents.tool_calling_agent.base import create_tool_calling_agent
|
||||
from langchain_classic.agents.xml.base import XMLAgent, create_xml_agent
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.json.base import create_json_agent
|
||||
from langchain_community.agent_toolkits.load_tools import (
|
||||
get_all_tool_names,
|
||||
load_huggingface_tool,
|
||||
load_tools,
|
||||
)
|
||||
from langchain_community.agent_toolkits.openapi.base import create_openapi_agent
|
||||
from langchain_community.agent_toolkits.powerbi.base import create_pbi_agent
|
||||
from langchain_community.agent_toolkits.powerbi.chat_base import (
|
||||
create_pbi_chat_agent,
|
||||
)
|
||||
from langchain_community.agent_toolkits.spark_sql.base import create_spark_sql_agent
|
||||
from langchain_community.agent_toolkits.sql.base import create_sql_agent
|
||||
|
||||
DEPRECATED_CODE = [
|
||||
"create_csv_agent",
|
||||
"create_pandas_dataframe_agent",
|
||||
"create_spark_dataframe_agent",
|
||||
"create_xorbits_agent",
|
||||
]
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"create_json_agent": "langchain_community.agent_toolkits.json.base",
|
||||
"create_openapi_agent": "langchain_community.agent_toolkits.openapi.base",
|
||||
"create_pbi_agent": "langchain_community.agent_toolkits.powerbi.base",
|
||||
"create_pbi_chat_agent": "langchain_community.agent_toolkits.powerbi.chat_base",
|
||||
"create_spark_sql_agent": "langchain_community.agent_toolkits.spark_sql.base",
|
||||
"create_sql_agent": "langchain_community.agent_toolkits.sql.base",
|
||||
"load_tools": "langchain_community.agent_toolkits.load_tools",
|
||||
"load_huggingface_tool": "langchain_community.agent_toolkits.load_tools",
|
||||
"get_all_tool_names": "langchain_community.agent_toolkits.load_tools",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Get attr name."""
|
||||
if name in DEPRECATED_CODE:
|
||||
# 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_classic." + relative_path
|
||||
new_path = "langchain_experimental." + relative_path
|
||||
msg = (
|
||||
f"{name} has been moved to langchain_experimental. "
|
||||
"See https://github.com/langchain-ai/langchain/discussions/11680"
|
||||
"for more information.\n"
|
||||
f"Please update your import statement from: `{old_path}` to `{new_path}`."
|
||||
)
|
||||
raise ImportError(msg)
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"Agent",
|
||||
"AgentExecutor",
|
||||
"AgentExecutorIterator",
|
||||
"AgentOutputParser",
|
||||
"AgentType",
|
||||
"BaseMultiActionAgent",
|
||||
"BaseSingleActionAgent",
|
||||
"ConversationalAgent",
|
||||
"ConversationalChatAgent",
|
||||
"LLMSingleActionAgent",
|
||||
"MRKLChain",
|
||||
"OpenAIFunctionsAgent",
|
||||
"OpenAIMultiFunctionsAgent",
|
||||
"ReActChain",
|
||||
"ReActTextWorldAgent",
|
||||
"SelfAskWithSearchChain",
|
||||
"StructuredChatAgent",
|
||||
"Tool",
|
||||
"XMLAgent",
|
||||
"ZeroShotAgent",
|
||||
"create_json_agent",
|
||||
"create_json_chat_agent",
|
||||
"create_openai_functions_agent",
|
||||
"create_openai_tools_agent",
|
||||
"create_openapi_agent",
|
||||
"create_pbi_agent",
|
||||
"create_pbi_chat_agent",
|
||||
"create_react_agent",
|
||||
"create_self_ask_with_search_agent",
|
||||
"create_spark_sql_agent",
|
||||
"create_sql_agent",
|
||||
"create_structured_chat_agent",
|
||||
"create_tool_calling_agent",
|
||||
"create_vectorstore_agent",
|
||||
"create_vectorstore_router_agent",
|
||||
"create_xml_agent",
|
||||
"get_all_tool_names",
|
||||
"initialize_agent",
|
||||
"load_agent",
|
||||
"load_huggingface_tool",
|
||||
"load_tools",
|
||||
"tool",
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1792
venv/Lib/site-packages/langchain_classic/agents/agent.py
Normal file
1792
venv/Lib/site-packages/langchain_classic/agents/agent.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,432 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import time
|
||||
from collections.abc import AsyncIterator, Iterator
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
)
|
||||
from uuid import UUID
|
||||
|
||||
from langchain_core.agents import (
|
||||
AgentAction,
|
||||
AgentFinish,
|
||||
AgentStep,
|
||||
)
|
||||
from langchain_core.callbacks import (
|
||||
AsyncCallbackManager,
|
||||
AsyncCallbackManagerForChainRun,
|
||||
CallbackManager,
|
||||
CallbackManagerForChainRun,
|
||||
Callbacks,
|
||||
)
|
||||
from langchain_core.load.dump import dumpd
|
||||
from langchain_core.outputs import RunInfo
|
||||
from langchain_core.runnables.utils import AddableDict
|
||||
from langchain_core.tools import BaseTool
|
||||
from langchain_core.utils.input import get_color_mapping
|
||||
|
||||
from langchain_classic.schema import RUN_KEY
|
||||
from langchain_classic.utilities.asyncio import asyncio_timeout
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_classic.agents.agent import AgentExecutor, NextStepOutput
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AgentExecutorIterator:
|
||||
"""Iterator for AgentExecutor."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
agent_executor: AgentExecutor,
|
||||
inputs: Any,
|
||||
callbacks: Callbacks = None,
|
||||
*,
|
||||
tags: list[str] | None = None,
|
||||
metadata: dict[str, Any] | None = None,
|
||||
run_name: str | None = None,
|
||||
run_id: UUID | None = None,
|
||||
include_run_info: bool = False,
|
||||
yield_actions: bool = False,
|
||||
):
|
||||
"""Initialize the `AgentExecutorIterator`.
|
||||
|
||||
Initialize the `AgentExecutorIterator` with the given `AgentExecutor`,
|
||||
inputs, and optional callbacks.
|
||||
|
||||
Args:
|
||||
agent_executor: The `AgentExecutor` to iterate over.
|
||||
inputs: The inputs to the `AgentExecutor`.
|
||||
callbacks: The callbacks to use during iteration.
|
||||
tags: The tags to use during iteration.
|
||||
metadata: The metadata to use during iteration.
|
||||
run_name: The name of the run.
|
||||
run_id: The ID of the run.
|
||||
include_run_info: Whether to include run info in the output.
|
||||
yield_actions: Whether to yield actions as they are generated.
|
||||
"""
|
||||
self._agent_executor = agent_executor
|
||||
self.inputs = inputs
|
||||
self.callbacks = callbacks
|
||||
self.tags = tags
|
||||
self.metadata = metadata
|
||||
self.run_name = run_name
|
||||
self.run_id = run_id
|
||||
self.include_run_info = include_run_info
|
||||
self.yield_actions = yield_actions
|
||||
self.reset()
|
||||
|
||||
_inputs: dict[str, str]
|
||||
callbacks: Callbacks
|
||||
tags: list[str] | None
|
||||
metadata: dict[str, Any] | None
|
||||
run_name: str | None
|
||||
run_id: UUID | None
|
||||
include_run_info: bool
|
||||
yield_actions: bool
|
||||
|
||||
@property
|
||||
def inputs(self) -> dict[str, str]:
|
||||
"""The inputs to the `AgentExecutor`."""
|
||||
return self._inputs
|
||||
|
||||
@inputs.setter
|
||||
def inputs(self, inputs: Any) -> None:
|
||||
self._inputs = self.agent_executor.prep_inputs(inputs)
|
||||
|
||||
@property
|
||||
def agent_executor(self) -> AgentExecutor:
|
||||
"""The `AgentExecutor` to iterate over."""
|
||||
return self._agent_executor
|
||||
|
||||
@agent_executor.setter
|
||||
def agent_executor(self, agent_executor: AgentExecutor) -> None:
|
||||
self._agent_executor = agent_executor
|
||||
# force re-prep inputs in case agent_executor's prep_inputs fn changed
|
||||
self.inputs = self.inputs
|
||||
|
||||
@property
|
||||
def name_to_tool_map(self) -> dict[str, BaseTool]:
|
||||
"""A mapping of tool names to tools."""
|
||||
return {tool.name: tool for tool in self.agent_executor.tools}
|
||||
|
||||
@property
|
||||
def color_mapping(self) -> dict[str, str]:
|
||||
"""A mapping of tool names to colors."""
|
||||
return get_color_mapping(
|
||||
[tool.name for tool in self.agent_executor.tools],
|
||||
excluded_colors=["green", "red"],
|
||||
)
|
||||
|
||||
def reset(self) -> None:
|
||||
"""Reset the iterator to its initial state.
|
||||
|
||||
Reset the iterator to its initial state, clearing intermediate steps,
|
||||
iterations, and time elapsed.
|
||||
"""
|
||||
logger.debug("(Re)setting AgentExecutorIterator to fresh state")
|
||||
self.intermediate_steps: list[tuple[AgentAction, str]] = []
|
||||
self.iterations = 0
|
||||
# maybe better to start these on the first __anext__ call?
|
||||
self.time_elapsed = 0.0
|
||||
self.start_time = time.time()
|
||||
|
||||
def update_iterations(self) -> None:
|
||||
"""Increment the number of iterations and update the time elapsed."""
|
||||
self.iterations += 1
|
||||
self.time_elapsed = time.time() - self.start_time
|
||||
logger.debug(
|
||||
"Agent Iterations: %s (%.2fs elapsed)",
|
||||
self.iterations,
|
||||
self.time_elapsed,
|
||||
)
|
||||
|
||||
def make_final_outputs(
|
||||
self,
|
||||
outputs: dict[str, Any],
|
||||
run_manager: CallbackManagerForChainRun | AsyncCallbackManagerForChainRun,
|
||||
) -> AddableDict:
|
||||
"""Make final outputs for the iterator.
|
||||
|
||||
Args:
|
||||
outputs: The outputs from the agent executor.
|
||||
run_manager: The run manager to use for callbacks.
|
||||
"""
|
||||
# have access to intermediate steps by design in iterator,
|
||||
# so return only outputs may as well always be true.
|
||||
|
||||
prepared_outputs = AddableDict(
|
||||
self.agent_executor.prep_outputs(
|
||||
self.inputs,
|
||||
outputs,
|
||||
return_only_outputs=True,
|
||||
),
|
||||
)
|
||||
if self.include_run_info:
|
||||
prepared_outputs[RUN_KEY] = RunInfo(run_id=run_manager.run_id)
|
||||
return prepared_outputs
|
||||
|
||||
def __iter__(self: AgentExecutorIterator) -> Iterator[AddableDict]:
|
||||
"""Create an async iterator for the `AgentExecutor`."""
|
||||
logger.debug("Initialising AgentExecutorIterator")
|
||||
self.reset()
|
||||
callback_manager = CallbackManager.configure(
|
||||
self.callbacks,
|
||||
self.agent_executor.callbacks,
|
||||
self.agent_executor.verbose,
|
||||
self.tags,
|
||||
self.agent_executor.tags,
|
||||
self.metadata,
|
||||
self.agent_executor.metadata,
|
||||
)
|
||||
run_manager = callback_manager.on_chain_start(
|
||||
dumpd(self.agent_executor),
|
||||
self.inputs,
|
||||
self.run_id,
|
||||
name=self.run_name,
|
||||
)
|
||||
try:
|
||||
while self.agent_executor._should_continue( # noqa: SLF001
|
||||
self.iterations,
|
||||
self.time_elapsed,
|
||||
):
|
||||
# take the next step: this plans next action, executes it,
|
||||
# yielding action and observation as they are generated
|
||||
next_step_seq: NextStepOutput = []
|
||||
for chunk in self.agent_executor._iter_next_step( # noqa: SLF001
|
||||
self.name_to_tool_map,
|
||||
self.color_mapping,
|
||||
self.inputs,
|
||||
self.intermediate_steps,
|
||||
run_manager,
|
||||
):
|
||||
next_step_seq.append(chunk)
|
||||
# if we're yielding actions, yield them as they come
|
||||
# do not yield AgentFinish, which will be handled below
|
||||
if self.yield_actions:
|
||||
if isinstance(chunk, AgentAction):
|
||||
yield AddableDict(actions=[chunk], messages=chunk.messages)
|
||||
elif isinstance(chunk, AgentStep):
|
||||
yield AddableDict(steps=[chunk], messages=chunk.messages)
|
||||
|
||||
# convert iterator output to format handled by _process_next_step_output
|
||||
next_step = self.agent_executor._consume_next_step(next_step_seq) # noqa: SLF001
|
||||
# update iterations and time elapsed
|
||||
self.update_iterations()
|
||||
# decide if this is the final output
|
||||
output = self._process_next_step_output(next_step, run_manager)
|
||||
is_final = "intermediate_step" not in output
|
||||
# yield the final output always
|
||||
# for backwards compat, yield int. output if not yielding actions
|
||||
if not self.yield_actions or is_final:
|
||||
yield output
|
||||
# if final output reached, stop iteration
|
||||
if is_final:
|
||||
return
|
||||
except BaseException as e:
|
||||
run_manager.on_chain_error(e)
|
||||
raise
|
||||
|
||||
# if we got here means we exhausted iterations or time
|
||||
yield self._stop(run_manager)
|
||||
|
||||
async def __aiter__(self) -> AsyncIterator[AddableDict]:
|
||||
"""Create an async iterator for the `AgentExecutor`.
|
||||
|
||||
N.B. __aiter__ must be a normal method, so need to initialize async run manager
|
||||
on first __anext__ call where we can await it.
|
||||
"""
|
||||
logger.debug("Initialising AgentExecutorIterator (async)")
|
||||
self.reset()
|
||||
callback_manager = AsyncCallbackManager.configure(
|
||||
self.callbacks,
|
||||
self.agent_executor.callbacks,
|
||||
self.agent_executor.verbose,
|
||||
self.tags,
|
||||
self.agent_executor.tags,
|
||||
self.metadata,
|
||||
self.agent_executor.metadata,
|
||||
)
|
||||
run_manager = await callback_manager.on_chain_start(
|
||||
dumpd(self.agent_executor),
|
||||
self.inputs,
|
||||
self.run_id,
|
||||
name=self.run_name,
|
||||
)
|
||||
try:
|
||||
async with asyncio_timeout(self.agent_executor.max_execution_time):
|
||||
while self.agent_executor._should_continue( # noqa: SLF001
|
||||
self.iterations,
|
||||
self.time_elapsed,
|
||||
):
|
||||
# take the next step: this plans next action, executes it,
|
||||
# yielding action and observation as they are generated
|
||||
next_step_seq: NextStepOutput = []
|
||||
async for chunk in self.agent_executor._aiter_next_step( # noqa: SLF001
|
||||
self.name_to_tool_map,
|
||||
self.color_mapping,
|
||||
self.inputs,
|
||||
self.intermediate_steps,
|
||||
run_manager,
|
||||
):
|
||||
next_step_seq.append(chunk)
|
||||
# if we're yielding actions, yield them as they come
|
||||
# do not yield AgentFinish, which will be handled below
|
||||
if self.yield_actions:
|
||||
if isinstance(chunk, AgentAction):
|
||||
yield AddableDict(
|
||||
actions=[chunk],
|
||||
messages=chunk.messages,
|
||||
)
|
||||
elif isinstance(chunk, AgentStep):
|
||||
yield AddableDict(
|
||||
steps=[chunk],
|
||||
messages=chunk.messages,
|
||||
)
|
||||
|
||||
# convert iterator output to format handled by _process_next_step
|
||||
next_step = self.agent_executor._consume_next_step(next_step_seq) # noqa: SLF001
|
||||
# update iterations and time elapsed
|
||||
self.update_iterations()
|
||||
# decide if this is the final output
|
||||
output = await self._aprocess_next_step_output(
|
||||
next_step,
|
||||
run_manager,
|
||||
)
|
||||
is_final = "intermediate_step" not in output
|
||||
# yield the final output always
|
||||
# for backwards compat, yield int. output if not yielding actions
|
||||
if not self.yield_actions or is_final:
|
||||
yield output
|
||||
# if final output reached, stop iteration
|
||||
if is_final:
|
||||
return
|
||||
except (TimeoutError, asyncio.TimeoutError):
|
||||
yield await self._astop(run_manager)
|
||||
return
|
||||
except BaseException as e:
|
||||
await run_manager.on_chain_error(e)
|
||||
raise
|
||||
|
||||
# if we got here means we exhausted iterations or time
|
||||
yield await self._astop(run_manager)
|
||||
|
||||
def _process_next_step_output(
|
||||
self,
|
||||
next_step_output: AgentFinish | list[tuple[AgentAction, str]],
|
||||
run_manager: CallbackManagerForChainRun,
|
||||
) -> AddableDict:
|
||||
"""Process the output of the next step.
|
||||
|
||||
Process the output of the next step,
|
||||
handling AgentFinish and tool return cases.
|
||||
"""
|
||||
logger.debug("Processing output of Agent loop step")
|
||||
if isinstance(next_step_output, AgentFinish):
|
||||
logger.debug(
|
||||
"Hit AgentFinish: _return -> on_chain_end -> run final output logic",
|
||||
)
|
||||
return self._return(next_step_output, run_manager=run_manager)
|
||||
|
||||
self.intermediate_steps.extend(next_step_output)
|
||||
logger.debug("Updated intermediate_steps with step output")
|
||||
|
||||
# Check for tool return
|
||||
if len(next_step_output) == 1:
|
||||
next_step_action = next_step_output[0]
|
||||
tool_return = self.agent_executor._get_tool_return(next_step_action) # noqa: SLF001
|
||||
if tool_return is not None:
|
||||
return self._return(tool_return, run_manager=run_manager)
|
||||
|
||||
return AddableDict(intermediate_step=next_step_output)
|
||||
|
||||
async def _aprocess_next_step_output(
|
||||
self,
|
||||
next_step_output: AgentFinish | list[tuple[AgentAction, str]],
|
||||
run_manager: AsyncCallbackManagerForChainRun,
|
||||
) -> AddableDict:
|
||||
"""Process the output of the next async step.
|
||||
|
||||
Process the output of the next async step,
|
||||
handling AgentFinish and tool return cases.
|
||||
"""
|
||||
logger.debug("Processing output of async Agent loop step")
|
||||
if isinstance(next_step_output, AgentFinish):
|
||||
logger.debug(
|
||||
"Hit AgentFinish: _areturn -> on_chain_end -> run final output logic",
|
||||
)
|
||||
return await self._areturn(next_step_output, run_manager=run_manager)
|
||||
|
||||
self.intermediate_steps.extend(next_step_output)
|
||||
logger.debug("Updated intermediate_steps with step output")
|
||||
|
||||
# Check for tool return
|
||||
if len(next_step_output) == 1:
|
||||
next_step_action = next_step_output[0]
|
||||
tool_return = self.agent_executor._get_tool_return(next_step_action) # noqa: SLF001
|
||||
if tool_return is not None:
|
||||
return await self._areturn(tool_return, run_manager=run_manager)
|
||||
|
||||
return AddableDict(intermediate_step=next_step_output)
|
||||
|
||||
def _stop(self, run_manager: CallbackManagerForChainRun) -> AddableDict:
|
||||
"""Stop the iterator.
|
||||
|
||||
Stop the iterator and raise a StopIteration exception with the stopped response.
|
||||
"""
|
||||
logger.warning("Stopping agent prematurely due to triggering stop condition")
|
||||
# this manually constructs agent finish with output key
|
||||
output = self.agent_executor._action_agent.return_stopped_response( # noqa: SLF001
|
||||
self.agent_executor.early_stopping_method,
|
||||
self.intermediate_steps,
|
||||
**self.inputs,
|
||||
)
|
||||
return self._return(output, run_manager=run_manager)
|
||||
|
||||
async def _astop(self, run_manager: AsyncCallbackManagerForChainRun) -> AddableDict:
|
||||
"""Stop the async iterator.
|
||||
|
||||
Stop the async iterator and raise a StopAsyncIteration exception with
|
||||
the stopped response.
|
||||
"""
|
||||
logger.warning("Stopping agent prematurely due to triggering stop condition")
|
||||
output = self.agent_executor._action_agent.return_stopped_response( # noqa: SLF001
|
||||
self.agent_executor.early_stopping_method,
|
||||
self.intermediate_steps,
|
||||
**self.inputs,
|
||||
)
|
||||
return await self._areturn(output, run_manager=run_manager)
|
||||
|
||||
def _return(
|
||||
self,
|
||||
output: AgentFinish,
|
||||
run_manager: CallbackManagerForChainRun,
|
||||
) -> AddableDict:
|
||||
"""Return the final output of the iterator."""
|
||||
returned_output = self.agent_executor._return( # noqa: SLF001
|
||||
output,
|
||||
self.intermediate_steps,
|
||||
run_manager=run_manager,
|
||||
)
|
||||
returned_output["messages"] = output.messages
|
||||
run_manager.on_chain_end(returned_output)
|
||||
return self.make_final_outputs(returned_output, run_manager)
|
||||
|
||||
async def _areturn(
|
||||
self,
|
||||
output: AgentFinish,
|
||||
run_manager: AsyncCallbackManagerForChainRun,
|
||||
) -> AddableDict:
|
||||
"""Return the final output of the async iterator."""
|
||||
returned_output = await self.agent_executor._areturn( # noqa: SLF001
|
||||
output,
|
||||
self.intermediate_steps,
|
||||
run_manager=run_manager,
|
||||
)
|
||||
returned_output["messages"] = output.messages
|
||||
await run_manager.on_chain_end(returned_output)
|
||||
return self.make_final_outputs(returned_output, run_manager)
|
||||
@@ -0,0 +1,167 @@
|
||||
"""Agent toolkits contain integrations with various resources and services.
|
||||
|
||||
LangChain has a large ecosystem of integrations with various external resources
|
||||
like local and remote file systems, APIs and databases.
|
||||
|
||||
These integrations allow developers to create versatile applications that combine the
|
||||
power of LLMs with the ability to access, interact with and manipulate external
|
||||
resources.
|
||||
|
||||
When developing an application, developers should inspect the capabilities and
|
||||
permissions of the tools that underlie the given agent toolkit, and determine
|
||||
whether permissions of the given toolkit are appropriate for the application.
|
||||
|
||||
See https://docs.langchain.com/oss/python/security-policy for more information.
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_core._api.path import as_import_path
|
||||
from langchain_core.tools.retriever import create_retriever_tool
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
from langchain_classic.agents.agent_toolkits.conversational_retrieval.openai_functions import ( # noqa: E501
|
||||
create_conversational_retrieval_agent,
|
||||
)
|
||||
from langchain_classic.agents.agent_toolkits.vectorstore.base import (
|
||||
create_vectorstore_agent,
|
||||
create_vectorstore_router_agent,
|
||||
)
|
||||
from langchain_classic.agents.agent_toolkits.vectorstore.toolkit import (
|
||||
VectorStoreInfo,
|
||||
VectorStoreRouterToolkit,
|
||||
VectorStoreToolkit,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.ainetwork.toolkit import AINetworkToolkit
|
||||
from langchain_community.agent_toolkits.amadeus.toolkit import AmadeusToolkit
|
||||
from langchain_community.agent_toolkits.azure_cognitive_services import (
|
||||
AzureCognitiveServicesToolkit,
|
||||
)
|
||||
from langchain_community.agent_toolkits.file_management.toolkit import (
|
||||
FileManagementToolkit,
|
||||
)
|
||||
from langchain_community.agent_toolkits.gmail.toolkit import GmailToolkit
|
||||
from langchain_community.agent_toolkits.jira.toolkit import JiraToolkit
|
||||
from langchain_community.agent_toolkits.json.base import create_json_agent
|
||||
from langchain_community.agent_toolkits.json.toolkit import JsonToolkit
|
||||
from langchain_community.agent_toolkits.multion.toolkit import MultionToolkit
|
||||
from langchain_community.agent_toolkits.nasa.toolkit import NasaToolkit
|
||||
from langchain_community.agent_toolkits.nla.toolkit import NLAToolkit
|
||||
from langchain_community.agent_toolkits.office365.toolkit import O365Toolkit
|
||||
from langchain_community.agent_toolkits.openapi.base import create_openapi_agent
|
||||
from langchain_community.agent_toolkits.openapi.toolkit import OpenAPIToolkit
|
||||
from langchain_community.agent_toolkits.playwright.toolkit import (
|
||||
PlayWrightBrowserToolkit,
|
||||
)
|
||||
from langchain_community.agent_toolkits.powerbi.base import create_pbi_agent
|
||||
from langchain_community.agent_toolkits.powerbi.chat_base import (
|
||||
create_pbi_chat_agent,
|
||||
)
|
||||
from langchain_community.agent_toolkits.powerbi.toolkit import PowerBIToolkit
|
||||
from langchain_community.agent_toolkits.slack.toolkit import SlackToolkit
|
||||
from langchain_community.agent_toolkits.spark_sql.base import create_spark_sql_agent
|
||||
from langchain_community.agent_toolkits.spark_sql.toolkit import SparkSQLToolkit
|
||||
from langchain_community.agent_toolkits.sql.base import create_sql_agent
|
||||
from langchain_community.agent_toolkits.sql.toolkit import SQLDatabaseToolkit
|
||||
from langchain_community.agent_toolkits.steam.toolkit import SteamToolkit
|
||||
from langchain_community.agent_toolkits.zapier.toolkit import ZapierToolkit
|
||||
|
||||
DEPRECATED_AGENTS = [
|
||||
"create_csv_agent",
|
||||
"create_pandas_dataframe_agent",
|
||||
"create_xorbits_agent",
|
||||
"create_python_agent",
|
||||
"create_spark_dataframe_agent",
|
||||
]
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"AINetworkToolkit": "langchain_community.agent_toolkits.ainetwork.toolkit",
|
||||
"AmadeusToolkit": "langchain_community.agent_toolkits.amadeus.toolkit",
|
||||
"AzureCognitiveServicesToolkit": (
|
||||
"langchain_community.agent_toolkits.azure_cognitive_services"
|
||||
),
|
||||
"FileManagementToolkit": (
|
||||
"langchain_community.agent_toolkits.file_management.toolkit"
|
||||
),
|
||||
"GmailToolkit": "langchain_community.agent_toolkits.gmail.toolkit",
|
||||
"JiraToolkit": "langchain_community.agent_toolkits.jira.toolkit",
|
||||
"JsonToolkit": "langchain_community.agent_toolkits.json.toolkit",
|
||||
"MultionToolkit": "langchain_community.agent_toolkits.multion.toolkit",
|
||||
"NasaToolkit": "langchain_community.agent_toolkits.nasa.toolkit",
|
||||
"NLAToolkit": "langchain_community.agent_toolkits.nla.toolkit",
|
||||
"O365Toolkit": "langchain_community.agent_toolkits.office365.toolkit",
|
||||
"OpenAPIToolkit": "langchain_community.agent_toolkits.openapi.toolkit",
|
||||
"PlayWrightBrowserToolkit": "langchain_community.agent_toolkits.playwright.toolkit",
|
||||
"PowerBIToolkit": "langchain_community.agent_toolkits.powerbi.toolkit",
|
||||
"SlackToolkit": "langchain_community.agent_toolkits.slack.toolkit",
|
||||
"SteamToolkit": "langchain_community.agent_toolkits.steam.toolkit",
|
||||
"SQLDatabaseToolkit": "langchain_community.agent_toolkits.sql.toolkit",
|
||||
"SparkSQLToolkit": "langchain_community.agent_toolkits.spark_sql.toolkit",
|
||||
"ZapierToolkit": "langchain_community.agent_toolkits.zapier.toolkit",
|
||||
"create_json_agent": "langchain_community.agent_toolkits.json.base",
|
||||
"create_openapi_agent": "langchain_community.agent_toolkits.openapi.base",
|
||||
"create_pbi_agent": "langchain_community.agent_toolkits.powerbi.base",
|
||||
"create_pbi_chat_agent": "langchain_community.agent_toolkits.powerbi.chat_base",
|
||||
"create_spark_sql_agent": "langchain_community.agent_toolkits.spark_sql.base",
|
||||
"create_sql_agent": "langchain_community.agent_toolkits.sql.base",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Get attr name."""
|
||||
if name in DEPRECATED_AGENTS:
|
||||
relative_path = as_import_path(Path(__file__).parent, suffix=name)
|
||||
old_path = "langchain_classic." + relative_path
|
||||
new_path = "langchain_experimental." + relative_path
|
||||
msg = (
|
||||
f"{name} has been moved to langchain_experimental. "
|
||||
"See https://github.com/langchain-ai/langchain/discussions/11680"
|
||||
"for more information.\n"
|
||||
f"Please update your import statement from: `{old_path}` to `{new_path}`."
|
||||
)
|
||||
raise ImportError(msg)
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"AINetworkToolkit",
|
||||
"AmadeusToolkit",
|
||||
"AzureCognitiveServicesToolkit",
|
||||
"FileManagementToolkit",
|
||||
"GmailToolkit",
|
||||
"JiraToolkit",
|
||||
"JsonToolkit",
|
||||
"MultionToolkit",
|
||||
"NLAToolkit",
|
||||
"NasaToolkit",
|
||||
"O365Toolkit",
|
||||
"OpenAPIToolkit",
|
||||
"PlayWrightBrowserToolkit",
|
||||
"PowerBIToolkit",
|
||||
"SQLDatabaseToolkit",
|
||||
"SlackToolkit",
|
||||
"SparkSQLToolkit",
|
||||
"SteamToolkit",
|
||||
"VectorStoreInfo",
|
||||
"VectorStoreRouterToolkit",
|
||||
"VectorStoreToolkit",
|
||||
"ZapierToolkit",
|
||||
"create_conversational_retrieval_agent",
|
||||
"create_json_agent",
|
||||
"create_openapi_agent",
|
||||
"create_pbi_agent",
|
||||
"create_pbi_chat_agent",
|
||||
"create_retriever_tool",
|
||||
"create_spark_sql_agent",
|
||||
"create_sql_agent",
|
||||
"create_vectorstore_agent",
|
||||
"create_vectorstore_router_agent",
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
"""AINetwork toolkit."""
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.ainetwork.toolkit import AINetworkToolkit
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"AINetworkToolkit": "langchain_community.agent_toolkits.ainetwork.toolkit",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"AINetworkToolkit",
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.amadeus.toolkit import AmadeusToolkit
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"AmadeusToolkit": "langchain_community.agent_toolkits.amadeus.toolkit",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = ["AmadeusToolkit"]
|
||||
@@ -0,0 +1,29 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.azure_cognitive_services import (
|
||||
AzureCognitiveServicesToolkit,
|
||||
)
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"AzureCognitiveServicesToolkit": (
|
||||
"langchain_community.agent_toolkits.azure_cognitive_services"
|
||||
),
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"AzureCognitiveServicesToolkit",
|
||||
]
|
||||
@@ -0,0 +1,3 @@
|
||||
from langchain_core.tools import BaseToolkit
|
||||
|
||||
__all__ = ["BaseToolkit"]
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.clickup.toolkit import ClickupToolkit
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"ClickupToolkit": "langchain_community.agent_toolkits.clickup.toolkit",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"ClickupToolkit",
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,85 @@
|
||||
from typing import Any
|
||||
|
||||
from langchain_core.language_models import BaseLanguageModel
|
||||
from langchain_core.messages import SystemMessage
|
||||
from langchain_core.prompts.chat import MessagesPlaceholder
|
||||
from langchain_core.tools import BaseTool
|
||||
|
||||
from langchain_classic.agents.agent import AgentExecutor
|
||||
from langchain_classic.agents.openai_functions_agent.agent_token_buffer_memory import (
|
||||
AgentTokenBufferMemory,
|
||||
)
|
||||
from langchain_classic.agents.openai_functions_agent.base import OpenAIFunctionsAgent
|
||||
from langchain_classic.base_memory import BaseMemory
|
||||
from langchain_classic.memory.token_buffer import ConversationTokenBufferMemory
|
||||
|
||||
|
||||
def _get_default_system_message() -> SystemMessage:
|
||||
return SystemMessage(
|
||||
content=(
|
||||
"Do your best to answer the questions. "
|
||||
"Feel free to use any tools available to look up "
|
||||
"relevant information, only if necessary"
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def create_conversational_retrieval_agent(
|
||||
llm: BaseLanguageModel,
|
||||
tools: list[BaseTool],
|
||||
remember_intermediate_steps: bool = True, # noqa: FBT001,FBT002
|
||||
memory_key: str = "chat_history",
|
||||
system_message: SystemMessage | None = None,
|
||||
verbose: bool = False, # noqa: FBT001,FBT002
|
||||
max_token_limit: int = 2000,
|
||||
**kwargs: Any,
|
||||
) -> AgentExecutor:
|
||||
"""A convenience method for creating a conversational retrieval agent.
|
||||
|
||||
Args:
|
||||
llm: The language model to use, should be `ChatOpenAI`
|
||||
tools: A list of tools the agent has access to
|
||||
remember_intermediate_steps: Whether the agent should remember intermediate
|
||||
steps or not. Intermediate steps refer to prior action/observation
|
||||
pairs from previous questions. The benefit of remembering these is if
|
||||
there is relevant information in there, the agent can use it to answer
|
||||
follow up questions. The downside is it will take up more tokens.
|
||||
memory_key: The name of the memory key in the prompt.
|
||||
system_message: The system message to use. By default, a basic one will
|
||||
be used.
|
||||
verbose: Whether or not the final AgentExecutor should be verbose or not.
|
||||
max_token_limit: The max number of tokens to keep around in memory.
|
||||
**kwargs: Additional keyword arguments to pass to the `AgentExecutor`.
|
||||
|
||||
Returns:
|
||||
An agent executor initialized appropriately
|
||||
"""
|
||||
if remember_intermediate_steps:
|
||||
memory: BaseMemory = AgentTokenBufferMemory(
|
||||
memory_key=memory_key,
|
||||
llm=llm,
|
||||
max_token_limit=max_token_limit,
|
||||
)
|
||||
else:
|
||||
memory = ConversationTokenBufferMemory(
|
||||
memory_key=memory_key,
|
||||
return_messages=True,
|
||||
output_key="output",
|
||||
llm=llm,
|
||||
max_token_limit=max_token_limit,
|
||||
)
|
||||
|
||||
_system_message = system_message or _get_default_system_message()
|
||||
prompt = OpenAIFunctionsAgent.create_prompt(
|
||||
system_message=_system_message,
|
||||
extra_prompt_messages=[MessagesPlaceholder(variable_name=memory_key)],
|
||||
)
|
||||
agent = OpenAIFunctionsAgent(llm=llm, tools=tools, prompt=prompt)
|
||||
return AgentExecutor(
|
||||
agent=agent,
|
||||
tools=tools,
|
||||
memory=memory,
|
||||
verbose=verbose,
|
||||
return_intermediate_steps=remember_intermediate_steps,
|
||||
**kwargs,
|
||||
)
|
||||
@@ -0,0 +1,3 @@
|
||||
from langchain_classic.tools.retriever import create_retriever_tool
|
||||
|
||||
__all__ = ["create_retriever_tool"]
|
||||
@@ -0,0 +1,20 @@
|
||||
from typing import Any
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Get attr name."""
|
||||
if name == "create_csv_agent":
|
||||
msg = (
|
||||
"This agent has been moved to langchain_experimental. "
|
||||
"This agent relies on python REPL tool under the hood, so to use it "
|
||||
"safely please sandbox the python REPL. "
|
||||
"Read https://github.com/langchain-ai/langchain/blob/master/SECURITY.md "
|
||||
"and https://github.com/langchain-ai/langchain/discussions/11680"
|
||||
"To keep using this code as is, install langchain_experimental and "
|
||||
"update your import statement from:\n "
|
||||
f"`langchain_classic.agents.agent_toolkits.csv.{name}` to "
|
||||
f"`langchain_experimental.agents.agent_toolkits.{name}`."
|
||||
)
|
||||
raise ImportError(msg)
|
||||
msg = f"{name} does not exist"
|
||||
raise AttributeError(msg)
|
||||
Binary file not shown.
@@ -0,0 +1,31 @@
|
||||
"""Local file management toolkit."""
|
||||
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.file_management.toolkit import (
|
||||
FileManagementToolkit,
|
||||
)
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"FileManagementToolkit": (
|
||||
"langchain_community.agent_toolkits.file_management.toolkit"
|
||||
),
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"FileManagementToolkit",
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,29 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.file_management.toolkit import (
|
||||
FileManagementToolkit,
|
||||
)
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"FileManagementToolkit": (
|
||||
"langchain_community.agent_toolkits.file_management.toolkit"
|
||||
),
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"FileManagementToolkit",
|
||||
]
|
||||
@@ -0,0 +1 @@
|
||||
"""GitHub Toolkit."""
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,69 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.github.toolkit import (
|
||||
BranchName,
|
||||
CommentOnIssue,
|
||||
CreateFile,
|
||||
CreatePR,
|
||||
CreateReviewRequest,
|
||||
DeleteFile,
|
||||
DirectoryPath,
|
||||
GetIssue,
|
||||
GetPR,
|
||||
GitHubToolkit,
|
||||
NoInput,
|
||||
ReadFile,
|
||||
SearchCode,
|
||||
SearchIssuesAndPRs,
|
||||
UpdateFile,
|
||||
)
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"NoInput": "langchain_community.agent_toolkits.github.toolkit",
|
||||
"GetIssue": "langchain_community.agent_toolkits.github.toolkit",
|
||||
"CommentOnIssue": "langchain_community.agent_toolkits.github.toolkit",
|
||||
"GetPR": "langchain_community.agent_toolkits.github.toolkit",
|
||||
"CreatePR": "langchain_community.agent_toolkits.github.toolkit",
|
||||
"CreateFile": "langchain_community.agent_toolkits.github.toolkit",
|
||||
"ReadFile": "langchain_community.agent_toolkits.github.toolkit",
|
||||
"UpdateFile": "langchain_community.agent_toolkits.github.toolkit",
|
||||
"DeleteFile": "langchain_community.agent_toolkits.github.toolkit",
|
||||
"DirectoryPath": "langchain_community.agent_toolkits.github.toolkit",
|
||||
"BranchName": "langchain_community.agent_toolkits.github.toolkit",
|
||||
"SearchCode": "langchain_community.agent_toolkits.github.toolkit",
|
||||
"CreateReviewRequest": "langchain_community.agent_toolkits.github.toolkit",
|
||||
"SearchIssuesAndPRs": "langchain_community.agent_toolkits.github.toolkit",
|
||||
"GitHubToolkit": "langchain_community.agent_toolkits.github.toolkit",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"BranchName",
|
||||
"CommentOnIssue",
|
||||
"CreateFile",
|
||||
"CreatePR",
|
||||
"CreateReviewRequest",
|
||||
"DeleteFile",
|
||||
"DirectoryPath",
|
||||
"GetIssue",
|
||||
"GetPR",
|
||||
"GitHubToolkit",
|
||||
"NoInput",
|
||||
"ReadFile",
|
||||
"SearchCode",
|
||||
"SearchIssuesAndPRs",
|
||||
"UpdateFile",
|
||||
]
|
||||
@@ -0,0 +1 @@
|
||||
"""GitLab Toolkit."""
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.gitlab.toolkit import GitLabToolkit
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"GitLabToolkit": "langchain_community.agent_toolkits.gitlab.toolkit",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"GitLabToolkit",
|
||||
]
|
||||
@@ -0,0 +1 @@
|
||||
"""Gmail toolkit."""
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.gmail.toolkit import GmailToolkit
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {"GmailToolkit": "langchain_community.agent_toolkits.gmail.toolkit"}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"GmailToolkit",
|
||||
]
|
||||
@@ -0,0 +1 @@
|
||||
"""Jira Toolkit."""
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.jira.toolkit import JiraToolkit
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {"JiraToolkit": "langchain_community.agent_toolkits.jira.toolkit"}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"JiraToolkit",
|
||||
]
|
||||
@@ -0,0 +1 @@
|
||||
"""Json agent."""
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.json.base import create_json_agent
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"create_json_agent": "langchain_community.agent_toolkits.json.base",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"create_json_agent",
|
||||
]
|
||||
@@ -0,0 +1,24 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.json.prompt import JSON_PREFIX, JSON_SUFFIX
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"JSON_PREFIX": "langchain_community.agent_toolkits.json.prompt",
|
||||
"JSON_SUFFIX": "langchain_community.agent_toolkits.json.prompt",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = ["JSON_PREFIX", "JSON_SUFFIX"]
|
||||
@@ -0,0 +1,23 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.json.toolkit import JsonToolkit
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {"JsonToolkit": "langchain_community.agent_toolkits.json.toolkit"}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"JsonToolkit",
|
||||
]
|
||||
@@ -0,0 +1 @@
|
||||
"""MultiOn Toolkit."""
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.multion.toolkit import MultionToolkit
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"MultionToolkit": "langchain_community.agent_toolkits.multion.toolkit",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"MultionToolkit",
|
||||
]
|
||||
@@ -0,0 +1 @@
|
||||
"""NASA Toolkit."""
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.nasa.toolkit import NasaToolkit
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {"NasaToolkit": "langchain_community.agent_toolkits.nasa.toolkit"}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"NasaToolkit",
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.nla.tool import NLATool
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {"NLATool": "langchain_community.agent_toolkits.nla.tool"}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"NLATool",
|
||||
]
|
||||
@@ -0,0 +1,23 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.nla.toolkit import NLAToolkit
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {"NLAToolkit": "langchain_community.agent_toolkits.nla.toolkit"}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"NLAToolkit",
|
||||
]
|
||||
@@ -0,0 +1 @@
|
||||
"""Office365 toolkit."""
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.office365.toolkit import O365Toolkit
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"O365Toolkit": "langchain_community.agent_toolkits.office365.toolkit",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"O365Toolkit",
|
||||
]
|
||||
@@ -0,0 +1 @@
|
||||
"""OpenAPI spec agent."""
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.openapi.base import create_openapi_agent
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"create_openapi_agent": "langchain_community.agent_toolkits.openapi.base",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"create_openapi_agent",
|
||||
]
|
||||
@@ -0,0 +1,52 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.openapi.planner import (
|
||||
RequestsDeleteToolWithParsing,
|
||||
RequestsGetToolWithParsing,
|
||||
RequestsPatchToolWithParsing,
|
||||
RequestsPostToolWithParsing,
|
||||
RequestsPutToolWithParsing,
|
||||
create_openapi_agent,
|
||||
)
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"RequestsGetToolWithParsing": (
|
||||
"langchain_community.agent_toolkits.openapi.planner"
|
||||
),
|
||||
"RequestsPostToolWithParsing": (
|
||||
"langchain_community.agent_toolkits.openapi.planner"
|
||||
),
|
||||
"RequestsPatchToolWithParsing": (
|
||||
"langchain_community.agent_toolkits.openapi.planner"
|
||||
),
|
||||
"RequestsPutToolWithParsing": (
|
||||
"langchain_community.agent_toolkits.openapi.planner"
|
||||
),
|
||||
"RequestsDeleteToolWithParsing": (
|
||||
"langchain_community.agent_toolkits.openapi.planner"
|
||||
),
|
||||
"create_openapi_agent": "langchain_community.agent_toolkits.openapi.planner",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"RequestsDeleteToolWithParsing",
|
||||
"RequestsGetToolWithParsing",
|
||||
"RequestsPatchToolWithParsing",
|
||||
"RequestsPostToolWithParsing",
|
||||
"RequestsPutToolWithParsing",
|
||||
"create_openapi_agent",
|
||||
]
|
||||
@@ -0,0 +1,103 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.openapi.planner_prompt import (
|
||||
API_CONTROLLER_PROMPT,
|
||||
API_CONTROLLER_TOOL_DESCRIPTION,
|
||||
API_CONTROLLER_TOOL_NAME,
|
||||
API_ORCHESTRATOR_PROMPT,
|
||||
API_PLANNER_PROMPT,
|
||||
API_PLANNER_TOOL_DESCRIPTION,
|
||||
API_PLANNER_TOOL_NAME,
|
||||
PARSING_DELETE_PROMPT,
|
||||
PARSING_GET_PROMPT,
|
||||
PARSING_PATCH_PROMPT,
|
||||
PARSING_POST_PROMPT,
|
||||
PARSING_PUT_PROMPT,
|
||||
REQUESTS_DELETE_TOOL_DESCRIPTION,
|
||||
REQUESTS_GET_TOOL_DESCRIPTION,
|
||||
REQUESTS_PATCH_TOOL_DESCRIPTION,
|
||||
REQUESTS_POST_TOOL_DESCRIPTION,
|
||||
REQUESTS_PUT_TOOL_DESCRIPTION,
|
||||
)
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"API_CONTROLLER_PROMPT": (
|
||||
"langchain_community.agent_toolkits.openapi.planner_prompt"
|
||||
),
|
||||
"API_CONTROLLER_TOOL_DESCRIPTION": (
|
||||
"langchain_community.agent_toolkits.openapi.planner_prompt"
|
||||
),
|
||||
"API_CONTROLLER_TOOL_NAME": (
|
||||
"langchain_community.agent_toolkits.openapi.planner_prompt"
|
||||
),
|
||||
"API_ORCHESTRATOR_PROMPT": (
|
||||
"langchain_community.agent_toolkits.openapi.planner_prompt"
|
||||
),
|
||||
"API_PLANNER_PROMPT": ("langchain_community.agent_toolkits.openapi.planner_prompt"),
|
||||
"API_PLANNER_TOOL_DESCRIPTION": (
|
||||
"langchain_community.agent_toolkits.openapi.planner_prompt"
|
||||
),
|
||||
"API_PLANNER_TOOL_NAME": (
|
||||
"langchain_community.agent_toolkits.openapi.planner_prompt"
|
||||
),
|
||||
"PARSING_DELETE_PROMPT": (
|
||||
"langchain_community.agent_toolkits.openapi.planner_prompt"
|
||||
),
|
||||
"PARSING_GET_PROMPT": ("langchain_community.agent_toolkits.openapi.planner_prompt"),
|
||||
"PARSING_PATCH_PROMPT": (
|
||||
"langchain_community.agent_toolkits.openapi.planner_prompt"
|
||||
),
|
||||
"PARSING_POST_PROMPT": (
|
||||
"langchain_community.agent_toolkits.openapi.planner_prompt"
|
||||
),
|
||||
"PARSING_PUT_PROMPT": ("langchain_community.agent_toolkits.openapi.planner_prompt"),
|
||||
"REQUESTS_DELETE_TOOL_DESCRIPTION": (
|
||||
"langchain_community.agent_toolkits.openapi.planner_prompt"
|
||||
),
|
||||
"REQUESTS_GET_TOOL_DESCRIPTION": (
|
||||
"langchain_community.agent_toolkits.openapi.planner_prompt"
|
||||
),
|
||||
"REQUESTS_PATCH_TOOL_DESCRIPTION": (
|
||||
"langchain_community.agent_toolkits.openapi.planner_prompt"
|
||||
),
|
||||
"REQUESTS_POST_TOOL_DESCRIPTION": (
|
||||
"langchain_community.agent_toolkits.openapi.planner_prompt"
|
||||
),
|
||||
"REQUESTS_PUT_TOOL_DESCRIPTION": (
|
||||
"langchain_community.agent_toolkits.openapi.planner_prompt"
|
||||
),
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"API_CONTROLLER_PROMPT",
|
||||
"API_CONTROLLER_TOOL_DESCRIPTION",
|
||||
"API_CONTROLLER_TOOL_NAME",
|
||||
"API_ORCHESTRATOR_PROMPT",
|
||||
"API_PLANNER_PROMPT",
|
||||
"API_PLANNER_TOOL_DESCRIPTION",
|
||||
"API_PLANNER_TOOL_NAME",
|
||||
"PARSING_DELETE_PROMPT",
|
||||
"PARSING_GET_PROMPT",
|
||||
"PARSING_PATCH_PROMPT",
|
||||
"PARSING_POST_PROMPT",
|
||||
"PARSING_PUT_PROMPT",
|
||||
"REQUESTS_DELETE_TOOL_DESCRIPTION",
|
||||
"REQUESTS_GET_TOOL_DESCRIPTION",
|
||||
"REQUESTS_PATCH_TOOL_DESCRIPTION",
|
||||
"REQUESTS_POST_TOOL_DESCRIPTION",
|
||||
"REQUESTS_PUT_TOOL_DESCRIPTION",
|
||||
]
|
||||
@@ -0,0 +1,29 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.openapi.prompt import (
|
||||
DESCRIPTION,
|
||||
OPENAPI_PREFIX,
|
||||
OPENAPI_SUFFIX,
|
||||
)
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"DESCRIPTION": "langchain_community.agent_toolkits.openapi.prompt",
|
||||
"OPENAPI_PREFIX": "langchain_community.agent_toolkits.openapi.prompt",
|
||||
"OPENAPI_SUFFIX": "langchain_community.agent_toolkits.openapi.prompt",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = ["DESCRIPTION", "OPENAPI_PREFIX", "OPENAPI_SUFFIX"]
|
||||
@@ -0,0 +1,30 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.openapi.spec import (
|
||||
ReducedOpenAPISpec,
|
||||
reduce_openapi_spec,
|
||||
)
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"ReducedOpenAPISpec": "langchain_community.agent_toolkits.openapi.spec",
|
||||
"reduce_openapi_spec": "langchain_community.agent_toolkits.openapi.spec",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"ReducedOpenAPISpec",
|
||||
"reduce_openapi_spec",
|
||||
]
|
||||
@@ -0,0 +1,30 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain_classic._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.agent_toolkits.openapi.toolkit import (
|
||||
OpenAPIToolkit,
|
||||
RequestsToolkit,
|
||||
)
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"RequestsToolkit": "langchain_community.agent_toolkits.openapi.toolkit",
|
||||
"OpenAPIToolkit": "langchain_community.agent_toolkits.openapi.toolkit",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"OpenAPIToolkit",
|
||||
"RequestsToolkit",
|
||||
]
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user