Class: Pikuri::Agent::Event::Tokens
- Inherits:
-
Data
- Object
- Data
- Pikuri::Agent::Event::Tokens
- Defined in:
- lib/pikuri/agent/event.rb
Overview
Provider-reported token usage for one assistant turn, off a
+RubyLLM::Message+'s tokens block. Emitted by after_message on
every assistant turn (including pure tool-call turns, where
context growth matters most).
Every count is Integer, nil; nil means the provider omitted
the field (common on local llama.cpp/Ollama) and is treated as
zero. +input+/+cached+/+cache_creation+ are exclusive slices of
this turn's prompt and sum to its total size (llama.cpp +
Anthropic shape; OpenAI nests cached inside input, so revisit
the sum if pikuri ever targets it directly). cached still counts
against the context window.
input— newly-processed (uncached) prompt tokens this turn.output— tokens in this reply.cached— prompt tokens served from the provider's cache.cache_creation— prompt tokens written to the cache (Anthropic).thinking— reasoning tokens (Anthropic thinking / OpenAI o-series);nilwithout a reasoning channel.model_id— provider-side model name on the response.
Instance Attribute Summary collapse
-
#cache_creation ⇒ Object
readonly
Returns the value of attribute cache_creation.
-
#cached ⇒ Object
readonly
Returns the value of attribute cached.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#model_id ⇒ Object
readonly
Returns the value of attribute model_id.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#thinking ⇒ Object
readonly
Returns the value of attribute thinking.
Instance Attribute Details
#cache_creation ⇒ Object (readonly)
Returns the value of attribute cache_creation
99 100 101 |
# File 'lib/pikuri/agent/event.rb', line 99 def cache_creation @cache_creation end |
#cached ⇒ Object (readonly)
Returns the value of attribute cached
99 100 101 |
# File 'lib/pikuri/agent/event.rb', line 99 def cached @cached end |
#input ⇒ Object (readonly)
Returns the value of attribute input
99 100 101 |
# File 'lib/pikuri/agent/event.rb', line 99 def input @input end |
#model_id ⇒ Object (readonly)
Returns the value of attribute model_id
99 100 101 |
# File 'lib/pikuri/agent/event.rb', line 99 def model_id @model_id end |
#output ⇒ Object (readonly)
Returns the value of attribute output
99 100 101 |
# File 'lib/pikuri/agent/event.rb', line 99 def output @output end |
#thinking ⇒ Object (readonly)
Returns the value of attribute thinking
99 100 101 |
# File 'lib/pikuri/agent/event.rb', line 99 def thinking @thinking end |