Skip to content

[fix] Gemini 모델 gemini-2.0-flash-lite로 변경#116

Merged
k3vin7 merged 1 commit intomainfrom
fix/gemini-model-flash-lite
Mar 27, 2026
Merged

[fix] Gemini 모델 gemini-2.0-flash-lite로 변경#116
k3vin7 merged 1 commit intomainfrom
fix/gemini-model-flash-lite

Conversation

@k3vin7
Copy link
Copy Markdown
Contributor

@k3vin7 k3vin7 commented Mar 27, 2026

gemini-2.0-flash 무료 티어 쿼터 0 → gemini-2.0-flash-lite로 변경

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Gemini API endpoint to use the 'gemini-2.0-flash-lite' model. The review feedback suggests externalizing the API URL to a configuration file instead of hardcoding it as a constant to improve maintainability and flexibility across different environments.

Comment on lines 15 to +16
private static final String GEMINI_URL =
"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent";
"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-lite:generateContent";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Gemini 모델 URL을 상수로 하드코딩하는 대신, application.properties와 같은 설정 파일에서 값을 주입받도록 변경하는 것을 고려해 보세요. apiKey가 이미 설정 파일에서 주입되고 있는 것처럼, URL도 외부 설정으로 분리하면 향후 모델 변경이나 환경별(예: 개발, 프로덕션) 설정 관리가 더 유연해집니다.

예를 들어, 다음과 같이 리팩터링할 수 있습니다.

@Component
public class GeminiClient {

    private final RestClient restClient;
    private final String apiKey;
    private final String geminiUrl;

    public GeminiClient(
        @Value("${gemini.api-key:}") String apiKey,
        @Value("${gemini.url:https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-lite:generateContent}") String geminiUrl
    ) {
        this.apiKey = apiKey;
        this.geminiUrl = geminiUrl;
        this.restClient = RestClient.create();
    }

    public String generateComment(String systemInstruction, String userPrompt) {
        // ...
        Map<?, ?> response = restClient.post()
                .uri(geminiUrl + "?key=" + apiKey)
                // ...
    }
}

이렇게 변경하면 코드 수정 없이 설정 파일 변경만으로 Gemini 모델을 쉽게 교체할 수 있습니다.

@k3vin7 k3vin7 merged commit 5898727 into main Mar 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant