Replies: 1 comment 1 reply
-
🤖 Hey @652994331, great to see you diving into LangChain again! Always a pleasure to help out a familiar face. 🚀 To create a zero-shot react agent in LangChain with the ability of a csv_agent embedded inside, you would need to create a Here's an example of how you might do this: from langchain import hub
from langchain_community.llms import OpenAI
from langchain.agents import AgentExecutor, create_react_agent
from langchain.tools.csv_agent import CSVAgent # Assuming CSVAgent is a BaseTool
prompt = hub.pull("hwchase17/react")
model = OpenAI()
csv_agent = CSVAgent() # Initialize your CSVAgent
tools = [csv_agent] # Include CSVAgent in the tools sequence
agent = create_react_agent(model, tools, prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools)
agent_executor.invoke({"input": "hi"}) In this example, Please note that the actual implementation of The Here is a simplified version of the class BaseTool(RunnableSerializable[Union[str, Dict], Any]):
"""Interface LangChain tools must implement."""
name: str
description: str
args_schema: Optional[Type[BaseModel]] = None
return_direct: bool = False
verbose: bool = False
callbacks: Callbacks = Field(default=None, exclude=True)
callback_manager: Optional[BaseCallbackManager] = Field(default=None, exclude=True)
tags: Optional[List[str]] = None
metadata: Optional[Dict[str, Any]] = None
handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False
handle_validation_error: Optional[Union[bool, str, Callable[[ValidationError], str]]] = False
@abstractmethod
def _run(self, *args: Any, **kwargs: Any) -> Any:
"""Use the tool."""
async def _arun(self, *args: Any, **kwargs: Any) -> Any:
"""Use the tool asynchronously.""" This class is used as a base for creating specific tools in the LangChain framework. Each tool must implement the You can find more information about the SourcesThis response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Commit to Help
Example Code
Description
hi , I am new to langchain, it's awesome. just finished "toolkit (csv_agent)" and agent examples parts. from agent examples, i learnt a lot of methods how to build an react agents. I think the key component is: agent_chain = initialize_agent(tools, llm, agent=AgentType.CHAT_CONVERSATIONAL_REACT_DESCRIPTION, verbose=True, memory=memory). I found some agentType in the package but there is no csv , pandas and ..... . however, for toolkit part , we have some csv_agent, pandas_agent that are build with : agent = create_csv_agent(OpenAI(temperature=0), 'titanic.csv', verbose=True). create_csv_agent , create_panda_agent ... . my question is, what if I wanna build a zero shot react agent with the ability of csv_agent inside , like making csv_agent a tool or something. but I don't know how to make it. I found someone is using python ability to create agent. but #11429 shows that "PythonREPLTool" is a tool and build a react agent with python toolkinda make sense. but I can't find any csv , panda tool that can be use.
System Info
langchain/langchain_experimental == 0.1.5
ubuntu
Beta Was this translation helpful? Give feedback.
All reactions