Class: Google::ADK::CallbackContext
- Inherits:
-
ReadonlyContext
- Object
- ReadonlyContext
- Google::ADK::CallbackContext
- Defined in:
- lib/google/adk/context.rb
Overview
Context for callbacks with mutable state
Direct Known Subclasses
Instance Attribute Summary collapse
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Attributes inherited from ReadonlyContext
Instance Method Summary collapse
-
#initialize(invocation_id:, agent_name:, session:) ⇒ CallbackContext
constructor
Initialize callback context.
-
#state ⇒ Hash
Get mutable state from session.
-
#update_state(updates) ⇒ Object
Update multiple state values.
Constructor Details
#initialize(invocation_id:, agent_name:, session:) ⇒ CallbackContext
Initialize callback context
69 70 71 72 73 |
# File 'lib/google/adk/context.rb', line 69 def initialize(invocation_id:, agent_name:, session:) @invocation_id = invocation_id @agent_name = agent_name @session = session end |
Instance Attribute Details
#session ⇒ Object (readonly)
Returns the value of attribute session.
62 63 64 |
# File 'lib/google/adk/context.rb', line 62 def session @session end |
Instance Method Details
#state ⇒ Hash
Get mutable state from session
78 79 80 |
# File 'lib/google/adk/context.rb', line 78 def state @session.state end |
#update_state(updates) ⇒ Object
Update multiple state values
85 86 87 |
# File 'lib/google/adk/context.rb', line 85 def update_state(updates) state.merge!(updates) end |