mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-14 09:51:25 -06:00

Copybara import of the project: -- 93cc9c0b71a92991a888c93675ddc8aee11f21dc by luaifei <lu.aifei@thoughtworks.com>: fix: Update skipped tests in test_auth_handlers -- 06ddf559c76c113231719bff549d41801a93daf4 by luaifei <lu.aifei@thoughtworks.com>: fix: Update skipped & failed tests in test_connections_client and test_streaming -- b8f2d357c1101c59ee9b65fa89a75f216e014a7c by luaifei <lu.aifei@thoughtworks.com>: fix: Remove ignored test file from Python unit tests workflow COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/553 from luaifei:fix-tests d51e42841e71d388c16cc719a4798b029182084f PiperOrigin-RevId: 755669644
50 lines
1.4 KiB
Python
50 lines
1.4 KiB
Python
# Copyright 2025 Google LLC
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
from google.adk.agents import Agent
|
|
from google.adk.agents import LiveRequestQueue
|
|
from google.adk.models import LlmResponse
|
|
from google.genai import types
|
|
import pytest
|
|
|
|
from .. import utils
|
|
|
|
|
|
def test_streaming():
|
|
response1 = LlmResponse(
|
|
turn_complete=True,
|
|
)
|
|
|
|
mock_model = utils.MockModel.create([response1])
|
|
|
|
root_agent = Agent(
|
|
name='root_agent',
|
|
model=mock_model,
|
|
tools=[],
|
|
)
|
|
|
|
runner = utils.InMemoryRunner(
|
|
root_agent=root_agent, response_modalities=['AUDIO']
|
|
)
|
|
live_request_queue = LiveRequestQueue()
|
|
live_request_queue.send_realtime(
|
|
blob=types.Blob(data=b'\x00\xFF', mime_type='audio/pcm')
|
|
)
|
|
res_events = runner.run_live(live_request_queue)
|
|
|
|
assert res_events is not None, 'Expected a list of events, got None.'
|
|
assert (
|
|
len(res_events) > 0
|
|
), 'Expected at least one response, but got an empty list.'
|