-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: add ordering to recent events in database session service to preserve the chronological sequence of messages: 400 INVALID_ARGUMENT #454
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
Conversation
This resolves the google.genai.errors.ClientError: 400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': 'Please ensure that function call turn comes immediately after a user turn or after a function response turn.', 'status': 'INVALID_ARGUMENT'}} When retrieve data from db, this get its non cronological, causing inconsistency on order of functions callings e responses. ;) |
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.
Add Order By
hello guys do I need to do anything here now? I saw the merge has already been done on the main branch—do I need to update anything here? It’s my first PR on the project. |
This is already in acbbdb7. We have code sync that fetches this. Since we didn't close this promptly, so it's merged from Google by our system again. But the commit is still associated with your name. Thanks for your contribution! |
-- 709e1dd by joao.campista <joaocampista@proton.me>: feat: add ordering to recent events in database session service COPYBARA_INTEGRATE_REVIEW=google#454 from lugui-co:main 912503f PiperOrigin-RevId: 753013663
Fixes: #453
Describe the bug
The DatabaseSessionService class (in adk/sessions/database_session_service.py) fetches StorageEvent records without any ORDER BY clause. As a result, events are returned in a non-deterministic order determined by the database’s query planner. When building the context for inference via the Gemini API, messages end up shuffled, leading to hallucinations because the model receives them out of their original sequence.