@@ -1962,24 +1962,22 @@ async def generate_content_async(
19621962 ),
19631963 )
19641964 )
1965- aggregated_llm_response_with_tool_call = (
1966- _message_to_generate_content_response (
1967- ChatCompletionAssistantMessage (
1968- role = "assistant" ,
1969- # FIX: Set content=None for tool-only messages to avoid duplication
1970- # and follow OpenAI/LiteLLM conventions. Planning/reasoning text is
1971- # already streamed (lines 1288-1296) and preserved in thought_parts
1972- # (line 1357). Including it again in content causes duplication and
1973- # violates API specifications for tool-call messages.
1974- # See: https://github.com/google/adk-python/issues/3697
1975- content = None ,
1976- tool_calls = tool_calls ,
1977- ),
1978- model_version = part .model ,
1979- thought_parts = list (reasoning_parts )
1980- if reasoning_parts
1981- else None ,
1982- )
1965+ aggregated_llm_response_with_tool_call = _message_to_generate_content_response (
1966+ ChatCompletionAssistantMessage (
1967+ role = "assistant" ,
1968+ # FIX: Set content=None for tool-only messages to avoid duplication
1969+ # and follow OpenAI/LiteLLM conventions. Planning/reasoning text is
1970+ # already streamed (lines 1288-1296) and preserved in thought_parts
1971+ # (line 1357). Including it again in content causes duplication and
1972+ # violates API specifications for tool-call messages.
1973+ # See: https://github.com/google/adk-python/issues/3697
1974+ content = None ,
1975+ tool_calls = tool_calls ,
1976+ ),
1977+ model_version = part .model ,
1978+ thought_parts = list (reasoning_parts )
1979+ if reasoning_parts
1980+ else None ,
19831981 )
19841982 aggregated_llm_response_with_tool_call .finish_reason = (
19851983 _map_finish_reason (finish_reason )
0 commit comments