Class: Ace::Idea::Molecules::IdeaLlmEnhancer
- Inherits:
-
Object
- Object
- Ace::Idea::Molecules::IdeaLlmEnhancer
- Defined in:
- lib/ace/idea/molecules/idea_llm_enhancer.rb
Overview
Enhances ideas with LLM to produce the 3-Question Brief structure. System prompt is hardcoded for this iteration (as specified by task 291.01).
3-Question Brief structure:
-
What I Hope to Accomplish
-
What “Complete” Looks Like
-
Success Criteria
Constant Summary collapse
- SYSTEM_PROMPT =
Hardcoded system prompt for 3-Question Brief generation
<<~PROMPT You are an assistant that helps structure raw software development ideas into clear, actionable briefs. Given a raw idea, produce a structured response as a JSON object with these fields: - "title": a concise, clear title for the idea (max 60 chars) - "enhanced_content": the full enhanced idea in markdown with exactly these 3 sections: ## What I Hope to Accomplish (The desired impact or outcome - why this matters) ## What "Complete" Looks Like (A concrete end state that would indicate this idea is fully realized) ## Success Criteria (Verifiable checks that confirm success - use bullet points) Keep it concise and actionable. Respond with valid JSON only. PROMPT
Instance Method Summary collapse
-
#enhance(content) ⇒ Hash
Enhance content using LLM.
-
#initialize(config: {}) ⇒ IdeaLlmEnhancer
constructor
A new instance of IdeaLlmEnhancer.
Constructor Details
#initialize(config: {}) ⇒ IdeaLlmEnhancer
Returns a new instance of IdeaLlmEnhancer.
36 37 38 39 40 41 |
# File 'lib/ace/idea/molecules/idea_llm_enhancer.rb', line 36 def initialize(config: {}) @config = config @model = config.dig("idea", "llm_model") || config["llm_model"] || "gflash" end |
Instance Method Details
#enhance(content) ⇒ Hash
Enhance content using LLM
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ace/idea/molecules/idea_llm_enhancer.rb', line 46 def enhance(content) return fallback_enhancement(content) unless llm_available? result = call_llm(content) if result[:success] format_enhanced(result[:data], content) else fallback_enhancement(content) end rescue => e fallback_enhancement(content, error: e.) end |