Skip to content

Commit ec164dd

Browse files
committed
address review comments from bot
1 parent c06abfb commit ec164dd

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

contributing/samples/hello_world_gemma/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async def check_prime(nums: list[int]) -> str:
4545
"""
4646
primes = set()
4747
for number in nums:
48-
number = int(number)
48+
number = number
4949
if number <= 1:
5050
continue
5151
is_prime = True

src/google/adk/models/google_llm.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import json
2121
import logging
2222
import os
23+
import re
2324
import sys
2425
from typing import Any
2526
from typing import AsyncGenerator
@@ -424,6 +425,8 @@ def _remove_display_name_if_present(
424425
class Gemma(Gemini):
425426
"""Integration for Gemma models exposed via the Gemini API.
426427
428+
Only Gemma 3 models are supported at this time.
429+
427430
For full documentation, see: https://ai.google.dev/gemma/docs/core/
428431
429432
NOTE: Gemma does **NOT** support system instructions. Any system instructions
@@ -442,9 +445,7 @@ class Gemma(Gemini):
442445
usage via the Gemini API.
443446
"""
444447

445-
model: str = (
446-
'gemma-3-27b-it' # Others: [gemma-3-1b-it, gemma-3-4b-it, gemma-3-12b-it]
447-
)
448+
model: str = 'gemma-3-27b-it' # Others: [gemma-3-1b-it, gemma-3-4b-it, gemma-3-12b-it]
448449

449450
@classmethod
450451
@override
@@ -456,7 +457,7 @@ def supported_models(cls) -> list[str]:
456457
"""
457458

458459
return [
459-
r'gemma-.*',
460+
r'gemma-3.*',
460461
]
461462

462463
@cached_property
@@ -473,7 +474,7 @@ async def _preprocess_request(self, llm_request: LlmRequest) -> None:
473474

474475
# NOTE: if history is preserved, we must include the system instructions ONLY once at the beginning
475476
# of any chain of contents.
476-
if len(contents) >= 1:
477+
if contents:
477478
if contents[0] != instruction_content:
478479
# only prepend if it hasn't already been done
479480
llm_request.contents = [instruction_content] + contents
@@ -642,8 +643,6 @@ def gemma_functions_after_model_callback(
642643
return
643644

644645
try:
645-
import re
646-
647646
json_candidate = None
648647

649648
markdown_code_block_pattern = re.compile(
@@ -699,7 +698,6 @@ def _get_last_valid_json_substring(text: str) -> tuple[bool, str | None]:
699698
decoder = json.JSONDecoder()
700699
last_json_str = None
701700
start_pos = 0
702-
first_brace_index = 0
703701
while start_pos < len(text):
704702
try:
705703
first_brace_index = text.index('{', start_pos)

0 commit comments

Comments
 (0)