Class: DSPy::LM::Response
- Inherits:
-
Object
- Object
- DSPy::LM::Response
- Defined in:
- lib/dspy/lm/response.rb
Overview
Normalized response format for all LM providers
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#usage ⇒ Object
readonly
Returns the value of attribute usage.
Instance Method Summary collapse
-
#initialize(content:, usage: nil, metadata: {}) ⇒ Response
constructor
A new instance of Response.
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(content:, usage: nil, metadata: {}) ⇒ Response
Returns a new instance of Response.
9 10 11 12 13 |
# File 'lib/dspy/lm/response.rb', line 9 def initialize(content:, usage: nil, metadata: {}) @content = content @usage = usage @metadata = end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
7 8 9 |
# File 'lib/dspy/lm/response.rb', line 7 def content @content end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
7 8 9 |
# File 'lib/dspy/lm/response.rb', line 7 def @metadata end |
#usage ⇒ Object (readonly)
Returns the value of attribute usage.
7 8 9 |
# File 'lib/dspy/lm/response.rb', line 7 def usage @usage end |
Instance Method Details
#to_h ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/dspy/lm/response.rb', line 19 def to_h { content: content, usage: usage, metadata: } end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/dspy/lm/response.rb', line 15 def to_s content end |