Module: DataRedactor::Integrations::RubyLLM::PayloadPatch

Defined in:
lib/data_redactor/integrations/ruby_llm.rb

Overview

Prepended onto ‘RubyLLM::Protocol`. `Protocol#complete` calls `payload = render(…)` and then posts that payload, so redacting the return value of `render` redacts the request without touching anything else in the send path.

Instance Method Summary collapse

Instance Method Details

#render(*args, **kwargs) ⇒ Object



107
108
109
110
111
112
113
114
115
116
# File 'lib/data_redactor/integrations/ruby_llm.rb', line 107

def render(*args, **kwargs)
  payload = super
  opts = DataRedactor::Integrations::RubyLLM.options
  DataRedactor.redact_deep(
    payload,
    only: opts[:only],
    except: opts[:except],
    placeholder: opts[:placeholder]
  )
end