langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
94.04k stars 15.16k forks source link

Vertex ChatVertexAI() doesn't support initialize_agent() as OutputParserException error #5301

Closed axacheng closed 1 year ago

axacheng commented 1 year ago

System Info

google-cloud-aiplatform==1.25.0 langchain==0.0.180 python 3.11

Who can help?

@dev2049 @Jflick58 @hwchase17

Information

Related Components

Reproduction

question1 = "I am axa, I'm a 2 months old baby.." question2 = "I like eating 🍌 🍉 🫐 but dislike 🥑" question3 = "what is my name?" question4 = "Do i disklike 🍌?"

agent_chain = initialize_agent( agent=AgentType.CONVERSATIONAL_REACT_DESCRIPTION, tools=[], llm=llm, verbose=True, max_iterations=3, memory=ConversationBufferMemory( memory_key="chat_history", return_messages=True), )

agent_chain.run(input=question1) agent_chain.run(input=question2) agent_chain.run(input=question3) agent_chain.run(input=question4)

File "/Users/axa/workspace/h/default/genai_learning/post/api/app/routes/v1/quiz_chat.py", line 271, in ask agent_chain.run(input=question1) File "/Users/axa/workspace/h/default/genai_learning/post/.venv/lib/python3.11/site-packages/langchain/chains/base.py", line 239, in run return self(kwargs, callbacks=callbacks)[self.output_keys[0]] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/axa/workspace/h/default/genai_learning/post/.venv/lib/python3.11/site-packages/langchain/chains/base.py", line 140, in call raise e File "/Users/axa/workspace/h/default/genai_learning/post/.venv/lib/python3.11/site-packages/langchain/chains/base.py", line 134, in call self._call(inputs, run_manager=run_manager) File "/Users/axa/workspace/h/default/genai_learning/post/.venv/lib/python3.11/site-packages/langchain/agents/agent.py", line 951, in _call next_step_output = self._take_next_step( ^^^^^^^^^^^^^^^^^^^^^ File "/Users/axa/workspace/h/default/genai_learning/post/.venv/lib/python3.11/site-packages/langchain/agents/agent.py", line 773, in _take_next_step raise e File "/Users/axa/workspace/h/default/genai_learning/post/.venv/lib/python3.11/site-packages/langchain/agents/agent.py", line 762, in _take_next_step output = self.agent.plan( ^^^^^^^^^^^^^^^^ File "/Users/axa/workspace/h/default/genai_learning/post/.venv/lib/python3.11/site-packages/langchain/agents/agent.py", line 444, in plan return self.output_parser.parse(full_output) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/axa/workspace/h/default/genai_learning/post/.venv/lib/python3.11/site-packages/langchain/agents/conversational/output_parser.py", line 23, in parse raise OutputParserException(f"Could not parse LLM output: {text}") langchain.schema.OutputParserException: Could not parse LLM output: `Hi Axa, it's nice to meet you! I'm Bard, a large language model, also known as a conversational AI or chatbot trained to be informative and comprehensive. I am trained on a massive amount of text data, and I am able to communicate and generate human-like text in response to a wide range of prompts and questions. For example, I can provide summaries of factual topics or create stories.

Expected behavior

When I used same code but ChatOpenAI() it worked perfectly.

Entering new AgentExecutor chain... Thought: Do I need to use a tool? No

AI: Hello Axa! As an AI language model, I'm not able to see or interact with you physically, but I'm here to assist you with any questions or topics you might have. How can I assist you today?

Finished chain.

Entering new AgentExecutor chain... Thought: Do I need to use a tool? No

AI: It's great to hear that you enjoy eating bananas, watermelons, and blueberries! However, it's understandable that you might not like avocados. Everyone has their own preferences when it comes to food. Is there anything else you would like to discuss or ask about?

Finished chain.

Entering new AgentExecutor chain... Thought: Do I need to use a tool? No AI: Your name is Axa, as you mentioned earlier.

Finished chain.

Entering new AgentExecutor chain... Thought: Do I need to use a tool? No AI: You did not mention that you dislike bananas, so I cannot say for sure. However, based on your previous message, it seems that you enjoy eating bananas.

Finished chain. INFO: 127.0.0.1:57044 - "POST /api/v1/quiz/ask HTTP/1.1" 200 OK

dosubot[bot] commented 1 year ago

Hi, @axacheng. 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.

Based on my understanding, you reported an issue regarding the Vertex ChatVertexAI() function not supporting initialize_agent() and throwing an OutputParserException error. However, there haven't been any further activities or comments on this issue since you reported it.

Could you please let us know if this issue is still relevant to the latest version of the LangChain repository? If it is, please comment on the issue to let the LangChain team know. Otherwise, feel free to close the issue yourself, or the issue will be automatically closed in 7 days.

Thank you for your understanding and contribution to the LangChain project. If you have any further questions or need assistance, please don't hesitate to ask.