From ad4226b3d8519f725d470cbd9573ac7b012befca Mon Sep 17 00:00:00 2001 From: Bart Date: Sat, 3 May 2025 17:07:16 -0700 Subject: [PATCH] Copybara import of the project: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 1ca16aba5b7b869afa8e0a0cddaea539acd737f5 by bart.lee(이철민)/kakao : chore: Improves session update time validation message Enhances the error message when a session's last update time is later than the storage update time. This provides better readability by formatting the timestamps in the error message. COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/446 from kakao-bart-lee:main a2a0cff036429b61bd7cf1600fc4c2c0cf50089d PiperOrigin-RevId: 754452381 --- CHANGELOG.md | 6 +++--- src/google/adk/sessions/database_session_service.py | 8 +++++--- .../openapi_tool/openapi_spec_parser/operation_parser.py | 3 +-- .../openapi_spec_parser/test_operation_parser.py | 5 +++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02fe6d9..d04235f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,7 @@ ### ⚠ BREAKING CHANGES * Auth: expose `access_token` and `refresh_token` at top level of auth - credentails, instead of a `dict` + credentials, instead of a `dict` ([commit](https://github.com/google/adk-python/commit/956fb912e8851b139668b1ccb8db10fd252a6990)). ### Features @@ -50,7 +50,7 @@ ### Miscellaneous Chores -* README.md impprovements. +* README.md improvements. * Various code improvements. * Various typo fixes. * Bump min version of google-genai to 1.11.0. @@ -108,4 +108,4 @@ * Built-in evaluation support * Development UI that makes local development easy * Deploy to Google Cloud Run, Agent Engine -* (Experimental) Live(Bidi) auido/video agent support and Compositional Function Calling(CFC) support +* (Experimental) Live(Bidi) audio/video agent support and Compositional Function Calling(CFC) support diff --git a/src/google/adk/sessions/database_session_service.py b/src/google/adk/sessions/database_session_service.py index 7597361..b53dd87 100644 --- a/src/google/adk/sessions/database_session_service.py +++ b/src/google/adk/sessions/database_session_service.py @@ -484,9 +484,11 @@ class DatabaseSessionService(BaseSessionService): if storage_session.update_time.timestamp() > session.last_update_time: raise ValueError( - f"Session last_update_time {session.last_update_time} is later than" - f" the upate_time in storage {storage_session.update_time}" - ) + f"Session last_update_time " + f"{datetime.fromtimestamp(session.last_update_time):%Y-%m-%d %H:%M:%S} " + f"is later than the update_time in storage " + f"{storage_session.update_time:%Y-%m-%d %H:%M:%S}" + ) # Fetch states from storage storage_app_state = sessionFactory.get( diff --git a/src/google/adk/tools/openapi_tool/openapi_spec_parser/operation_parser.py b/src/google/adk/tools/openapi_tool/openapi_spec_parser/operation_parser.py index a7bed0f..930e05c 100644 --- a/src/google/adk/tools/openapi_tool/openapi_spec_parser/operation_parser.py +++ b/src/google/adk/tools/openapi_tool/openapi_spec_parser/operation_parser.py @@ -83,8 +83,7 @@ class OperationParser: schema.description = ( description if not schema.description else schema.description ) - # param.required can be None - required = param.required if param.required is not None else False + required = param.required self.params.append( ApiParameter( diff --git a/tests/unittests/tools/openapi_tool/openapi_spec_parser/test_operation_parser.py b/tests/unittests/tools/openapi_tool/openapi_spec_parser/test_operation_parser.py index 258f83d..0c774f6 100644 --- a/tests/unittests/tools/openapi_tool/openapi_spec_parser/test_operation_parser.py +++ b/tests/unittests/tools/openapi_tool/openapi_spec_parser/test_operation_parser.py @@ -347,8 +347,9 @@ def test_get_json_schema(sample_operation): assert json_schema['type'] == 'object' assert 'param1' in json_schema['properties'] assert 'prop1' in json_schema['properties'] - # By default nothing is required unless explicitly stated - assert 'required' not in json_schema or json_schema['required'] == [] + assert 'param1' in json_schema['required'] + assert 'prop1' in json_schema['required'] + def test_get_signature_parameters(sample_operation): """Test get_signature_parameters method."""