Moderate an image together with its text
Source:R/content-safety-preview.R
foundry_moderate_multimodal.RdAnalyze an image and optional accompanying text in a single multimodal Content Safety call. Optical character recognition can read text embedded in the image so that harmful captions or overlays are caught alongside the picture.
Usage
foundry_moderate_multimodal(
image,
text = NULL,
categories = c("Hate", "Sexual", "SelfHarm", "Violence"),
enable_ocr = TRUE,
endpoint = NULL,
api_key = NULL,
api_version = "2024-09-15-preview"
)Arguments
- image
Character. Local image path or HTTPS Azure Blob Storage URL.
- text
Character. Optional text shown with the image (max 1,000 code points).
- categories
Character vector of harm categories. Defaults to all four.
- enable_ocr
Logical. When
TRUE, run OCR on the image to recognize embedded text. DefaultTRUE.- endpoint
Character. Optional Content Safety endpoint.
- api_key
Character. Optional Content Safety key.
- api_version
Character. API version. Defaults to
"2024-09-15-preview".
Value
A tibble with one row per harm category, matching
foundry_moderate_image(): source, category, severity, label, and
raw_response. Multimodal analysis returns four-level severities
(0, 2, 4, 6).