Class: Durable::Llm::Providers::Groq::GroqResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/durable/llm/providers/groq.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ GroqResponse

Returns a new instance of GroqResponse.



88
89
90
# File 'lib/durable/llm/providers/groq.rb', line 88

def initialize(response)
  @raw_response = response
end

Instance Attribute Details

#raw_responseObject (readonly)

Returns the value of attribute raw_response.



86
87
88
# File 'lib/durable/llm/providers/groq.rb', line 86

def raw_response
  @raw_response
end

Instance Method Details

#choicesObject



92
93
94
# File 'lib/durable/llm/providers/groq.rb', line 92

def choices
  @raw_response['choices'].map { |choice| GroqChoice.new(choice) }
end

#to_hObject



100
101
102
# File 'lib/durable/llm/providers/groq.rb', line 100

def to_h
  @raw_response.dup
end

#to_sObject



96
97
98
# File 'lib/durable/llm/providers/groq.rb', line 96

def to_s
  choices.map(&:to_s).join(' ')
end