Class: MistralModels::CompletionResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/mistral_rb/response_models.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_hash) ⇒ CompletionResponse

Returns a new instance of CompletionResponse.



5
6
7
8
9
10
11
12
# File 'lib/mistral_rb/response_models.rb', line 5

def initialize(response_hash)
  @id = response_hash["id"]
  @object = response_hash["object"]
  @created = response_hash["created"]
  @model = response_hash["model"]
  @choices = response_hash["choices"].map { |choice| Choice.new(choice) }
  @usage = response_hash["usage"]
end

Instance Attribute Details

#choicesObject (readonly)

Returns the value of attribute choices.



3
4
5
# File 'lib/mistral_rb/response_models.rb', line 3

def choices
  @choices
end

#createdObject (readonly)

Returns the value of attribute created.



3
4
5
# File 'lib/mistral_rb/response_models.rb', line 3

def created
  @created
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/mistral_rb/response_models.rb', line 3

def id
  @id
end

#modelObject (readonly)

Returns the value of attribute model.



3
4
5
# File 'lib/mistral_rb/response_models.rb', line 3

def model
  @model
end

#objectObject (readonly)

Returns the value of attribute object.



3
4
5
# File 'lib/mistral_rb/response_models.rb', line 3

def object
  @object
end

#usageObject (readonly)

Returns the value of attribute usage.



3
4
5
# File 'lib/mistral_rb/response_models.rb', line 3

def usage
  @usage
end