Class: Kodo::Tools::GetCurrentTime
- Inherits:
-
RubyLLM::Tool
- Object
- RubyLLM::Tool
- Kodo::Tools::GetCurrentTime
- Defined in:
- lib/kodo/tools/get_current_time.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(audit:) ⇒ GetCurrentTime
constructor
A new instance of GetCurrentTime.
- #name ⇒ Object
Constructor Details
#initialize(audit:) ⇒ GetCurrentTime
Returns a new instance of GetCurrentTime.
11 12 13 14 |
# File 'lib/kodo/tools/get_current_time.rb', line 11 def initialize(audit:) super() @audit = audit end |
Instance Method Details
#execute ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/kodo/tools/get_current_time.rb', line 16 def execute now = Time.now day_name = now.strftime("%A") date_str = now.strftime("%Y-%m-%d") time_str = now.strftime("%H:%M:%S %Z") period = time_period(now.hour) @audit.log(event: "tool_get_current_time", detail: "#{date_str} #{time_str}") "#{day_name}, #{date_str} #{time_str} (#{period})" end |
#name ⇒ Object
28 29 30 |
# File 'lib/kodo/tools/get_current_time.rb', line 28 def name "get_current_time" end |