Skip to content

Commit

Permalink
fix: Allow content to be None for role==tool (#971)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahwooders authored Feb 8, 2024
1 parent 273c98e commit 5c4f763
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions memgpt/data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def to_openai_dict(self):
# TODO change to pydantic casting, eg `return SystemMessageModel(self)`

if self.role == "system":
assert all([v is not None for v in [self.text, self.role]]), vars(self)
assert all([v is not None for v in [self.role]]), vars(self)
openai_message = {
"content": self.text,
"role": self.role,
Expand Down Expand Up @@ -258,13 +258,12 @@ def to_openai_dict(self):
openai_message["tool_calls"] = [tool_call.to_dict() for tool_call in self.tool_calls]

elif self.role == "tool":
assert all([v is not None for v in [self.text, self.role, self.tool_call_id]]), vars(self)
assert all([v is not None for v in [self.role, self.tool_call_id]]), vars(self)
openai_message = {
"content": self.text,
"role": self.role,
"tool_call_id": self.tool_call_id,
}

else:
raise ValueError(self.role)

Expand Down

0 comments on commit 5c4f763

Please sign in to comment.