Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow content to be None for role==tool #971

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ assignees: ''
A clear and concise description of what the bug is.

**Please describe your setup**

- [ ] MemGPT version
- What is the output of `memgpt version`? (eg "0.2.4")
- [ ] How did you install memgpt?
- `pip install pymemgpt`? `pip install pymemgpt-nightly`? `git clone`?
- [ ] Describe your setup
Expand All @@ -26,6 +23,9 @@ If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here.

**MemGPT Config**
Please attach your `~/.memgpt/config` file or copy past it below.

---

If you're not using OpenAI, please provide additional information on your local LLM setup:
Expand Down
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
Loading