Class: Smith::Agent::ProviderAttempt

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/smith/agent/provider_attempt.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.failure(error:, model_reference:) ⇒ Object



19
20
21
# File 'lib/smith/agent/provider_attempt.rb', line 19

def self.failure(error:, model_reference:)
  new(completion: nil, model_reference:, error:)
end

.success(completion:, model_reference:) ⇒ Object



15
16
17
# File 'lib/smith/agent/provider_attempt.rb', line 15

def self.success(completion:, model_reference:)
  new(completion:, model_reference:, error: nil)
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/smith/agent/provider_attempt.rb', line 23

def success?
  error.nil?
end