Skip to content

Commit 97318bc

Browse files
google-genai-botcopybara-github
authored andcommitted
fix: correct type annotation
Overridden `supported_models` should be a `classmethod` rather than a `staticmethod`. PiperOrigin-RevId: 790989895
1 parent 2833030 commit 97318bc

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

src/google/adk/models/anthropic_llm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,9 @@ class Claude(BaseLlm):
249249
model: str = "claude-3-5-sonnet-v2@20241022"
250250
max_tokens: int = 8192
251251

252-
@staticmethod
252+
@classmethod
253253
@override
254-
def supported_models() -> list[str]:
254+
def supported_models(cls) -> list[str]:
255255
return [r"claude-3-.*", r"claude-.*-4.*"]
256256

257257
@override

src/google/adk/models/google_llm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ class Gemini(BaseLlm):
7575
```
7676
"""
7777

78-
@staticmethod
78+
@classmethod
7979
@override
80-
def supported_models() -> list[str]:
80+
def supported_models(cls) -> list[str]:
8181
"""Provides the list of supported models.
8282
8383
Returns:

src/google/adk/models/lite_llm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,9 +848,9 @@ async def generate_content_async(
848848
response = await self.llm_client.acompletion(**completion_args)
849849
yield _model_response_to_generate_content_response(response)
850850

851-
@staticmethod
851+
@classmethod
852852
@override
853-
def supported_models() -> list[str]:
853+
def supported_models(cls) -> list[str]:
854854
"""Provides the list of supported models.
855855
856856
LiteLlm supports all models supported by litellm. We do not keep track of

tests/unittests/testing_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,9 @@ def create(
282282

283283
return cls(responses=responses)
284284

285-
@staticmethod
286-
def supported_models() -> list[str]:
285+
@classmethod
286+
@override
287+
def supported_models(cls) -> list[str]:
287288
return ['mock']
288289

289290
def generate_content(

0 commit comments

Comments
 (0)