Class: Qualspec::Client::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/qualspec/client.rb

Overview

Response with metadata

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content:, duration_ms: nil, cost: nil, model: nil, tokens: nil) ⇒ Response

Returns a new instance of Response.



14
15
16
17
18
19
20
# File 'lib/qualspec/client.rb', line 14

def initialize(content:, duration_ms: nil, cost: nil, model: nil, tokens: nil)
  @content = content
  @duration_ms = duration_ms
  @cost = cost
  @model = model
  @tokens = tokens
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



12
13
14
# File 'lib/qualspec/client.rb', line 12

def content
  @content
end

#costObject (readonly)

Returns the value of attribute cost.



12
13
14
# File 'lib/qualspec/client.rb', line 12

def cost
  @cost
end

#duration_msObject (readonly)

Returns the value of attribute duration_ms.



12
13
14
# File 'lib/qualspec/client.rb', line 12

def duration_ms
  @duration_ms
end

#modelObject (readonly)

Returns the value of attribute model.



12
13
14
# File 'lib/qualspec/client.rb', line 12

def model
  @model
end

#tokensObject (readonly)

Returns the value of attribute tokens.



12
13
14
# File 'lib/qualspec/client.rb', line 12

def tokens
  @tokens
end

Instance Method Details

#to_sObject

Allow using response as a string



23
24
25
# File 'lib/qualspec/client.rb', line 23

def to_s
  @content
end

#to_strObject



27
28
29
# File 'lib/qualspec/client.rb', line 27

def to_str
  @content
end