Class: Llmshim::ChatResponse
- Inherits:
-
Struct
- Object
- Struct
- Llmshim::ChatResponse
- Defined in:
- lib/llmshim/types.rb
Overview
A non-streaming chat completion response (+ChatResponse+ schema).
raw retains the original parsed Hash for forward compatibility.
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#latency_ms ⇒ Object
Returns the value of attribute latency_ms.
-
#message ⇒ Object
Returns the value of attribute message.
-
#model ⇒ Object
Returns the value of attribute model.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#raw ⇒ Object
Returns the value of attribute raw.
-
#reasoning ⇒ Object
Returns the value of attribute reasoning.
-
#usage ⇒ Object
Returns the value of attribute usage.
Class Method Summary collapse
Instance Method Summary collapse
-
#content ⇒ Object
Shortcut for the assistant text content.
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id
54 55 56 |
# File 'lib/llmshim/types.rb', line 54 def id @id end |
#latency_ms ⇒ Object
Returns the value of attribute latency_ms
54 55 56 |
# File 'lib/llmshim/types.rb', line 54 def latency_ms @latency_ms end |
#message ⇒ Object
Returns the value of attribute message
54 55 56 |
# File 'lib/llmshim/types.rb', line 54 def @message end |
#model ⇒ Object
Returns the value of attribute model
54 55 56 |
# File 'lib/llmshim/types.rb', line 54 def model @model end |
#provider ⇒ Object
Returns the value of attribute provider
54 55 56 |
# File 'lib/llmshim/types.rb', line 54 def provider @provider end |
#raw ⇒ Object
Returns the value of attribute raw
54 55 56 |
# File 'lib/llmshim/types.rb', line 54 def raw @raw end |
#reasoning ⇒ Object
Returns the value of attribute reasoning
54 55 56 |
# File 'lib/llmshim/types.rb', line 54 def reasoning @reasoning end |
#usage ⇒ Object
Returns the value of attribute usage
54 55 56 |
# File 'lib/llmshim/types.rb', line 54 def usage @usage end |
Class Method Details
.from_hash(hash) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/llmshim/types.rb', line 58 def self.from_hash(hash) new( id: hash["id"], model: hash["model"], provider: hash["provider"], message: ResponseMessage.from_hash(hash["message"] || {}), reasoning: hash["reasoning"], usage: Usage.from_hash(hash["usage"]), latency_ms: hash["latency_ms"], raw: hash ) end |
Instance Method Details
#content ⇒ Object
Shortcut for the assistant text content.
72 73 74 |
# File 'lib/llmshim/types.rb', line 72 def content &.content end |