Skip to content

Commit e9b32d5

Browse files
committed
refactor!: Update supported Gemini models
BREAKING CHANGE
1 parent ebfdeb8 commit e9b32d5

File tree

6 files changed

+12
-27
lines changed

6 files changed

+12
-27
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ For Gemini models exclusively, you can provide a wildcard at the end of the mode
260260
| gemini-2.5-pro-preview-05-06 |
261261
| gemini-2.5-flash |
262262
| gemini-2.0-pro-exp-02-05 |
263-
| gemini-2.0-flash |
264263
| gemini-1.5-pro |
265264
| gemini-1.5-flash |
266265

@@ -393,7 +392,7 @@ When it comes to preference for selecting options, lgtm follows this preference
393392

394393
| Option | Feature Group | Optionality | Notes/Conditions |
395394
|----------------------|----------------------|---------------------|---------------------------------------------------------------------------------|
396-
| model | Main (review + guide) | 🟢 Optional | AI model to use. Defaults to `gemini-2.0-flash` if not set. |
395+
| model | Main (review + guide) | 🟢 Optional | AI model to use. Defaults to `gemini-2.5-flash` if not set. |
397396
| model_url | Main (review + guide) | 🟡 Conditionally required | Only needed for custom/local models. |
398397
| exclude | Main (review + guide) | 🟢 Optional | File patterns to exclude from review. |
399398
| publish | Main (review + guide) | 🟢 Optional | If true, posts review as comments. Default: false. |
@@ -419,7 +418,7 @@ When it comes to preference for selecting options, lgtm follows this preference
419418

420419
These options apply to both reviews and guides generated by lgtm.
421420

422-
- **model**: Choose which AI model you want lgtm to use. If not set, defaults to `gemini-2.0-flash`.
421+
- **model**: Choose which AI model you want lgtm to use. If not set, defaults to `gemini-2.5-flash`.
423422
- **model_url**: When not using one of the specific supported models from the providers mentioned above, you can pass a custom URL where the model is deployed (e.g., for local/hosted models).
424423
- **exclude**: Instruct lgtm to ignore certain files. This is important to reduce noise in reviews, but also to reduce the amount of tokens used for each review (and to avoid running into token limits). You can specify file patterns (e.g., `exclude = ["*.md", "package-lock.json"]`).
425424
- **publish**: If `true`, lgtm will post the review as comments on the PR page. Default is `false`.

src/lgtm_ai/ai/schemas.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,11 @@
2727
]
2828
SupportedGeminiModel = Literal[
2929
# pydantic-ai does not keep track of all Gemini models available, so we add the ones we want to support explicitly.
30-
"gemini-1.5-flash",
31-
"gemini-1.5-flash-8b",
32-
"gemini-1.5-pro",
33-
"gemini-1.0-pro",
34-
"gemini-2.0-flash-exp",
35-
"gemini-2.0-flash-thinking-exp-01-21",
36-
"gemini-exp-1206",
37-
"gemini-2.0-flash",
38-
"gemini-2.0-flash-lite-preview-02-05",
39-
"gemini-2.0-pro-exp-02-05",
40-
"gemini-2.5-flash-preview-04-17",
4130
"gemini-2.5-pro",
42-
"gemini-2.5-pro-exp-03-25",
43-
"gemini-2.5-pro-preview-03-25",
44-
"gemini-2.5-pro-preview-05-06",
4531
"gemini-2.5-flash",
46-
"gemini-2.5-flash-preview-05-20",
47-
"gemini-2.5-pro-preview-06-05",
32+
"gemini-2.5-flash-preview-09-25",
33+
"gemini-2.5-flash-lite",
34+
"gemini-2.5-flash-lite-preview-09-25",
4835
]
4936
SupportedAnthopicModel = Literal[
5037
"claude-3-7-sonnet-latest",

src/lgtm_ai/config/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from lgtm_ai.ai.schemas import SupportedAIModels
22

3-
DEFAULT_AI_MODEL: SupportedAIModels = "gemini-2.0-flash"
3+
DEFAULT_AI_MODEL: SupportedAIModels = "gemini-2.5-flash"
44
DEFAULT_INPUT_TOKEN_LIMIT = 500000
55
DEFAULT_ISSUE_REGEX = r"(?:refs?|closes?|resolves?)[:\s]*((?:#\d+)|(?:#?[A-Z]+-\d+))|(?:fix|feat|docs|style|refactor|perf|test|build|ci)\((?:#(\d+)|#?([A-Z]+-\d+))\)!?:"

tests/ai/test_utils.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
("model", "model_url", "ai_api_key", "expected_type", "expectation"),
1919
[
2020
("gpt-4", None, "fake_api_key", OpenAIChatModel, does_not_raise()),
21-
("gemini-1.5-flash", None, "fake_api_key", GoogleModel, does_not_raise()),
21+
("gemini-2.5-flash", None, "fake_api_key", GoogleModel, does_not_raise()),
2222
("does-not-exist", None, "fake_api_key", None, pytest.raises(MissingModelUrl)),
2323
("does-not-exist", "http://localhost:1234", "fake_api_key", OpenAIChatModel, does_not_raise()),
2424
# We allow custom models with a URL but no API key
@@ -41,10 +41,9 @@ def test_get_ai_model(model: str, model_url: str | None, ai_api_key: str, expect
4141
("model", "expected_model_name", "expectation"),
4242
[
4343
# Normal matches
44-
("gemini-2.5-flash-*", "gemini-2.5-flash-preview-05-20", does_not_raise()),
45-
("gemini-2.5-pro-preview-*", "gemini-2.5-pro-preview-06-05", does_not_raise()),
44+
("gemini-2.5-flash-preview-*", "gemini-2.5-flash-preview-09-25", does_not_raise()),
4645
# Exact match
47-
("gemini-2.5-pro-preview-06-05", "gemini-2.5-pro-preview-06-05", does_not_raise()),
46+
("gemini-2.5-flash-preview-09-25", "gemini-2.5-flash-preview-09-25", does_not_raise()),
4847
# No wildcard results in no attempt to actually match
4948
("gemini-2.5-pro-preview-", "gemini-2.5-pro-preview-06-05", pytest.raises(MissingModelUrl)),
5049
# Multiple matches that we cannot narrow down by date

tests/git/fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@
221221
+++ src/lgtm_ai/config/constants.py
222222
@@ -2,4 +2,4 @@ from lgtm_ai.ai.schemas import SupportedAIModels
223223
224-
DEFAULT_AI_MODEL: SupportedAIModels = "gemini-2.0-flash"
224+
DEFAULT_AI_MODEL: SupportedAIModels = "gemini-2.5-flash"
225225
DEFAULT_INPUT_TOKEN_LIMIT = 500000
226226
-DEFAULT_ISSUE_REGEX = r"(?:refs?|closes?)[:\s]*((?:#\d+)|(?:#?[A-Z]+-\d+))|(?:fix|feat|docs|style|refactor|perf|test|build|ci)\((?:#(\d+)|#?([A-Z]+-\d+))\)!?:"
227227
+DEFAULT_ISSUE_REGEX = r"(?:refs?|closes?|resolves?)[:\s]*((?:#\d+)|(?:#?[A-Z]+-\d+))|(?:fix|feat|docs|style|refactor|perf|test|build|ci)\((?:#(\d+)|#?([A-Z]+-\d+))\)!?:"

tests/review/test_guide.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def test_get_guide_from_url_valid() -> None:
2727
):
2828
guide_generator = ReviewGuideGenerator(
2929
guide_agent=test_agent,
30-
model=mock.Mock(spec=OpenAIChatModel, model_name="gemini-2.0-flash"),
30+
model=mock.Mock(spec=OpenAIChatModel, model_name="gemini-2.5-flash"),
3131
git_client=MockGitClient(),
3232
config=ResolvedConfig(ai_api_key="", git_api_key=""),
3333
)
@@ -49,5 +49,5 @@ def test_get_guide_from_url_valid() -> None:
4949
checklist=[GuideChecklistItem(description="a")],
5050
references=[GuideReference(title="a", url="a")],
5151
),
52-
metadata=PublishMetadata(model_name="gemini-2.0-flash", usage=guide.metadata.usage),
52+
metadata=PublishMetadata(model_name="gemini-2.5-flash", usage=guide.metadata.usage),
5353
)

0 commit comments

Comments
 (0)