Class: Datadog::AIGuard::Evaluation::Request
- Inherits:
-
Object
- Object
- Datadog::AIGuard::Evaluation::Request
- Defined in:
- lib/datadog/ai_guard/evaluation/request.rb
Overview
Request builds the request body from an array of messages and processes the response
Constant Summary collapse
- REQUEST_PATH =
"/evaluate"
Instance Attribute Summary collapse
-
#serialized_messages ⇒ Object
readonly
Returns the value of attribute serialized_messages.
Instance Method Summary collapse
-
#initialize(messages) ⇒ Request
constructor
A new instance of Request.
- #perform ⇒ Object
Constructor Details
#initialize(messages) ⇒ Request
Returns a new instance of Request.
12 13 14 |
# File 'lib/datadog/ai_guard/evaluation/request.rb', line 12 def initialize() = () end |
Instance Attribute Details
#serialized_messages ⇒ Object (readonly)
Returns the value of attribute serialized_messages.
10 11 12 |
# File 'lib/datadog/ai_guard/evaluation/request.rb', line 10 def end |
Instance Method Details
#perform ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/datadog/ai_guard/evaluation/request.rb', line 16 def perform api_client = AIGuard.api_client # This should never happen, as we are only calling this method when AI Guard is enabled, # and this means the API Client was not initialized properly. # # Please report this at https://github.com/datadog/dd-trace-rb/blob/master/CONTRIBUTING.md#found-a-bug raise "AI Guard API Client not initialized" unless api_client raw_response = api_client.post(REQUEST_PATH, body: build_request_body) Result.new(raw_response) end |