You've already forked adk-python
mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
fix: Fixes DeprecationWarning when using send method
Merge https://github.com/google/adk-python/pull/3352 Replace send() method with send_realtime_input() to fix DeprecationWarning ### Link to Issue or Description of Change **1. Link to an existing issue (if applicable):** - Closes: #2393 ### Testing Plan Have run unit test for test_live_request_queue.py **Unit Tests:** - [ ] I have added or updated unit tests for my change. - [x] All unit tests pass locally. Summary : tests/unittests/agents/test_live_request_queue.py::test_send_realtime PASSED [100%] **Manual End-to-End (E2E) Tests:** ### Checklist - [x] I have read the [CONTRIBUTING.md](https://github.com/google/adk-python/blob/main/CONTRIBUTING.md) document. - [x] I have performed a self-review of my own code. - [x] I have commented my code, particularly in hard-to-understand areas. - [ ] I have added tests that prove my fix is effective or that my feature works. - [x] New and existing unit tests pass locally with my changes. - [x] I have manually tested my changes end-to-end. - [ ] Any dependent changes have been merged and published in downstream modules. Tested both API variants. Co-authored-by: Hangfei Lin <hangfei@google.com> COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/3352 from SanjaySiddharth:fix-dep-session.send b23b641a63ff20d1f2dbd9abd519f8facf0aab77 PiperOrigin-RevId: 830182844
This commit is contained in:
committed by
Copybara-Service
parent
a3b4ec69d8
commit
2882995289
@@ -106,10 +106,10 @@ class GeminiLlmConnection(BaseLlmConnection):
|
||||
input: The input to send to the model.
|
||||
"""
|
||||
if isinstance(input, types.Blob):
|
||||
input_blob = input.model_dump()
|
||||
# The blob is binary and is very large. So let's not log it.
|
||||
logger.debug('Sending LLM Blob.')
|
||||
await self._gemini_session.send(input=input_blob)
|
||||
await self._gemini_session.send_realtime_input(media=input)
|
||||
|
||||
elif isinstance(input, types.ActivityStart):
|
||||
logger.debug('Sending LLM activity start signal.')
|
||||
await self._gemini_session.send_realtime_input(activity_start=input)
|
||||
|
||||
@@ -45,7 +45,11 @@ async def test_send_realtime_default_behavior(
|
||||
await gemini_connection.send_realtime(test_blob)
|
||||
|
||||
# Should call send once
|
||||
mock_gemini_session.send.assert_called_once_with(input=test_blob.model_dump())
|
||||
mock_gemini_session.send_realtime_input.assert_called_once_with(
|
||||
media=test_blob
|
||||
)
|
||||
# Should not call .send function
|
||||
mock_gemini_session.send.assert_not_called()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user