Skip to content

Commit 74600d8

Browse files
Akshat8510wuliang229
authored andcommitted
refactor: simplify apply_thinking_config and cleanup test imports
Signed-off-by: Akshat Kumar <akshat230405@gmail.com>
1 parent 072f8ad commit 74600d8

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/google/adk/planners/built_in_planner.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ def apply_thinking_config(self, llm_request: LlmRequest) -> None:
5656
Args:
5757
llm_request: The LLM request to apply the thinking config to.
5858
"""
59-
if self.thinking_config is not None:
60-
# Log info if we are overwriting an existing config from generate_content_config
61-
if llm_request.config.thinking_config is not None:
62-
logging.info(
63-
'Overwriting `thinking_config` from `generate_content_config` with '
64-
'the one provided by the `BuiltInPlanner`.'
65-
)
66-
llm_request.config.thinking_config = self.thinking_config
59+
llm_request.config = llm_request.config or types.GenerateContentConfig()
60+
61+
# Log info if we are overwriting an existing config from generate_content_config
62+
if llm_request.config.thinking_config is not None:
63+
logging.info(
64+
'Overwriting `thinking_config` from `generate_content_config` with '
65+
'the one provided by the `BuiltInPlanner`.'
66+
)
67+
llm_request.config.thinking_config = self.thinking_config
6768

6869
@override
6970
def build_planning_instruction(

0 commit comments

Comments
 (0)