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(autofix): Handle empty messages and move cleaning calls inside LLMClient #1484

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

roaga
Copy link
Member

@roaga roaga commented Nov 21, 2024

  1. Adds a cleaning util for LLM memory that fixes empty content messages
  2. Moves the clean_tool_call_assistant_messages inside generate_structured and generate_text so that we don't have to think about cleaning memory when using the LLMClient

Fixes #1483

@roaga roaga requested a review from jennmueng November 21, 2024 18:10
@roaga roaga requested a review from a team as a code owner November 21, 2024 18:10
Comment on lines 535 to 542
@staticmethod
def clean_tool_call_assistant_messages(messages: list[Message]) -> list[Message]:
def clean_tool_call_assistant_messages(self, messages: list[Message]) -> list[Message]:
Copy link
Member

Choose a reason for hiding this comment

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

If this is not using self and is still used outside the class, would it be not cleaner to just keep it static?

Copy link
Member Author

Choose a reason for hiding this comment

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

Made them static now because they don't leverage self, but currently they are not used outside of this class.

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.

(autofix) Fix Anthropic message errors
2 participants