Class: RubyLLM::Providers::GitLab::OpenAIDelegate

Inherits:
OpenAI
  • Object
show all
Includes:
Chat
Defined in:
lib/ruby_llm/providers/gitlab/openai_delegate.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Chat

#render_payload

Class Method Details

.configuration_optionsObject



31
32
33
# File 'lib/ruby_llm/providers/gitlab/openai_delegate.rb', line 31

def configuration_options
  i[gitlab_api_key gitlab_instance_url gitlab_gateway_url]
end

.configuration_requirementsObject



27
28
29
# File 'lib/ruby_llm/providers/gitlab/openai_delegate.rb', line 27

def configuration_requirements
  i[gitlab_api_key]
end

Instance Method Details

#api_baseObject



9
10
11
# File 'lib/ruby_llm/providers/gitlab/openai_delegate.rb', line 9

def api_base
  token_manager.openai_base_url
end

#completeObject



19
20
21
22
23
24
# File 'lib/ruby_llm/providers/gitlab/openai_delegate.rb', line 19

def complete(...)
  super
rescue RubyLLM::UnauthorizedError
  token_manager.invalidate!
  super
end

#headersObject



13
14
15
16
17
# File 'lib/ruby_llm/providers/gitlab/openai_delegate.rb', line 13

def headers
  {
    'Authorization' => "Bearer #{token_manager.token}"
  }.merge(token_manager.gateway_headers)
end