Class: SharedTools::Tools::Disk::FileReadTool
- Inherits:
-
RubyLLM::Tool
- Object
- RubyLLM::Tool
- SharedTools::Tools::Disk::FileReadTool
- Defined in:
- lib/shared_tools/tools/disk/file_read_tool.rb
Overview
Class Method Summary collapse
Instance Method Summary collapse
- #execute(path:) ⇒ String
-
#initialize(driver: nil, logger: nil) ⇒ FileReadTool
constructor
A new instance of FileReadTool.
Constructor Details
#initialize(driver: nil, logger: nil) ⇒ FileReadTool
Returns a new instance of FileReadTool.
22 23 24 25 |
# File 'lib/shared_tools/tools/disk/file_read_tool.rb', line 22 def initialize(driver: nil, logger: nil) @driver = driver || SharedTools::Tools::Disk::LocalDriver.new(root: Dir.pwd) @logger = logger || RubyLLM.logger end |
Class Method Details
.name ⇒ Object
12 |
# File 'lib/shared_tools/tools/disk/file_read_tool.rb', line 12 def self.name = 'disk_file_read' |
Instance Method Details
#execute(path:) ⇒ String
30 31 32 33 34 35 36 |
# File 'lib/shared_tools/tools/disk/file_read_tool.rb', line 30 def execute(path:) @logger.info("#{self.class.name}#execute path=#{path}") @driver.file_read(path:) rescue StandardError => e @logger.error(e.) raise e end |