File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
tests/unittests/flows/llm_flows Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -254,6 +254,41 @@ async def test_output_schema_helper_functions():
254254 assert extracted_json is None
255255
256256
257+ @pytest .mark .asyncio
258+ async def test_get_structured_model_response_with_non_ascii ():
259+ """Test get_structured_model_response with non-ASCII characters."""
260+ from google .adk .events .event import Event
261+ from google .adk .flows .llm_flows ._output_schema_processor import (
262+ get_structured_model_response ,
263+ )
264+ from google .genai import types
265+
266+ # Test with a dictionary containing non-ASCII characters
267+ test_dict = {'city' : 'São Paulo' }
268+ expected_json = '{"city": "São Paulo"}'
269+
270+ # Create a function response event
271+ function_response_event = Event (
272+ author = 'test_agent' ,
273+ content = types .Content (
274+ role = 'user' ,
275+ parts = [
276+ types .Part (
277+ function_response = types .FunctionResponse (
278+ name = 'set_model_response' , response = test_dict
279+ )
280+ )
281+ ],
282+ ),
283+ )
284+
285+ # Get the structured response
286+ extracted_json = get_structured_model_response (function_response_event )
287+
288+ # Assert that the output is the expected JSON string without escaped characters
289+ assert extracted_json == expected_json
290+
291+
257292@pytest .mark .asyncio
258293async def test_end_to_end_integration ():
259294 """Test the complete output schema with tools integration."""
You can’t perform that action at this time.
0 commit comments