Module: Legion::Extensions::Agentic::Language::Narrator::Helpers::LlmEnhancer
- Defined in:
- lib/legion/extensions/agentic/language/narrator/helpers/llm_enhancer.rb
Constant Summary collapse
- SYSTEM_PROMPT =
<<~PROMPT You are the internal narrator for an autonomous AI agent built on LegionIO. You translate raw cognitive metrics into a flowing first-person internal monologue. Write 3-5 sentences that feel like genuine introspection, not a report. Vary your sentence structure. Use present tense. Be concise and vivid. PROMPT
Class Method Summary collapse
Class Method Details
.available? ⇒ Boolean
24 25 26 27 28 29 |
# File 'lib/legion/extensions/agentic/language/narrator/helpers/llm_enhancer.rb', line 24 def available? !!(defined?(Legion::LLM) && Legion::LLM.respond_to?(:started?) && Legion::LLM.started?) rescue StandardError => e log.debug("[narrator:llm] available? check failed: #{e.class}: #{e.}") false end |
.narrate(sections_data:) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/legion/extensions/agentic/language/narrator/helpers/llm_enhancer.rb', line 31 def narrate(sections_data:) prompt = build_narrate_prompt(sections_data) response = llm_ask(prompt) parse_narrate_response(response) rescue StandardError => e log.warn("[narrator:llm] narrate failed: #{e.}") log.warn(e.backtrace) nil end |