You've already forked adk-python
mirror of
https://github.com/encounter/adk-python.git
synced 2026-03-30 10:57:20 -07:00
chore: change LlmRequest.config's default value to be types.GenerateContentConfig() instead of None
PiperOrigin-RevId: 789792582
This commit is contained in:
committed by
Copybara-Service
parent
16a15c8709
commit
041f04e89c
@@ -45,7 +45,9 @@ class LlmRequest(BaseModel):
|
||||
contents: list[types.Content] = Field(default_factory=list)
|
||||
"""The contents to send to the model."""
|
||||
|
||||
config: Optional[types.GenerateContentConfig] = None
|
||||
config: types.GenerateContentConfig = Field(
|
||||
default_factory=types.GenerateContentConfig
|
||||
)
|
||||
live_connect_config: types.LiveConnectConfig = types.LiveConnectConfig()
|
||||
"""Additional config for the generate content request.
|
||||
|
||||
|
||||
@@ -1505,7 +1505,6 @@ async def test_computer_use_with_no_config():
|
||||
contents=[
|
||||
types.Content(role="user", parts=[types.Part.from_text(text="Hello")])
|
||||
],
|
||||
config=None,
|
||||
)
|
||||
|
||||
# Should not raise an exception
|
||||
|
||||
@@ -62,7 +62,7 @@ async def test_process_llm_request_no_declaration():
|
||||
tool_context=tool_context, llm_request=llm_request
|
||||
)
|
||||
|
||||
assert llm_request.config is None
|
||||
assert llm_request.config == types.GenerateContentConfig()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
@@ -322,12 +322,12 @@ class TestGoogleSearchTool:
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_process_llm_request_with_none_config(self):
|
||||
async def test_process_llm_request_with_no_config(self):
|
||||
"""Test processing LLM request with None config."""
|
||||
tool = GoogleSearchTool()
|
||||
tool_context = await _create_tool_context()
|
||||
|
||||
llm_request = LlmRequest(model='gemini-2.0-flash', config=None)
|
||||
llm_request = LlmRequest(model='gemini-2.0-flash')
|
||||
|
||||
await tool.process_llm_request(
|
||||
tool_context=tool_context, llm_request=llm_request
|
||||
|
||||
@@ -242,12 +242,12 @@ class TestUrlContextTool:
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_process_llm_request_with_none_config(self):
|
||||
async def test_process_llm_request_with_no_config(self):
|
||||
"""Test processing LLM request with None config."""
|
||||
tool = UrlContextTool()
|
||||
tool_context = await _create_tool_context()
|
||||
|
||||
llm_request = LlmRequest(model='gemini-2.0-flash', config=None)
|
||||
llm_request = LlmRequest(model='gemini-2.0-flash')
|
||||
|
||||
await tool.process_llm_request(
|
||||
tool_context=tool_context, llm_request=llm_request
|
||||
|
||||
Reference in New Issue
Block a user