Class: DSPy::LM::AnthropicUsage
- Inherits:
-
T::Struct
- Object
- T::Struct
- DSPy::LM::AnthropicUsage
- Extended by:
- T::Sig
- Defined in:
- lib/dspy/lm/usage.rb
Overview
Anthropic-specific usage information with cache token fields
Instance Method Summary collapse
Instance Method Details
#to_h ⇒ Object
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/dspy/lm/usage.rb', line 59 def to_h base = { input_tokens: input_tokens, output_tokens: output_tokens, total_tokens: total_tokens } base[:cache_creation_input_tokens] = cache_creation_input_tokens unless cache_creation_input_tokens.nil? base[:cache_read_input_tokens] = cache_read_input_tokens unless cache_read_input_tokens.nil? base end |