Class: Smith::Trace::Memory
- Inherits:
-
Object
- Object
- Smith::Trace::Memory
- Defined in:
- lib/smith/trace/memory.rb
Constant Summary collapse
- CONFIG_MAP =
{ transition: :trace_transitions, tool_call: :trace_tool_calls, token_usage: :trace_token_usage, cost: :trace_cost, normalizer_decision: :trace_normalizer }.freeze
- CONTENT_KEYS =
%i[content prompt response args result].freeze
Instance Attribute Summary collapse
-
#traces ⇒ Object
readonly
Returns the value of attribute traces.
Instance Method Summary collapse
- #clear! ⇒ Object
-
#initialize ⇒ Memory
constructor
A new instance of Memory.
- #record(type:, data:) ⇒ Object
Constructor Details
#initialize ⇒ Memory
Returns a new instance of Memory.
18 19 20 |
# File 'lib/smith/trace/memory.rb', line 18 def initialize @traces = [] end |
Instance Attribute Details
#traces ⇒ Object (readonly)
Returns the value of attribute traces.
16 17 18 |
# File 'lib/smith/trace/memory.rb', line 16 def traces @traces end |
Instance Method Details
#clear! ⇒ Object
28 29 30 |
# File 'lib/smith/trace/memory.rb', line 28 def clear! @traces = [] end |
#record(type:, data:) ⇒ Object
22 23 24 25 26 |
# File 'lib/smith/trace/memory.rb', line 22 def record(type:, data:) return unless type_enabled?(type) @traces << { type: type, data: filter_content(data) } end |