diff --git a/ee/app/helpers/ee/application_settings_helper.rb b/ee/app/helpers/ee/application_settings_helper.rb index faa63c87fe00672ea896aa0687d455c1103e4f07..3867744e9983534c10e6cb5456921f8077fa6a5a 100644 --- a/ee/app/helpers/ee/application_settings_helper.rb +++ b/ee/app/helpers/ee/application_settings_helper.rb @@ -68,7 +68,6 @@ def visible_attributes :product_analytics_configurator_connection_string, :cube_api_base_url, :cube_api_key, - :openai_api_key, :security_policy_global_group_approvers_enabled, :security_approval_policies_limit, :anthropic_api_key, diff --git a/ee/lib/ee/api/helpers/settings_helpers.rb b/ee/lib/ee/api/helpers/settings_helpers.rb index 3ccf4b0e349cbe0c7b4fdd46a013651be5a79e31..52adeb136ff6e9b67b17af2ef9f5471bc0522999 100644 --- a/ee/lib/ee/api/helpers/settings_helpers.rb +++ b/ee/lib/ee/api/helpers/settings_helpers.rb @@ -62,7 +62,6 @@ module SettingsHelpers optional :git_rate_limit_users_allowlist, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'List of usernames excluded from Git anti-abuse rate limits' optional :git_rate_limit_users_alertlist, type: Array[Integer], desc: 'List of user ids who will be emailed when Git abuse rate limit is exceeded' optional :auto_ban_user_on_excessive_projects_download, type: Grape::API::Boolean, desc: 'Ban users from the application when they exceed maximum number of unique projects download in the specified time period' - optional :openai_api_key, type: String, desc: "OpenAI API key" optional :anthropic_api_key, type: String, desc: "Anthropic API key" optional :make_profile_private, type: Grape::API::Boolean, desc: 'Flag indicating if users are permitted to make their profiles private' optional :service_access_tokens_expiration_enforced, type: Grape::API::Boolean, desc: "To enforce token expiration for Service accounts users" diff --git a/ee/lib/gitlab/llm/open_ai/workhorse.rb b/ee/lib/gitlab/llm/open_ai/workhorse.rb deleted file mode 100644 index 5994f87f46ce8378a5307d132900a273623a616e..0000000000000000000000000000000000000000 --- a/ee/lib/gitlab/llm/open_ai/workhorse.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module Llm - module OpenAi - class Workhorse - OPEN_AI_API_URL = "https://api.openai.com/v1" - CHAT_URL = "#{OPEN_AI_API_URL}/chat/completions".freeze - - class << self - def default_headers - { - 'Authorization' => ["Bearer #{::Gitlab::CurrentSettings.openai_api_key}"], - 'Content-Type' => ['application/json'] - } - end - - def chat_response(options:) - Gitlab::Workhorse.send_url(CHAT_URL, - body: options.to_json, headers: default_headers, method: "POST") - end - end - end - end - end -end diff --git a/ee/spec/helpers/ee/application_settings_helper_spec.rb b/ee/spec/helpers/ee/application_settings_helper_spec.rb index 0594c57d80b0be6eba673db0c5d2f74fd2cb7b15..04010b0e004815ab7f0c0df79e5b3270bf018e80 100644 --- a/ee/spec/helpers/ee/application_settings_helper_spec.rb +++ b/ee/spec/helpers/ee/application_settings_helper_spec.rb @@ -8,10 +8,6 @@ expect(visible_attributes).to include(*%i[max_personal_access_token_lifetime]) end - it 'contains openai_api_key value' do - expect(visible_attributes).to include(*%i[openai_api_key]) - end - it 'contains anthropic_api_key value' do expect(visible_attributes).to include(*%i[anthropic_api_key]) end diff --git a/ee/spec/requests/api/settings_spec.rb b/ee/spec/requests/api/settings_spec.rb index a83d9f5f1ac4994d5758288570d7ed0c2c9ff02f..4c7ef8feff19b3a3aceaf44889035477f68b8e9c 100644 --- a/ee/spec/requests/api/settings_spec.rb +++ b/ee/spec/requests/api/settings_spec.rb @@ -168,15 +168,6 @@ end end - context 'openai api key setting' do - it 'updates openai_api_key' do - put api('/application/settings', admin, admin_mode: true), params: { openai_api_key: 'OPENAI_API_KEY' } - - expect(response).to have_gitlab_http_status(:ok) - expect(json_response['openai_api_key']).to eq('OPENAI_API_KEY') - end - end - context 'anthropic api key setting' do it 'updates anthropic_api_key' do put api('/application/settings', admin, admin_mode: true), params: { anthropic_api_key: 'ANTHROPIC_API_KEY' }