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: consider the tool role when being in open interpreter #829

Merged
merged 11 commits into from
Jan 31, 2025
Merged

Conversation

yrobla
Copy link
Contributor

@yrobla yrobla commented Jan 29, 2025

It uses a new message role tool, that contains some context for using internal tools and the data it provides. So we need to consider it when parsing messages, or when inserting context messages

Closes: #820

It uses a new message role tool, that contains some context for using
internal tools and the data it provides. So we need to consider it when
parsing messages, or when inserting context messages

Closes: #820
@yrobla yrobla requested review from lukehinds, jhrozek, JAORMX and aponcedeleonch and removed request for lukehinds January 29, 2025 16:08
@yrobla yrobla requested a review from jhrozek January 30, 2025 09:47
accepted_roles = ["user", "assistant"]
if base_tool == "open interpreter":
# open interpreter also uses the role "tool"
accepted_roles.append("tool")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry to be difficult about this review.

Would it break anything if we accepted the tools either way, meaning for all clients?

What do we miss if we don't process the tool messages here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well i was not aware if any other client using tools but wanted to be conservative about it, so that's why i filter by the client. Do you prefer that i open that and we do not filter?

user_messages.append(content_str)
block_start_index = i

# Specifically for Aider, when "Ok." block is found, stop
if content_str == "Ok." and messages[i]["role"] == "assistant":
if base_tool == "aider" and content_str == "Ok." and messages[i]["role"] == "assistant":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do we detect aider? I looked into get_tool_name_from_messages and I don't see aider returned from there

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i actually removed that, it is outdated, i removed the check for aider

Copy link
Contributor

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did a bunch of testing offline with Yolanda and the code seems to work. I'm going to file a follow-up to support tools with openai in a more general way

@yrobla yrobla merged commit cd23ae6 into main Jan 31, 2025
4 checks passed
@yrobla yrobla deleted the issue-820 branch January 31, 2025 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Codegate not properly picking latest messages from Open Interpreter
2 participants