Class: ConsoleAgent::ContextBuilder
- Inherits:
-
Object
- Object
- ConsoleAgent::ContextBuilder
- Defined in:
- lib/console_agent/context_builder.rb
Instance Method Summary collapse
- #build ⇒ Object
- #build_smart ⇒ Object
-
#initialize(config = ConsoleAgent.configuration) ⇒ ContextBuilder
constructor
A new instance of ContextBuilder.
Constructor Details
#initialize(config = ConsoleAgent.configuration) ⇒ ContextBuilder
Returns a new instance of ContextBuilder.
3 4 5 |
# File 'lib/console_agent/context_builder.rb', line 3 def initialize(config = ConsoleAgent.configuration) @config = config end |
Instance Method Details
#build ⇒ Object
7 8 9 10 11 12 |
# File 'lib/console_agent/context_builder.rb', line 7 def build build_smart rescue => e ConsoleAgent.logger.warn("ConsoleAgent: context build error: #{e.message}") smart_system_instructions + "\n\n" + environment_context end |
#build_smart ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/console_agent/context_builder.rb', line 14 def build_smart parts = [] parts << smart_system_instructions parts << environment_context parts << memory_context parts.compact.join("\n\n") end |