Skip to content

Commit

Permalink
Add meta for claude models
Browse files Browse the repository at this point in the history
  • Loading branch information
vblagoje committed Mar 8, 2024
1 parent b97c793 commit 8817114
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ def _extract_messages_from_response(self, response_body: Dict[str, Any]) -> List
if response_body.get("type") == "message":
for content in response_body["content"]:
if content.get("type") == "text":
messages.append(ChatMessage.from_assistant(content["text"]))
meta = {k: v for k, v in response_body.items() if k not in ["type", "content", "role"]}
messages.append(ChatMessage.from_assistant(content["text"], meta=meta))
return messages

def _extract_token_from_stream(self, chunk: Dict[str, Any]) -> str:
Expand Down

0 comments on commit 8817114

Please sign in to comment.