Class: CircuitBreaker::Executors::LLM::ConversationMemory
- Defined in:
- lib/circuit_breaker/executors/llm/memory.rb
Instance Attribute Summary
Attributes inherited from Memory
Instance Method Summary collapse
- #add_assistant_message(content, metadata: {}) ⇒ Object
- #add_user_message(content, metadata: {}) ⇒ Object
-
#initialize(system_prompt: nil) ⇒ ConversationMemory
constructor
A new instance of ConversationMemory.
Methods inherited from Memory
#add_message, #clear, #get_context, #to_h
Constructor Details
#initialize(system_prompt: nil) ⇒ ConversationMemory
Returns a new instance of ConversationMemory.
42 43 44 45 |
# File 'lib/circuit_breaker/executors/llm/memory.rb', line 42 def initialize(system_prompt: nil) super() (role: 'system', content: system_prompt) if system_prompt end |
Instance Method Details
#add_assistant_message(content, metadata: {}) ⇒ Object
51 52 53 |
# File 'lib/circuit_breaker/executors/llm/memory.rb', line 51 def (content, metadata: {}) (role: 'assistant', content: content, metadata: ) end |
#add_user_message(content, metadata: {}) ⇒ Object
47 48 49 |
# File 'lib/circuit_breaker/executors/llm/memory.rb', line 47 def (content, metadata: {}) (role: 'user', content: content, metadata: ) end |