Skip to content

Commit 39b55ec

Browse files
committed
fix: address bot suggestions for stacklevel and redundant config initialization
Signed-off-by: Akshat Kumar <akshat230405@gmail.com>
1 parent 7d3c06f commit 39b55ec

3 files changed

Lines changed: 4 additions & 6 deletions

File tree

src/google/adk/agents/llm_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ def model_post_init(self, __context: Any) -> None:
875875
'planner with `thinking_config` are provided. The '
876876
"planner's configuration will take precedence.",
877877
UserWarning,
878-
stacklevel=3,
878+
stacklevel=5,
879879
)
880880

881881
@classmethod

src/google/adk/planners/built_in_planner.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def apply_thinking_config(self, llm_request: LlmRequest) -> None:
6161
llm_request: The LLM request to apply the thinking config to.
6262
"""
6363
if self.thinking_config:
64-
llm_request.config = llm_request.config or types.GenerateContentConfig()
6564
if llm_request.config.thinking_config:
6665
_LOGGER.info(
6766
'Overwriting `thinking_config` from `generate_content_config` with '

tests/unittests/agents/test_llm_agent_fields.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
from typing import Optional
2020
from unittest import mock
2121

22-
from pydantic import BaseModel
23-
import pytest
24-
2522
from google.adk.agents.callback_context import CallbackContext
2623
from google.adk.agents.invocation_context import InvocationContext
2724
from google.adk.agents.llm_agent import LlmAgent
@@ -33,10 +30,12 @@
3330
from google.adk.models.registry import LLMRegistry
3431
from google.adk.planners.built_in_planner import BuiltInPlanner
3532
from google.adk.sessions.in_memory_session_service import InMemorySessionService
36-
from google.adk.tools.google_search_tool import GoogleSearchTool
3733
from google.adk.tools.google_search_tool import google_search
34+
from google.adk.tools.google_search_tool import GoogleSearchTool
3835
from google.adk.tools.vertex_ai_search_tool import VertexAiSearchTool
3936
from google.genai import types
37+
from pydantic import BaseModel
38+
import pytest
4039

4140

4241
async def _create_readonly_context(

0 commit comments

Comments
 (0)