View source: R/content-safety-preview.R
| foundry_task_adherence | R Documentation |
Evaluate whether an agent's tool calls and responses stayed aligned with the user's request using the Azure AI Content Safety task-adherence detector. This flags agents that take unrequested or unsafe actions.
foundry_task_adherence(
messages,
tools = NULL,
endpoint = NULL,
api_key = NULL,
api_version = "2025-09-15-preview"
)
messages |
List. The conversation turns to analyze. Build each turn with
|
tools |
List. Optional tool definitions available to the agent. Build
each with |
endpoint |
Character. Optional Content Safety endpoint. |
api_key |
Character. Optional Content Safety key. |
api_version |
Character. API version. Defaults to
|
A tibble with one row:
Logical. TRUE when misaligned tool use was
detected.
Character. Explanation of the detected risk, or NA when
none.
List. The parsed API response.
This operation is documented only in the Azure AI Content Safety Learn
quickstart and has no published OpenAPI specification. It requires the
2025-09-15-preview api-version and its contract may change.
## Not run:
# Requires a configured Azure Content Safety endpoint and credentials
# with access to the task-adherence preview API.
foundry_task_adherence(
tools = list(
foundry_agent_tool("get_credit_card_limit", "Get the user's credit limit")
),
messages = list(
foundry_agent_message("Prompt", "User", "What is my limit?"),
foundry_agent_message(
"Completion", "Assistant", "Checking now",
tool_calls = list(
foundry_agent_tool_call("get_credit_card_limit", id = "call_001")
)
)
)
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.