Skip to content

Add top_namespace_model_ref logic to the AIGW request

What does this MR do and why?

Add top_namespace_model_ref logic to the AIGW request

How to set up and validate locally

  1. In the Rails console, enable the feature flag Feature.enable(:ai_model_switching)
  2. project = Project.find(7)
  3. group = project.namespace
  4. user = User.first
  5. Ai::ModelSelection::FetchModelDefinitionsService.new(user, model_selection_scope: group).execute
  6. feature_setting = Ai::ModelSelection::NamespaceFeatureSetting.find_or_initialize_by_feature(group, :duo_chat_explain_code)
  7. params = { offered_model_ref: 'claude_sonnet_3_7_20250219' }
  8. Ai::ModelSelection::UpdateService.new(feature_setting, user, params).execute
  9. Verify that the model params are sent, for example:
{
  "provider": "gitlab",
  "identifier": "claude_sonnet_3_7_20250219",
  "feature_setting": "duo_chat"
}

If the AIGW MR gitlab-org/modelops/applied-ml/code-suggestions/ai-assist!2565 (merged) is not merged, please check it out in the AIGW

Or test the body params sent in def perform_agent_request for Duo chat, and def request_body_agent for chat tools.

Tools Scope

        duo_chat: 2,
        duo_chat_explain_code: 3,
        duo_chat_write_tests: 4,
        duo_chat_refactor_code: 5,
        duo_chat_fix_code: 6

List: !190194 (diffs)

Testing Recordings

Duo chat Screen_Recording_2025-05-20_at_11.26.02

Slash tools Screen_Recording_2025-05-20_at_11.30.26

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 #526276 (closed)

Edited by Mohamed Hamda

Merge request reports

Loading