-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: use timestamp passed by request for user message created date #1503
Conversation
we pass the timestamp through until we reach the agent's step function this function calls Message.dict_to_message(), where we pass the timestamp as argument for created_at, which is then persisted into the DB
the sort expression should not change even if we reverse the order of the items a date before should still be a date before the initial sort takes care of everything we need already
Pending tests LGTM. Though I think at a later point we may want to revisit the concept of allowing the user/client to specify the timestamp to be stored server-side since it feels like a security risk. Instead maybe we can return the timestamp (and other necessary metadata) in the response of the Thoughts @goetzrobin ? |
@cpacker I agree. I like that or maybe have the first streamed event return metadata like an id & timestamp? I do think moving forward we definitely want to have this server driven. |
memgpt/agent_store/db.py
Outdated
@@ -314,19 +314,13 @@ def get_all_cursor( | |||
# cursor logic: filter records based on before/after ID | |||
if after: | |||
after_value = getattr(self.get(id=after), order_by) | |||
if reverse: # if reverse, then we want to get records that are less than the after_value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably keep reverse
in, right? Was this just removed for debugging purposes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@goetzrobin I reverted the change on this file - I'm assuming that the diff isn't actually needed in this PR?
Gotcha. Let's merge in this PR for now, but deprecate the ability to pass in |
…1503) Co-authored-by: cpacker <packercharles@gmail.com>
we pass the timestamp through until we reach the agent's step function this function calls Message.dict_to_message(), where we pass the timestamp as argument for created_at, which is then persisted into the DB
Please describe the purpose of this pull request.
Is it to add a new feature? Is it to fix a bug?
How to test
How can we test your PR during review? What commands should we run? What outcomes should we expect?
After merging the dev portal changes and creating a new agent duplicated messages should not show up anymore
Have you tested this PR?
Have you tested the latest commit on the PR? If so please provide outputs from your tests.
Related issues or PRs
Please link any related GitHub issues or PRs.
Is your PR over 500 lines of code?
If so, please break up your PR into multiple smaller PRs so that we can review them quickly, or provide justification for its length.
Additional context
Add any other context or screenshots about the PR here.