langchain
langchain copied to clipboard
Issue: PlanAndExecute agent fails in chat mode when a simple chat interaction is required.
Issue you'd like to raise.
PlanAndExecute agent is rising errors when no questions are asked (e.g. a greeting interaction). Is there any Chat implementation where a simple LLM chat interaction is available among the available tools?
Thank you in advance.
Suggestion:
No response
🤖 AI-generated response by Steercode - chat with Langchain codebase Disclaimer: SteerCode Chat may provide inaccurate information about the Langchain codebase.
In the Langchain codebase, you can use the ConversationalChatAgent class to handle simple chat interactions. You can create an instance of this class using the from_llm_and_tools() method, which takes a language model and a sequence of tools as its arguments.
Here's an example of how to create a chat agent using the ConversationalChatAgent class:
from langchain.agents.conversational_chat.base import ConversationalChatAgent
from langchain.llm.base import BaseLanguageModel
from langchain.tools.base import BaseTool
# Initialize your language model and tools
llm = BaseLanguageModel()
tools = [BaseTool()]
# Create a ConversationalChatAgent instance
chat_agent = ConversationalChatAgent.from_llm_and_tools(llm=llm, tools=tools)
Once you have a ConversationalChatAgent instance, you can use it to handle chat interactions without raising errors when receiving non-question inputs like greetings.
You can continue the conversation at https://steercode.com/
What is the tool usage policy of base ConversationalChatAgent?
is there an example ?
Hi, @pretidav! I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.
From what I understand, the issue is about errors encountered by the PlanAndExecute agent when no questions are asked. In the comments, a user named "zvadaadam" suggests using the ConversationalChatAgent class in the Langchain codebase and provides an example of how to create a chat agent. Another user named "pretidav" asks about the tool usage policy, and "firaskudsy" asks for an example.
Before we close this issue, we wanted to check if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself or it will be automatically closed in 7 days.
Thank you for your understanding and contribution to the LangChain project!