Replies: 3 comments 2 replies
-
Hey @Onturenio, try adding enter ("\n") after "Observation:" word inside your prompt template. Before:
After:
|
Beta Was this translation helpful? Give feedback.
-
I'm having the same issue of an endless loop with a basic Tools Agent: agent = (
RunnablePassthrough.assign(
agent_scratchpad=lambda x: format_to_openai_tool_messages(
x["intermediate_steps"]
)
)
| prompt
| llm_with_tools
# | OpenAIToolsAgentOutputParser()
| CustomOpenAIToolsAgentOutputParser()
)
agent_executor = AgentExecutor(tools=tools, agent=agent, verbose=True) When I use the However, when I use my Any ideas what the problem could be? |
Beta Was this translation helpful? Give feedback.
-
I Solved this issue by changing the prompt template Changed from this
To this
|
Beta Was this translation helpful? Give feedback.
-
I'm following the Custom LLM Agent tutorial. I have created an agent with the following prompt template:
Then I define a custom prompt based on the
CustomPromptTemplate
from the tutorial. I also take theCustomOutputParser
from there.I have define an ultra simple tool that outputs two simple sentences:
With this, I go ahead and create and use the agent:
And the problem is that this starts an endless loop where the tool is correctly used, it outputs what it has to, but the Agent does ignore this and keeps using the tool forever:
Am I missfollowing the guidelines? Should I use a different type of Agent? I'm very close to believe that this is some sort of bug in LangChain, or at least in the documentation.
Beta Was this translation helpful? Give feedback.
All reactions