mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
fix: Fixes thought handling in contents.py and refactors its unit tests
Before this change, other agent's reply with thought will still be inserted in the outgoing LlmRequest due to the wrong `else` statement for calling all other type of part. This commit also refactors test_contents.py to be behavior-oriented tests, instead of implementation-oriented, and add more test cases to cover expected scenarios. The tests are divided into the following files with different focus: - test_contents.py: covers the basic logic of event filter; - test_contents_branch.py: covers the behavior related to branch, which takes effect when ParallelAgent is used. - test_contents_other_agent.py: covers the retelling behavior to include other agents' reply as context for the current agent. - test_contents_function.py: covers the function_call/function_response rearrangement logic mainly for `LongRunningFunctionTool`. PiperOrigin-RevId: 802759821
This commit is contained in:
committed by
Copybara-Service
parent
fe8b37b0d3
commit
a30851ee16
@@ -515,7 +515,7 @@ class TestRemoteA2aAgentMessageHandling:
|
||||
self.mock_session.events = [mock_event]
|
||||
|
||||
with patch(
|
||||
"google.adk.agents.remote_a2a_agent._convert_foreign_event"
|
||||
"google.adk.agents.remote_a2a_agent._present_other_agent_message"
|
||||
) as mock_convert:
|
||||
mock_convert.return_value = mock_event
|
||||
|
||||
@@ -937,7 +937,7 @@ class TestRemoteA2aAgentIntegration:
|
||||
|
||||
# Mock dependencies
|
||||
with patch(
|
||||
"google.adk.agents.remote_a2a_agent._convert_foreign_event"
|
||||
"google.adk.agents.remote_a2a_agent._present_other_agent_message"
|
||||
) as mock_convert:
|
||||
mock_convert.return_value = mock_event
|
||||
|
||||
|
||||
Reference in New Issue
Block a user