mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-02 03:26:17 +00:00
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)
This commit is contained in:
@@ -129,8 +129,9 @@ class ChatVertexAI(_VertexAICommon, BaseChatModel):
|
|||||||
context = history.system_message.content if history.system_message else None
|
context = history.system_message.content if history.system_message else None
|
||||||
params = {**self._default_params, **kwargs}
|
params = {**self._default_params, **kwargs}
|
||||||
if not self.is_codey_model:
|
if not self.is_codey_model:
|
||||||
params["context"] = context
|
chat = self.client.start_chat(context=context, **params)
|
||||||
chat = self.client.start_chat(**params)
|
else:
|
||||||
|
chat = self.client.start_chat(**params)
|
||||||
for pair in history.history:
|
for pair in history.history:
|
||||||
chat._history.append((pair.question.content, pair.answer.content))
|
chat._history.append((pair.question.content, pair.answer.content))
|
||||||
response = chat.send_message(question.content, **params)
|
response = chat.send_message(question.content, **params)
|
||||||
|
Reference in New Issue
Block a user