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

Preserve Non-AI Messages in Message Operations #27

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sjang42
Copy link

@sjang42 sjang42 commented Jan 29, 2025

Description

When updating tool names, the message operation was dropping non-AI messages (like SystemMessage, HumanMessage, and ToolMessage). This PR fixes the issue by ensuring all message types are preserved during message operations, maintaining the complete conversation context and history.

Changes

  • Update message operation logic to preserve non-AI messages
  • Add comprehensive test cases to verify message preservation behavior
  • Ensure consistent behavior across all message operation types (delete, update_tool_call, update_tool_name)

Testing

Added test cases that verify:

  • Mixed message type preservation (System, Human, AI, Tool messages)
  • Selective tool name updates without affecting other messages
  • Proper handling of non-matching tool IDs

Impact

This change ensures that conversation context is maintained correctly when updating tool names, which is particularly important for maintaining coherent dialogue history in the trustcall system.

When updating tool names, the message operation was dropping non-AI messages.
This fix ensures all message types are preserved during message operations,
maintaining conversation context and history.

- Add test cases to verify message preservation
- Update message operation logic to keep non-AI messages
@hinthornw hinthornw force-pushed the main branch 3 times, most recently from dd81484 to 213ef53 Compare January 31, 2025 21:50
@sjang42
Copy link
Author

sjang42 commented Feb 5, 2025

@hinthornw Hi! I've submitted this PR to fix a bug where non-AI messages are being dropped during message operations.
The fix includes comprehensive test cases to verify the behavior.

Would you have time to review this change? I'm happy to provide any additional context or make adjustments if needed.

This is my first PR to this repository - please let me know if there are any contribution guidelines I should follow or if you'd like me to make any adjustments to better align with the project's practices.

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.

1 participant