Skip to content

Add aiFeatureSettings GQL query

Patrick Cyiza requested to merge 487953-ai-feature-settings-graphql-query into master

Add aiFeatureSettings GQL query

GraphQL query to support frontend retrieving the self-hosted models compatible with a certain configurable AI feature.

it covers these issues:

All packaged in one query as suggested in !166132 (comment 2125234328)

EE: true Changelog: added

How to set up and validate locally

query aiFeatureSettings {
  aiFeatureSettings {
    nodes {
      feature
      title
      mainFeature
      provider
      releaseState
      compatibleLlms
      selfHostedModel {
        id
        name
        model
      }
      validModels {
        nodes {
         	id
          name
          model 
        }
      }
    }
  }
}

response

{
  "data": {
    "aiFeatureSettings": {
      "nodes": [
        {
          "feature": "code_generations",
          "title": "Code Generation",
          "mainFeature": "Code Suggestions",
          "provider": "self_hosted",
          "releaseState": "GA",
          "compatibleLlms": [
            "codegemma",
            "codellama",
            "codestral",
            "deepseekcoder",
            "mistral",
            "mixtral",
            "mixtral_8x22b"
          ],
          "selfHostedModel": {
            "id": "gid://gitlab/Ai::SelfHostedModel/3",
            "name": "test-codegemma",
            "model": "codegemma"
          },
          "validModels": {
            "nodes": [
              {
                "id": "gid://gitlab/Ai::SelfHostedModel/3",
                "name": "test-codegemma",
                "model": "codegemma"
              },
              {
                "id": "gid://gitlab/Ai::SelfHostedModel/1",
                "name": "mistral-local-ollama-",
                "model": "mistral"
              },
              {
                "id": "gid://gitlab/Ai::SelfHostedModel/4",
                "name": "anothermistral",
                "model": "mistral"
              }
            ]
          }
        },
        (...)
        {
          "feature": "duo_chat",
          "title": "Duo Chat",
          "mainFeature": "Duo Chat",
          "provider": "vendored",
          "releaseState": "BETA",
          "compatibleLlms": [
            "mistral",
            "mixtral_8x22b",
            "mixtral"
          ],
          "selfHostedModel": {
            "id": "gid://gitlab/Ai::SelfHostedModel/1",
            "name": "mistral-local-ollama-",
            "model": "mistral"
          },
          "validModels": {
            "nodes": [
              {
                "id": "gid://gitlab/Ai::SelfHostedModel/1",
                "name": "mistral-local-ollama-",
                "model": "mistral"
              },
              {
                "id": "gid://gitlab/Ai::SelfHostedModel/4",
                "name": "anothermistral",
                "model": "mistral"
              }
            ]
          }
        }
      ]
    }
  }
}

## With the self-hosted model's ID

query aiFeatureSettings(selfHostedModelId: "gid://gitlab/Ai::SelfHostedModel/3") {
  aiFeatureSettings {
    nodes {
      feature
      title
      mainFeature
      provider
      releaseState
      compatibleLlms
      selfHostedModel {
        id
        name
        model
      }
      validModels {
        nodes {
         	id
          name
          model 
        }
      }
    }
  }
}

response

{
  "data": {
    "aiFeatureSettings": {
      "nodes": [
        {
          "feature": "code_generations",
          "title": "Code Generation",
          "mainFeature": "Code Suggestions",
          "provider": "self_hosted",
          "releaseState": "GA",
          "compatibleLlms": [
            "codegemma",
            "codellama",
            "codestral",
            "deepseekcoder",
            "mistral",
            "mixtral",
            "mixtral_8x22b"
          ],
          "selfHostedModel": {
            "id": "gid://gitlab/Ai::SelfHostedModel/3",
            "name": "test-codegemma",
            "model": "codegemma"
          },
          "validModels": {
            "nodes": [
              {
                "id": "gid://gitlab/Ai::SelfHostedModel/3",
                "name": "test-codegemma",
                "model": "codegemma"
              },
              {
                "id": "gid://gitlab/Ai::SelfHostedModel/1",
                "name": "mistral-local-ollama-",
                "model": "mistral"
              },
              {
                "id": "gid://gitlab/Ai::SelfHostedModel/4",
                "name": "anothermistral",
                "model": "mistral"
              }
            ]
          }
        }
      ]
    }
  }
}

Related to #487953 (closed)

Edited by Patrick Cyiza

Merge request reports

Loading