Resolve "Integrate Model Selection with Code Generation"

What does this MR do and why?

This MR integrates model selection with Code Generation (NOT Code completion).

Code generation requests are always passed through the monolith, so there are no concerns around "direct connection".

Testing steps:

  1. gdk update so that changes in gitlab-org/modelops/applied-ml/code-suggestions/ai-assist!2675 (merged) land on GDK.
  2. Install VSCode and install the GitLab workflow extension.
  3. Login to the GitLab workflow extension with your GDK credentials (ie, PAT of root user)
  4. Enable model switching globally: Feature.enable(:ai_model_switching)
  5. In the root group where you have enabled model switching, set Claude Sonnet 3.7 as the model for Code Generation via http://gdk.test:3000/groups/group-name/-/settings/gitlab_duo/model_selection

Screenshot_2025-06-04_at_10.41.09_AM

  1. Clone any project within this group locally, and open it in VSCode.
  2. Make sure that VSCode correctly associates the opened folder to a GitLab project. If it does, you should be a able to see the following details on the GitLab Workflow tab like Issues assigned to me etc.

Screenshot_2025-06-04_at_10.26.12_AM

  1. Create a new file named hello.py and fire a generation request like
# generate a method to print hello world
  1. If you tail ai gateway logs with gdk tail gitlab-ai-gateway, you should be able to see that the generation request was powered by Claude Sonnet 3.7 and that it works.

Screenshot_2025-06-04_at_10.48.38_AM

Screenshot_2025-06-04_at_10.45.24_AM

  1. Similarly, if we switch the model for code generation to Claude Sonnet 3.5 and execute a generation request, we can see in the logs that the request is indeed powered by Sonnet 3.5

Screenshot_2025-06-04_at_10.47.15_AM

References

Screenshots or screen recordings

Before After

How to set up and validate locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #545065 (closed)

Edited by Manoj M J [OOO]

Merge request reports

Loading