Module: Legion::Extensions::Agentic::Affect::Reappraisal::Helpers::LlmEnhancer
- Defined in:
- lib/legion/extensions/agentic/affect/reappraisal/helpers/llm_enhancer.rb
Constant Summary collapse
- SYSTEM_PROMPT =
<<~PROMPT You are the emotion regulation processor for an autonomous AI agent built on LegionIO. You practice cognitive reappraisal — re-interpreting emotional events to change their impact. Generate genuine, psychologically-grounded re-framings. Be specific to the event content. Do not dismiss or minimize. Reframe with depth and insight. PROMPT
Class Method Summary collapse
- .available? ⇒ Boolean
- .generate_reappraisal(event_content:, initial_appraisal:, strategy:, valence:, intensity:) ⇒ Object
Class Method Details
.available? ⇒ Boolean
19 20 21 22 23 |
# File 'lib/legion/extensions/agentic/affect/reappraisal/helpers/llm_enhancer.rb', line 19 def available? !!(defined?(Legion::LLM) && Legion::LLM.respond_to?(:started?) && Legion::LLM.started?) rescue StandardError => _e false end |
.generate_reappraisal(event_content:, initial_appraisal:, strategy:, valence:, intensity:) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/legion/extensions/agentic/affect/reappraisal/helpers/llm_enhancer.rb', line 25 def generate_reappraisal(event_content:, initial_appraisal:, strategy:, valence:, intensity:) prompt = build_generate_reappraisal_prompt( event_content: event_content, initial_appraisal: initial_appraisal, strategy: strategy, valence: valence, intensity: intensity ) response = llm_ask(prompt) parse_generate_reappraisal_response(response) rescue StandardError => e Legion::Logging.warn("[cognitive_reappraisal:llm] generate_reappraisal failed: #{e.}") # rubocop:disable Legion/HelperMigration/DirectLogging nil end |