Class: Datadog::AIGuard::Contrib::RubyLLM::MessageAdapter Private
- Inherits:
-
Object
- Object
- Datadog::AIGuard::Contrib::RubyLLM::MessageAdapter
- Defined in:
- lib/datadog/ai_guard/contrib/ruby_llm/message_adapter.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
RubyLLM messages paired with their AI Guard representation
Instance Method Summary collapse
- #apply_redactions(redacted_messages) ⇒ Object private
-
#initialize(messages) ⇒ MessageAdapter
constructor
private
A new instance of MessageAdapter.
- #to_ai_guard ⇒ Object private
Constructor Details
#initialize(messages) ⇒ MessageAdapter
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of MessageAdapter.
13 14 15 |
# File 'lib/datadog/ai_guard/contrib/ruby_llm/message_adapter.rb', line 13 def initialize() @ruby_llm_messages = end |
Instance Method Details
#apply_redactions(redacted_messages) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/datadog/ai_guard/contrib/ruby_llm/message_adapter.rb', line 21 def apply_redactions() = to_ai_guard return @ruby_llm_messages if == @ruby_llm_messages.each_with_index.map do |, index| = [index] = [index] next if == RedactionChangeSet.new(, ).apply_to() end end |
#to_ai_guard ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 |
# File 'lib/datadog/ai_guard/contrib/ruby_llm/message_adapter.rb', line 17 def to_ai_guard @ai_guard_messages ||= @ruby_llm_messages.map { || () } end |