Skip to content

Commit

Permalink
fixed system instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
lkuligin committed Apr 30, 2024
1 parent bfb6eb9 commit 1a14405
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libs/genai/langchain_google_genai/chat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,10 +772,14 @@ def _prepare_chat(
convert_system_message_to_human=self.convert_system_message_to_human,
)
message = history.pop()
if self.client._system_instruction != system_instruction:
if (
self.client._system_instruction != system_instruction
and not self.convert_system_message_to_human
):
self.client = genai.GenerativeModel(
model_name=self.model, system_instruction=system_instruction
)
client = self.client
chat = client.start_chat(history=history)
return params, chat, message

Expand Down

0 comments on commit 1a14405

Please sign in to comment.