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:, attempt_id: nil, duration_ms: nil) ⇒ Object



25
26
27
# File 'lib/smith/agent/provider_attempt.rb', line 25

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

.success(completion:, model_reference:, attempt_id: nil, duration_ms: nil) ⇒ Object



21
22
23
# File 'lib/smith/agent/provider_attempt.rb', line 21

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

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/smith/agent/provider_attempt.rb', line 29

def success?
  error.nil?
end