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
-
#cache_hit ⇒ Boolean
readonly
Returns the value of attribute cache_hit.
-
#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, cache_hit: 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, cache_hit: false) ⇒ Response
Returns a new instance of Response.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ruby_llm_mesh/response.rb', line 7 def initialize(content:, provider:, model: nil, usage: {}, raw: nil, latency_ms: nil, fallback_used: false, cache_hit: false) @content = content @provider = provider @model = model @usage = usage || {} @raw = raw @latency_ms = latency_ms @fallback_used = fallback_used @cache_hit = cache_hit end |
Instance Attribute Details
#cache_hit ⇒ Boolean (readonly)
Returns the value of attribute cache_hit.
5 6 7 |
# File 'lib/ruby_llm_mesh/response.rb', line 5 def cache_hit @cache_hit end |
#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
19 20 21 |
# File 'lib/ruby_llm_mesh/response.rb', line 19 def text content end |
#to_h ⇒ Hash[Symbol, untyped]
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ruby_llm_mesh/response.rb', line 27 def to_h { content: content, provider: provider, model: model, usage: usage, latency_ms: latency_ms, fallback_used: fallback_used, cache_hit: cache_hit } end |
#to_s ⇒ String
23 24 25 |
# File 'lib/ruby_llm_mesh/response.rb', line 23 def to_s content.to_s end |