Skip to content

Commit

Permalink
Anthropic client class, concatenate system messages rather than lose …
Browse files Browse the repository at this point in the history
…them. (#3392)

Co-authored-by: HRUSHIKESH DOKALA <[email protected]>
Co-authored-by: Li Jiang <[email protected]>
  • Loading branch information
3 people authored Sep 3, 2024
1 parent ca1a89c commit 0871b3c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion autogen/oai/anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def oai_messages_to_anthropic_messages(params: Dict[str, Any]) -> list[dict[str,
last_tool_result_index = -1
for message in params["messages"]:
if message["role"] == "system":
params["system"] = message["content"]
params["system"] = params.get("system", "") + (" " if "system" in params else "") + message["content"]
else:
# New messages will be added here, manage role alternations
expected_role = "user" if len(processed_messages) % 2 == 0 else "assistant"
Expand Down

0 comments on commit 0871b3c

Please sign in to comment.