Class: Sublayer::Agents::GenerateMetaforGivenTextAgent
- Inherits:
-
Object
- Object
- Sublayer::Agents::GenerateMetaforGivenTextAgent
- Includes:
- Capabilities::HumanAssistance, Capabilities::LLMAssistance
- Defined in:
- lib/sublayer/agents/generate_metafor_given_text_agent.rb
Instance Attribute Summary collapse
-
#metaphors ⇒ Object
readonly
Returns the value of attribute metaphors.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(text:) ⇒ GenerateMetaforGivenTextAgent
constructor
A new instance of GenerateMetaforGivenTextAgent.
- #prompt ⇒ Object
Constructor Details
#initialize(text:) ⇒ GenerateMetaforGivenTextAgent
Returns a new instance of GenerateMetaforGivenTextAgent.
15 16 17 |
# File 'lib/sublayer/agents/generate_metafor_given_text_agent.rb', line 15 def initialize(text:) @text = text end |
Instance Attribute Details
#metaphors ⇒ Object (readonly)
Returns the value of attribute metaphors.
9 10 11 |
# File 'lib/sublayer/agents/generate_metafor_given_text_agent.rb', line 9 def @metaphors end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
9 10 11 |
# File 'lib/sublayer/agents/generate_metafor_given_text_agent.rb', line 9 def results @results end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
9 10 11 |
# File 'lib/sublayer/agents/generate_metafor_given_text_agent.rb', line 9 def text @text end |
Instance Method Details
#execute ⇒ Object
19 20 21 |
# File 'lib/sublayer/agents/generate_metafor_given_text_agent.rb', line 19 def execute @metaphors = llm_generate end |
#prompt ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/sublayer/agents/generate_metafor_given_text_agent.rb', line 23 def prompt <<-PROMPT You are an expert in language, literature, communications, and storytelling. You are tasked with identifying metaphors that can explain text in a more relateable and digestible way. Here is the text snippet: ###TEXT### #{text} ###END TEXT### After reviewing the text, please suggest a metaphor to explain the text. Consider the meanings, and use commonly understood subjects to draw metaphors from. Metaphors should be relevant and enrich the comprehension of the text. Take a deep breath and let your creativity flow. Keep your response succinct and enjoyable to read even for a teenager. PROMPT end |