class LittleGhost::Tools::Filesystem::ReadFile
Reads one UTF-8 text file, or shows the model one PNG, JPEG, GIF, or WebP image, through the configured sandbox.
Public Instance Methods
Source
# File lib/little_ghost/tools/filesystem.rb, line 32 def call(input) path = input.fetch("path") image = sandbox.read_image(path, context:) return sandbox.read(path, context:) unless image Tool::ExecutionResult.new( status: :success, content: framework_prompt( "tools/built_in/read_file/image_shown", media_type: image.media_type, bytes: image.data.bytesize ), presentation_content: [image] ) end
Returns the UTF-8 text at input["path"] through the sandbox. An image is shown to the model on its next turn instead, and the Tool result names its media type and size.
Source
# File lib/little_ghost/tools/filesystem.rb, line 48 def description = framework_prompt("tools/built_in/read_file/description")