Class: Regent::LLM::Base

Inherits:
Object
  • Object
show all
Includes:
Concerns::Dependable
Defined in:
lib/regent/llm/base.rb

Direct Known Subclasses

Anthropic, Gemini, Ollama, OpenAI, OpenRouter

Instance Method Summary collapse

Methods included from Concerns::Dependable

included, #require_dynamic

Constructor Details

#initialize(model:, api_key: nil, **options) ⇒ Base

Returns a new instance of Base.



10
11
12
13
14
15
16
# File 'lib/regent/llm/base.rb', line 10

def initialize(model:, api_key: nil, **options)
  @model = model
  @api_key = api_key || api_key_from_env
  @options = options

  super()
end

Instance Method Details

#parse_error(error) ⇒ Object



18
19
20
# File 'lib/regent/llm/base.rb', line 18

def parse_error(error)
  error.response.dig(:body, "error", "message")
end