Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
baskaryan committed Oct 31, 2024
1 parent 440acb1 commit 888961f
Show file tree
Hide file tree
Showing 4 changed files with 1,069 additions and 1,248 deletions.
8 changes: 5 additions & 3 deletions libs/partners/anthropic/langchain_anthropic/chat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,12 @@ def _merge_messages(
all(isinstance(m, c) for m in (curr, last))
for c in (SystemMessage, HumanMessage)
):
if isinstance(last.content, str):
new_content: List = [{"type": "text", "text": last.content}]
if isinstance(cast(BaseMessage, last).content, str):
new_content: List = [
{"type": "text", "text": cast(BaseMessage, last).content}
]
else:
new_content = copy.copy(last.content)
new_content = copy.copy(cast(list, cast(BaseMessage, last).content))
if isinstance(curr.content, str):
new_content.append({"type": "text", "text": curr.content})
else:
Expand Down
Loading

0 comments on commit 888961f

Please sign in to comment.