Class: Events::LLMResponded
- Inherits:
-
Object
- Object
- Events::LLMResponded
- Defined in:
- lib/events/llm_responded.rb
Overview
Emitted by the drain loop after a single LLM round-trip completes. Carries the raw Anthropic response so downstream subscribers can persist messages, transition session state, and dispatch tool execution when the response is a tool_use.
The drain loop hands off via this event — it does not persist Messages or release the session itself. Single responsibility: one subscriber pumps PendingMessages into the LLM, another owns the aftermath.
Constant Summary collapse
- TYPE =
"session.llm_responded"
Instance Attribute Summary collapse
-
#api_metrics ⇒ Object
readonly
Returns the value of attribute api_metrics.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#session_id ⇒ Object
readonly
Returns the value of attribute session_id.
Instance Method Summary collapse
- #event_name ⇒ Object
-
#initialize(session_id:, response:, api_metrics: nil) ⇒ LLMResponded
constructor
A new instance of LLMResponded.
- #to_h ⇒ Object
Constructor Details
#initialize(session_id:, response:, api_metrics: nil) ⇒ LLMResponded
Returns a new instance of LLMResponded.
21 22 23 24 25 |
# File 'lib/events/llm_responded.rb', line 21 def initialize(session_id:, response:, api_metrics: nil) @session_id = session_id @response = response @api_metrics = api_metrics end |
Instance Attribute Details
#api_metrics ⇒ Object (readonly)
Returns the value of attribute api_metrics.
16 17 18 |
# File 'lib/events/llm_responded.rb', line 16 def api_metrics @api_metrics end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
16 17 18 |
# File 'lib/events/llm_responded.rb', line 16 def response @response end |
#session_id ⇒ Object (readonly)
Returns the value of attribute session_id.
16 17 18 |
# File 'lib/events/llm_responded.rb', line 16 def session_id @session_id end |