Add Claude 3.7 support for Duo Code Review
What does this MR do and why?
This MR adds Claude 3.7 Sonnet support for Duo Code Review via a feature flag.
References
- #521359
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
- In rails console enable the experiment fully
Feature.enable(:duo_code_review_claude_3_7_sonnet, user) - Run
tail -f log/llm.log | jqin console to see the log as it happens - Create an MR with some changes that contain obvious errors and request Duo Code Review by assigning it to
@GitLabDuo - Verify successful Duo Code Review
- Verify "model": "claude-3-7-sonnet-20250219" is used for
review_merge_requestrequest. Should look something like this.
{
"severity": "INFO",
"time": "2025-02-28T04:32:22.804Z",
"correlation_id": "01JN5D7BTPM6B8HB2DF6SH18SN",
"meta.caller_id": "Llm::CompletionWorker",
"meta.feature_category": "ai_abstraction_layer",
"meta.organization_id": 1,
"meta.remote_ip": "127.0.0.1",
"meta.http_router_rule_action": "classify",
"meta.http_router_rule_type": "SESSION_PREFIX",
"meta.user": "root",
"meta.user_id": 1,
"meta.client_id": "user/1",
"meta.root_caller_id": "GraphqlController#execute",
"ai_request_type": "messages",
"unit_primitive": "review_merge_request",
"options": {
"system": "You are an experienced software developer tasked with reviewing code changes made by your colleague in a GitLab merge request. Your goal is to review the changes thoroughly and offer constructive and yet concise feedback if required.",
"model": "claude-3-7-sonnet-20250219"
},
"message": "Performing request to Anthropic",
"class": "Gitlab::Llm::Anthropic::Client",
"ai_event_name": "performing_request",
"ai_component": "abstraction_layer"
}
Related to #521359
Edited by Sincheol (David) Kim