I have been working with LangChain for some time, and after updating my LangChain module to version 0.0.295 or higher, my Vertex AI models throw an error in my application. The error is
File "E:\Office\2023\AI-Platform\kaya-aia-general-bot\venv\Lib\site-packages\langchain\llms\vertexai.py", line 301, in _generate
generations.append([_response_to_generation(r) for r in res.candidates])
^^^^^^^^^^^^^^
AttributeError: 'TextGenerationResponse' object has no attribute 'candidates'
I was expecting my previous implementation to work seamlessly. This is how I initialized the chain with the vertex model.
case 'public_general_palm':
llm = ChatVertexAI(model_name="chat-bison", temperature=0)
chain = self.__initialize_basic_chain(llm, self.chain_memory)
return chain(request.msg, return_only_outputs=True)
This is the __initialize_basic_chain method.
def __initialize_basic_chain(self, llm, memory):
return ConversationChain(llm=llm, memory=memory)
However, I have been unable to find a solution for this error. Kindly assist in resolving this issue to ensure the smooth operation of the application.