Adding claude 3.7 option to troubleshoot job

What does this MR do and why?

This MR adds a FF to migrate claude to 3.7 using the newest and improved version.

This relies on the related MR to be merged first: gitlab-org/modelops/applied-ml/code-suggestions/ai-assist!2080 (merged)

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

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.

Screenshots or screen recordings

Feature.enable(:prompt_migration_troubleshoot_job) should already be enabled and is independent of this MR.

With upgrade_troubleshoot_job_to_3_7 disabled, the ai-gateway logs would look like

'model': 'claude-3-5-sonnet-20241022'
2025-03-03 16:24:36 [info     ] Request to LLM                 api_key=None correlation_id=01JNF8MJ0ZAGRMJ6WT6NFFPYRT request_content_json={'max_tokens': 2048, 'messages': [{'role': 'user', 'content': 'You are tasked ....'}], 'model': 'claude-3-5-sonnet-20241022', 'stream': True, 'system': "You are a Software engineer's or DevOps engineer's Assistant.\nYou can explain the root cause of a GitLab CI verification job code failure from the job log.\n", 'temperature': 0.1} request_method=POST request_url=URL('https://api.anthropic.com/v1/messages') source=ai_gateway.models.base

With upgrade_troubleshoot_job_to_3_7 enabled, the logs will use the new prompt version

'model': 'claude-3-7-sonnet-20250219'
2025-03-03 17:46:22 [info     ] Request to LLM                 api_key=None correlation_id=01JNFD810PJX55SBQ8YQJPKW06 request_content_json={'max_tokens': 2048, 'messages': [{'role': 'user', 'content': 'You .....'}], 'model': 'claude-3-7-sonnet-20250219', 'stream': True, 'system': "You are a Software engineer's or DevOps engineer's Assistant.\nYou can explain the root cause of a GitLab CI verification job code failure from the job log.\n", 'temperature': 0.1} request_method=POST request_url=URL('https://api.anthropic.com/v1/messages') source=ai_gateway.models.base

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Ensure AI is setup via https://docs.gitlab.com/development/code_suggestions/#setup-instructions-to-use-gdk-with-the-code-suggestions-add-on

This also relies on related MR: gitlab-org/modelops/applied-ml/code-suggestions/ai-assist!2080 (merged)

Ensure FF **Feature.enable(:prompt_migration_troubleshoot_job) as well as upgrade_troubleshoot_job_to_3_7 are enabled.

Trigging /troubleshoot from a failed job should write the model it's using via the logs.

Related to #523068

Edited by Max Fan

Merge request reports

Loading