From 9e52134d30203a9125532621abcd5a102e3f2bfb Mon Sep 17 00:00:00 2001 From: Hassan Ouda Date: Fri, 23 Jun 2023 16:38:21 -0400 Subject: [PATCH] ChatVertexAI broken - Fix error with sending context in params (#6652) vertex Ai chat is broken right now. That is because context is in params and chat.send_message doesn't accept that as a params. - Closes issue [ChatVertexAI Error: _ChatSessionBase.send_message() got an unexpected keyword argument 'context' #6610](https://github.com/hwchase17/langchain/issues/6610) --- langchain/chat_models/vertexai.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/langchain/chat_models/vertexai.py b/langchain/chat_models/vertexai.py index b9440476cbc..5770da6e112 100644 --- a/langchain/chat_models/vertexai.py +++ b/langchain/chat_models/vertexai.py @@ -129,8 +129,9 @@ class ChatVertexAI(_VertexAICommon, BaseChatModel): context = history.system_message.content if history.system_message else None params = {**self._default_params, **kwargs} if not self.is_codey_model: - params["context"] = context - chat = self.client.start_chat(**params) + chat = self.client.start_chat(context=context, **params) + else: + chat = self.client.start_chat(**params) for pair in history.history: chat._history.append((pair.question.content, pair.answer.content)) response = chat.send_message(question.content, **params)