Class: AgentRuby::Prompt::Summarize
- Inherits:
-
Object
- Object
- AgentRuby::Prompt::Summarize
- Defined in:
- lib/agent_ruby/prompt/summarize.rb
Instance Method Summary collapse
-
#initialize(results:) ⇒ Summarize
constructor
A new instance of Summarize.
- #to_s ⇒ Object
Constructor Details
#initialize(results:) ⇒ Summarize
Returns a new instance of Summarize.
6 7 8 |
# File 'lib/agent_ruby/prompt/summarize.rb', line 6 def initialize(results:) @results = results end |
Instance Method Details
#to_s ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/agent_ruby/prompt/summarize.rb', line 10 def to_s <<~XML <Instruction> <Item> The workflow has been executed. Here are the results: #{ @results.map { |r| "Task: #{r.action.key}, Params: #{r.action.class.arguments.to_json}, Result: #{r.result}" }.join("\n") } Now, please summarize the results in a single JSON object </Item> </Instruction> <Example type="success"> <Message> I have created a folder named "My Folder" and a post titled "My Post" with content "This is my post" in the folder "My Folder" </Message> </Example> XML end |