Instance level model selection GrapQL query to get model list

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

What is this issue about

We aim to implement an GrapQL interface for the ModelSelection::InstanceFeatureSetting model.

How to setup locally

See this comment.

Implementation proposal

First you'll need to create the 'AiModelSelectionInstanceFeatureSetting' type at ee/app/graphql/types/ai/model_selection/instance/feature_setting_type.rb. Lucky, we have already created shared logic for this. You could implement it that way:

# frozen_string_literal: true

module Types
  module Ai
    module ModelSelection
      module Namespaces
        # rubocop: disable Graphql/AuthorizeTypes -- authorization in resolver/mutation
        class FeatureSettingType < ::Types::Ai::ModelSelection::FeatureSettingBase
          graphql_name 'AiModelSelectionInstanceFeatureSetting'
          description 'Model Selection feature setting for the instance.'
        # rubocop: enable Graphql/AuthorizeTypes
      end
    end
  end
end

You can build a resolver around with it with the neccesary authorization.

The schema has to look like this:

query getAiInstanceFeatureSettings {
  aiModelSelectionInstanceSettings {
    nodes {
      feature
      title
      mainFeature
      selectedModel {
        ref
        name
      }
      defaultModel {
        name
      }
      selectableModels {
        ref
        name
      }
    }
  }
}

Which is the same as this schema without the GroupId argument.

Edited by 🤖 GitLab Bot 🤖