feat: make LlmAgent.model optional with a default fallback

LlmAgent now resolves model from ancestors or a system default (gemini-2.5-flash) when unset. Added LlmAgent.set_default_model() to override the default globally

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 853006116
This commit is contained in:
George Weale
2026-01-06 17:56:14 -08:00
committed by Copybara-Service
parent 742c9265a2
commit b28721508a
10 changed files with 73 additions and 28 deletions
@@ -110,7 +110,9 @@ class TestBasicLlmRequestProcessor:
assert llm_request.config.response_mime_type != 'application/json'
# Should have checked if output schema can be used with tools
can_use_output_schema_with_tools.assert_called_once_with(agent.model)
can_use_output_schema_with_tools.assert_called_once_with(
agent.canonical_model
)
@pytest.mark.asyncio
async def test_sets_output_schema_when_tools_present(self, mocker):
@@ -141,7 +143,9 @@ class TestBasicLlmRequestProcessor:
assert llm_request.config.response_mime_type == 'application/json'
# Should have checked if output schema can be used with tools
can_use_output_schema_with_tools.assert_called_once_with(agent.model)
can_use_output_schema_with_tools.assert_called_once_with(
agent.canonical_model
)
@pytest.mark.asyncio
async def test_no_output_schema_no_tools(self):
@@ -191,7 +191,9 @@ async def test_output_schema_request_processor(
assert not llm_request.config.system_instruction
# Should have checked if output schema can be used with tools
can_use_output_schema_with_tools.assert_called_once_with(agent.model)
can_use_output_schema_with_tools.assert_called_once_with(
agent.canonical_model
)
@pytest.mark.asyncio