Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion content/en/security/ai_guard/onboarding.md
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@
AIGuard.ToolCall.toolCall(
"call_1",
"shell",
"{"command": "shutdown"}"
"{\"command\": \"shutdown\"}"
)
)
)
Expand All @@ -467,6 +467,42 @@

[1]: https://github.com/DataDog/dd-trace-java/releases/tag/v1.54.0
{{% /tab %}}
{{% tab "Ruby" %}}
Starting with [dd-trace-rb v2.25.0][1], a new Ruby SDK is available. This SDK offers a simplified interface for interacting with the REST API directly from JavaScript applications.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The newest release on the linked page is v2.24.0. Just wanted to check whether the 25 was a typo, or if we're creating this for a future Ruby release?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is for a future Ruby release, the new version with the SDK will be released on Monday.


The following sections provide practical usage examples:

#### Example: Evaluate a user prompt {#ruby-example-evaluate-user-prompt}

Check warning on line 475 in content/en/security/ai_guard/onboarding.md

View workflow job for this annotation

GitHub Actions / vale

Datadog.headings

'Example: Evaluate a user prompt {#ruby-example-evaluate-user-prompt}' should use sentence-style capitalization.

```ruby
result = Datadog::AIGuard.evaluate(
Datadog::AIGuard.message(role: :system, content: "You are an AI Assistant"),
Datadog::AIGuard.message(role: :user, content: "What is the weather like today?"),
allow_raise: false
)
```

The evaluate method receives the following parameters:
- `messages` (required): list of messages (prompts or tool calls) for AI Guard to evaluate.
- `allow_raise` (optional): Boolean flag; if set to `true`, the SDK raises an `AIGuardAbortError` when the assessment is `DENY` or `ABORT` and the service is configured with blocking enabled.

The method returns an Evaluation object containing:
- `action`: `ALLOW`, `DENY`, or `ABORT`.
- `reason`: natural language summary of the decision.
- `tags`: list of tags linked to the evaluation (for example, ```["indirect-prompt-injection", "instruction-override", "destructive-tool-call"]```)

#### Example: Evaluate a tool call {#ruby-example-evaluate-tool-call}

Check warning on line 494 in content/en/security/ai_guard/onboarding.md

View workflow job for this annotation

GitHub Actions / vale

Datadog.headings

'Example: Evaluate a tool call {#ruby-example-evaluate-tool-call}' should use sentence-style capitalization.

Like evaluating user prompts, the method can also be used to evaluate tool calls:

```ruby
result = Datadog::AIGuard.evaluate(
Datadog::AIGuard.assistant(id: "call_1", tool_name: "shell", arguments: '{"command": "shutdown"}'),
)
```

[1]: https://github.com/DataDog/dd-trace-rb/releases
{{% /tab %}}
{{< /tabs >}}

## View AI Guard data in Datadog {#in-datadog}
Expand Down
Loading