File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
src/bedrock_agentcore/memory
tests/bedrock_agentcore/memory Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -653,15 +653,19 @@ def list_events(
653653 if next_token :
654654 params ["nextToken" ] = next_token
655655
656+ # Initialize the filterMap
657+ filterMap = {}
658+
656659 # Add branch filter if specified (but not for "main")
657660 if branch_name and branch_name != "main" :
658- params ["filter" ] = {
659- "branch" : {"name" : branch_name , "includeParentBranches" : include_parent_branches }
660- }
661+ filterMap ["branch" ] = {"name" : branch_name , "includeParentBranches" : include_parent_branches }
661662
662663 # Add eventMetadata filter if specified
663664 if eventMetadata :
664- params ["filter" ] = {"eventMetadata" : eventMetadata }
665+ filterMap ["eventMetadata" ] = eventMetadata
666+
667+ if filterMap :
668+ params ["filter" ] = filterMap
665669
666670 response = self ._data_plane_client .list_events (** params )
667671
Original file line number Diff line number Diff line change @@ -2505,8 +2505,8 @@ def test_list_events_with_both_branch_and_metadata_filters(self):
25052505 call_args = mock_client_instance .list_events .call_args [1 ]
25062506 assert "filter" in call_args
25072507 assert call_args ["filter" ]["eventMetadata" ] == event_metadata_filter
2508- # Branch filter should not be present when eventMetadata is specified
2509- assert "branch" not in call_args ["filter" ]
2508+ # Branch filter should be present when eventMetadata is specified
2509+ assert "branch" in call_args ["filter" ]
25102510
25112511 def test_memory_session_list_events_with_event_metadata (self ):
25122512 """Test MemorySession.list_events with eventMetadata parameter."""
You can’t perform that action at this time.
0 commit comments