Skip to content

Add GraphQL node for Self-hosted models list in an instance

Patrick Cyiza requested to merge 461055-get-self-hosted-models-list-gql-api into master

What does this MR do and why?

New GraphQL query to list the self-hosted models, as well as the necessary authorization checks. The feature is currently in alpha and is only available to administrators with the appropriate license.

Add GraphQL node for Self-hosted models list in an instance

Changlog: added EE: true

How to set up and validate locally

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

Prequisites

You need an active

  • An active GitLab ultimate license
  • Make sure the SAAS mode of your GDK is disable
    • echo $GITLAB_SIMULATE_SAAS should return 0
    • See the docs for more information
  • Run the following commands in your terminal
add_on = GitlabSubscriptions::AddOn.find_or_create_by!(name: "code_suggestions") {|e| e.description = "Test"}
add_on_purchase = GitlabSubscriptions::AddOnPurchase.create!(add_on: add_on, expires_on: 1.month.from_now, quantity: 5, purchase_xid: 'A-S0001')
Feature.enable(:self_managed_code_suggestions)
Feature.enable(:ai_custom_model)
ApplicationSetting.first.update(duo_features_enabled: true)

Perform the GQL request

query SelfHostedModel {
  aiSelfHostedModels {
    nodes {
      name
      model
      endpoint
      hasApiToken
    }
  }
}

Related to #461055

Edited by Patrick Cyiza

Merge request reports