Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ For Gemini models exclusively, you can provide a wildcard at the end of the mode
| gemini-2.5-pro-preview-05-06 |
| gemini-2.5-flash |
| gemini-2.0-pro-exp-02-05 |
| gemini-2.0-flash |
| gemini-1.5-pro |
| gemini-1.5-flash |

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

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

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

- **model**: Choose which AI model you want lgtm to use. If not set, defaults to `gemini-2.0-flash`.
- **model**: Choose which AI model you want lgtm to use. If not set, defaults to `gemini-2.5-flash`.
- **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).
- **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"]`).
- **publish**: If `true`, lgtm will post the review as comments on the PR page. Default is `false`.
Expand Down
19 changes: 3 additions & 16 deletions src/lgtm_ai/ai/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,11 @@
]
SupportedGeminiModel = Literal[
# pydantic-ai does not keep track of all Gemini models available, so we add the ones we want to support explicitly.
"gemini-1.5-flash",
"gemini-1.5-flash-8b",
"gemini-1.5-pro",
"gemini-1.0-pro",
"gemini-2.0-flash-exp",
"gemini-2.0-flash-thinking-exp-01-21",
"gemini-exp-1206",
"gemini-2.0-flash",
"gemini-2.0-flash-lite-preview-02-05",
"gemini-2.0-pro-exp-02-05",
"gemini-2.5-flash-preview-04-17",
"gemini-2.5-pro",
"gemini-2.5-pro-exp-03-25",
"gemini-2.5-pro-preview-03-25",
"gemini-2.5-pro-preview-05-06",
"gemini-2.5-flash",
"gemini-2.5-flash-preview-05-20",
"gemini-2.5-pro-preview-06-05",
"gemini-2.5-flash-preview-09-25",
"gemini-2.5-flash-lite",
"gemini-2.5-flash-lite-preview-09-25",
]
SupportedAnthopicModel = Literal[
"claude-3-7-sonnet-latest",
Expand Down
2 changes: 1 addition & 1 deletion src/lgtm_ai/config/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from lgtm_ai.ai.schemas import SupportedAIModels

DEFAULT_AI_MODEL: SupportedAIModels = "gemini-2.0-flash"
DEFAULT_AI_MODEL: SupportedAIModels = "gemini-2.5-flash"
DEFAULT_INPUT_TOKEN_LIMIT = 500000
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+))\)!?:"
7 changes: 3 additions & 4 deletions tests/ai/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
("model", "model_url", "ai_api_key", "expected_type", "expectation"),
[
("gpt-4", None, "fake_api_key", OpenAIChatModel, does_not_raise()),
("gemini-1.5-flash", None, "fake_api_key", GoogleModel, does_not_raise()),
("gemini-2.5-flash", None, "fake_api_key", GoogleModel, does_not_raise()),
("does-not-exist", None, "fake_api_key", None, pytest.raises(MissingModelUrl)),
("does-not-exist", "http://localhost:1234", "fake_api_key", OpenAIChatModel, does_not_raise()),
# We allow custom models with a URL but no API key
Expand All @@ -41,10 +41,9 @@ def test_get_ai_model(model: str, model_url: str | None, ai_api_key: str, expect
("model", "expected_model_name", "expectation"),
[
# Normal matches
("gemini-2.5-flash-*", "gemini-2.5-flash-preview-05-20", does_not_raise()),
("gemini-2.5-pro-preview-*", "gemini-2.5-pro-preview-06-05", does_not_raise()),
("gemini-2.5-flash-preview-*", "gemini-2.5-flash-preview-09-25", does_not_raise()),
# Exact match
("gemini-2.5-pro-preview-06-05", "gemini-2.5-pro-preview-06-05", does_not_raise()),
("gemini-2.5-flash-preview-09-25", "gemini-2.5-flash-preview-09-25", does_not_raise()),
# No wildcard results in no attempt to actually match
("gemini-2.5-pro-preview-", "gemini-2.5-pro-preview-06-05", pytest.raises(MissingModelUrl)),
# Multiple matches that we cannot narrow down by date
Expand Down
2 changes: 1 addition & 1 deletion tests/git/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
+++ src/lgtm_ai/config/constants.py
@@ -2,4 +2,4 @@ from lgtm_ai.ai.schemas import SupportedAIModels

DEFAULT_AI_MODEL: SupportedAIModels = "gemini-2.0-flash"
DEFAULT_AI_MODEL: SupportedAIModels = "gemini-2.5-flash"
DEFAULT_INPUT_TOKEN_LIMIT = 500000
-DEFAULT_ISSUE_REGEX = r"(?:refs?|closes?)[:\s]*((?:#\d+)|(?:#?[A-Z]+-\d+))|(?:fix|feat|docs|style|refactor|perf|test|build|ci)\((?:#(\d+)|#?([A-Z]+-\d+))\)!?:"
+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+))\)!?:"
Expand Down
4 changes: 2 additions & 2 deletions tests/review/test_guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_get_guide_from_url_valid() -> None:
):
guide_generator = ReviewGuideGenerator(
guide_agent=test_agent,
model=mock.Mock(spec=OpenAIChatModel, model_name="gemini-2.0-flash"),
model=mock.Mock(spec=OpenAIChatModel, model_name="gemini-2.5-flash"),
git_client=MockGitClient(),
config=ResolvedConfig(ai_api_key="", git_api_key=""),
)
Expand All @@ -49,5 +49,5 @@ def test_get_guide_from_url_valid() -> None:
checklist=[GuideChecklistItem(description="a")],
references=[GuideReference(title="a", url="a")],
),
metadata=PublishMetadata(model_name="gemini-2.0-flash", usage=guide.metadata.usage),
metadata=PublishMetadata(model_name="gemini-2.5-flash", usage=guide.metadata.usage),
)
Loading