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

ChatStorage:is_consecutive_message - Either the name of the function is incorrect or the check is! #102

Open
ksachdeva opened this issue Nov 22, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@ksachdeva
Copy link

Expected Behaviour

consecutive - it means things organized sequentially

In the context of chat messages, the following is consecutive -
assistant-user-assistant-user
and the following is not consecutive
assistant-assistant or user-user

return conversation[-1].role == new_message.role

The check at the above line will return true if the pattern is assistant-assistant or user-user

If someone looks at the name of the function (without considering how it is used and where it is used) they would consider the above check to be incorrect

I looked at the usage of your API in

if self.is_consecutive_message(existing_conversation, new_message):

How it is used will not result in a functional problem/bug however the way you have named the API and used it isn't very clear and confusing.

Current Behaviour

Either the API name is incorrect or the check & usage is incorrect

Code snippet

See above

Possible Solution

  • Change the check in is_consecutive function to return conversation[-1].role != new_message.role
  • use the API as not is_consecutive in the ChatStorage implementation classes

Steps to Reproduce

See above

@ksachdeva ksachdeva added the bug Something isn't working label Nov 22, 2024
@cornelcroi cornelcroi added enhancement New feature or request and removed bug Something isn't working triage labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants