Class: Rasti::AI::AssistantState
- Inherits:
-
Object
- Object
- Rasti::AI::AssistantState
- Defined in:
- lib/rasti/ai/assistant_state.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
Instance Method Summary collapse
- #fetch(key, &block) ⇒ Object
-
#initialize(context: nil) ⇒ AssistantState
constructor
A new instance of AssistantState.
Constructor Details
#initialize(context: nil) ⇒ AssistantState
Returns a new instance of AssistantState.
7 8 9 10 11 |
# File 'lib/rasti/ai/assistant_state.rb', line 7 def initialize(context:nil) @messages = [] @cache = {} @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
5 6 7 |
# File 'lib/rasti/ai/assistant_state.rb', line 5 def context @context end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
5 6 7 |
# File 'lib/rasti/ai/assistant_state.rb', line 5 def @messages end |
Instance Method Details
#fetch(key, &block) ⇒ Object
13 14 15 16 |
# File 'lib/rasti/ai/assistant_state.rb', line 13 def fetch(key, &block) cache[key] = block.call unless cache.key? key cache[key] end |