Class: Kodo::Tools::ListReminders
- Inherits:
-
RubyLLM::Tool
- Object
- RubyLLM::Tool
- Kodo::Tools::ListReminders
- Extended by:
- PromptContributor
- Defined in:
- lib/kodo/tools/list_reminders.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(reminders:, audit:) ⇒ ListReminders
constructor
A new instance of ListReminders.
- #name ⇒ Object
Methods included from PromptContributor
capability_name, capability_primary, disabled_guidance, enabled_guidance
Constructor Details
#initialize(reminders:, audit:) ⇒ ListReminders
Returns a new instance of ListReminders.
14 15 16 17 18 |
# File 'lib/kodo/tools/list_reminders.rb', line 14 def initialize(reminders:, audit:) super() @reminders = reminders @audit = audit end |
Instance Method Details
#execute ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/kodo/tools/list_reminders.rb', line 20 def execute active = @reminders.all_active.sort_by { |r| r["due_at"] } @audit.log(event: "tool_list_reminders", detail: "count:#{active.length}") if active.empty? "No active reminders." else lines = active.map do |r| "- [#{r['due_at']}] #{r['content']} (id: #{r['id']})" end "#{active.length} active reminder(s):\n#{lines.join("\n")}" end end |
#name ⇒ Object
35 36 37 |
# File 'lib/kodo/tools/list_reminders.rb', line 35 def name "list_reminders" end |