Class: RailsAi::Agents::CreativeAgent
- Defined in:
- lib/rails_ai/agents/specialized_agents.rb
Overview
Creative Agent - Specialized in creative tasks and ideation
Instance Attribute Summary
Attributes inherited from BaseAgent
#active_tasks, #capabilities, #completed_tasks, #created_at, #failed_tasks, #last_activity, #memory, #name, #role, #state
Instance Method Summary collapse
- #brainstorm(topic, quantity: 10) ⇒ Object
- #design_concept(description, style: :modern) ⇒ Object
-
#initialize(name: "CreativeAgent", **opts) ⇒ CreativeAgent
constructor
A new instance of CreativeAgent.
- #write_story(prompt, genre: :general, length: :medium) ⇒ Object
Methods inherited from BaseAgent
#accept_delegated_task, #assign_task, #can_handle_task?, #collaborate_with, #complete_task, #decide_next_action, #delegate_task, #fail_task, #forget, #get_messages, #has_capability?, #health_check, #pause!, #recall, #receive_message, #remember, #resume!, #send_message, #start!, #status, #stop!, #think
Constructor Details
#initialize(name: "CreativeAgent", **opts) ⇒ CreativeAgent
Returns a new instance of CreativeAgent.
80 81 82 83 84 85 86 87 |
# File 'lib/rails_ai/agents/specialized_agents.rb', line 80 def initialize(name: "CreativeAgent", **opts) super( name: name, role: "Creative Specialist", capabilities: [:creative_writing, :ideation, :design_thinking, :storytelling], **opts ) end |
Instance Method Details
#brainstorm(topic, quantity: 10) ⇒ Object
89 90 91 92 93 94 95 96 97 98 |
# File 'lib/rails_ai/agents/specialized_agents.rb', line 89 def brainstorm(topic, quantity: 10) return Array.new(quantity) { "[stubbed] Creative idea #{_1 + 1}" } if RailsAi.config.stub_responses brainstorm_prompt = build_brainstorm_prompt(topic, quantity) result = think(brainstorm_prompt, context: { topic: topic, quantity: quantity }) ideas = parse_ideas(result) remember("brainstorm_#{topic}_#{Time.now.to_i}", ideas, importance: :high) ideas end |
#design_concept(description, style: :modern) ⇒ Object
110 111 112 113 114 115 116 117 118 |
# File 'lib/rails_ai/agents/specialized_agents.rb', line 110 def design_concept(description, style: :modern) return "[stubbed] Design concept: #{description}" if RailsAi.config.stub_responses design_prompt = build_design_prompt(description, style) result = think(design_prompt, context: { description: description, style: style }) remember("design_#{description.hash}", result, importance: :normal) result end |
#write_story(prompt, genre: :general, length: :medium) ⇒ Object
100 101 102 103 104 105 106 107 108 |
# File 'lib/rails_ai/agents/specialized_agents.rb', line 100 def write_story(prompt, genre: :general, length: :medium) return "[stubbed] Story: #{prompt}" if RailsAi.config.stub_responses story_prompt = build_story_prompt(prompt, genre, length) result = think(story_prompt, context: { prompt: prompt, genre: genre, length: length }) remember("story_#{prompt.hash}", result, importance: :normal) result end |