Class: RubyLlmMesh::Response
- Inherits:
-
Object
- Object
- RubyLlmMesh::Response
- Defined in:
- lib/ruby_llm_mesh/response.rb,
sig/ruby_llm_mesh.rbs
Instance Attribute Summary collapse
-
#content ⇒ String
readonly
Returns the value of attribute content.
-
#fallback_used ⇒ Boolean
readonly
Returns the value of attribute fallback_used.
-
#latency_ms ⇒ Integer?
readonly
Returns the value of attribute latency_ms.
-
#model ⇒ String?
readonly
Returns the value of attribute model.
-
#provider ⇒ Symbol
readonly
Returns the value of attribute provider.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#usage ⇒ Hash[untyped, untyped]
readonly
Returns the value of attribute usage.
Instance Method Summary collapse
-
#initialize(content:, provider:, model: nil, usage: {}, raw: nil, latency_ms: nil, fallback_used: false) ⇒ Response
constructor
A new instance of Response.
- #text ⇒ String
- #to_h ⇒ Hash[Symbol, untyped]
- #to_s ⇒ String
Constructor Details
#initialize(content:, provider:, model: nil, usage: {}, raw: nil, latency_ms: nil, fallback_used: false) ⇒ Response
Returns a new instance of Response.
7 8 9 10 11 12 13 14 15 |
# File 'lib/ruby_llm_mesh/response.rb', line 7 def initialize(content:, provider:, model: nil, usage: {}, raw: nil, latency_ms: nil, fallback_used: false) @content = content @provider = provider @model = model @usage = usage || {} @raw = raw @latency_ms = latency_ms @fallback_used = fallback_used end |
Instance Attribute Details
#content ⇒ String (readonly)
Returns the value of attribute content.
5 6 7 |
# File 'lib/ruby_llm_mesh/response.rb', line 5 def content @content end |
#fallback_used ⇒ Boolean (readonly)
Returns the value of attribute fallback_used.
5 6 7 |
# File 'lib/ruby_llm_mesh/response.rb', line 5 def fallback_used @fallback_used end |
#latency_ms ⇒ Integer? (readonly)
Returns the value of attribute latency_ms.
5 6 7 |
# File 'lib/ruby_llm_mesh/response.rb', line 5 def latency_ms @latency_ms end |
#model ⇒ String? (readonly)
Returns the value of attribute model.
5 6 7 |
# File 'lib/ruby_llm_mesh/response.rb', line 5 def model @model end |
#provider ⇒ Symbol (readonly)
Returns the value of attribute provider.
5 6 7 |
# File 'lib/ruby_llm_mesh/response.rb', line 5 def provider @provider end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
5 6 7 |
# File 'lib/ruby_llm_mesh/response.rb', line 5 def raw @raw end |
#usage ⇒ Hash[untyped, untyped] (readonly)
Returns the value of attribute usage.
5 6 7 |
# File 'lib/ruby_llm_mesh/response.rb', line 5 def usage @usage end |
Instance Method Details
#text ⇒ String
17 18 19 |
# File 'lib/ruby_llm_mesh/response.rb', line 17 def text content end |
#to_h ⇒ Hash[Symbol, untyped]
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ruby_llm_mesh/response.rb', line 25 def to_h { content: content, provider: provider, model: model, usage: usage, latency_ms: latency_ms, fallback_used: fallback_used } end |
#to_s ⇒ String
21 22 23 |
# File 'lib/ruby_llm_mesh/response.rb', line 21 def to_s content.to_s end |