Class: RubyLLM::Toolbox::Tools::Diff

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby_llm/toolbox/tools/diff.rb

Overview

SAFE. Compares two blocks of text and returns a readable line diff.

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#call, exec_tool!, exec_tool?, #initialize, #name

Constructor Details

This class inherits a constructor from RubyLLM::Toolbox::Base

Instance Method Details

#execute(old:, new:, old_label: "old", new_label: "new") ⇒ Object



27
28
29
30
31
# File 'lib/ruby_llm/toolbox/tools/diff.rb', line 27

def execute(old:, new:, old_label: "old", new_label: "new")
  diff = TextDiff.unified(old.to_s, new.to_s,
                          old_label: old_label.to_s, new_label: new_label.to_s)
  truncate(diff)
end