Class: Datadog::AIGuard::Evaluation::Message
- Inherits:
-
Object
- Object
- Datadog::AIGuard::Evaluation::Message
- Defined in:
- lib/datadog/ai_guard/evaluation/message.rb
Overview
Message class for AI Guard
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
-
#tool_call ⇒ Object
readonly
Returns the value of attribute tool_call.
-
#tool_call_id ⇒ Object
readonly
Returns the value of attribute tool_call_id.
Instance Method Summary collapse
-
#initialize(role:, content: nil, tool_call: nil, tool_call_id: nil) ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize(role:, content: nil, tool_call: nil, tool_call_id: nil) ⇒ Message
Returns a new instance of Message.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/datadog/ai_guard/evaluation/message.rb', line 10 def initialize(role:, content: nil, tool_call: nil, tool_call_id: nil) raise ArgumentError, "Role must be set to a non-empty value" if role.to_s.empty? @role = role.to_sym @content = content @tool_call = tool_call @tool_call_id = tool_call_id if @tool_call && !@tool_call.is_a?(ToolCall) raise ArgumentError, "Expected an instance of #{ToolCall.name} for :tool_call argument" end end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
8 9 10 |
# File 'lib/datadog/ai_guard/evaluation/message.rb', line 8 def content @content end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
8 9 10 |
# File 'lib/datadog/ai_guard/evaluation/message.rb', line 8 def role @role end |
#tool_call ⇒ Object (readonly)
Returns the value of attribute tool_call.
8 9 10 |
# File 'lib/datadog/ai_guard/evaluation/message.rb', line 8 def tool_call @tool_call end |
#tool_call_id ⇒ Object (readonly)
Returns the value of attribute tool_call_id.
8 9 10 |
# File 'lib/datadog/ai_guard/evaluation/message.rb', line 8 def tool_call_id @tool_call_id end |