AI-powered functions for analyzing artwork images with provider abstraction.
These functions work with both Google Gemini and OpenAI, allowing you to
switch providers via the provider parameter or environment variable.
art_about_ai(): Generate natural language descriptions for artwork profilesart_style_ai(): Extract 5-10 stylistic features as structured dataclassify_styles_ai(): Standardize free-form tags into consistent categories
Usage
art_about_ai(img_path, provider = NULL, ml = NULL, temp = 0.7, timeout = 60)
art_style_ai(img_path, provider = NULL, ml = NULL, temp = 0, timeout = 60)
classify_styles_ai(
tags,
exist_cats = NULL,
provider = NULL,
ml = NULL,
temp = 0,
timeout = 120
)Arguments
- img_path
Character. Path to local image file or URL. Supports common formats (PNG, JPEG, WebP). Images are resized to 1000px width for transmission.
- provider
Character. AI provider to use:
"gemini"or"openai". If NULL (default), usesARTCURATOR_PROVIDERenv var or defaults to gemini.- ml
Character. Model ID to use. Provider-specific (e.g., "gemini-2.5-flash", "gpt-5.1"). If NULL, uses provider default from env var.
- temp
Numeric. Temperature setting (0-2). Lower values produce deterministic output; higher values produce varied responses.
- timeout
Numeric. Request timeout in seconds. Default 60.
Character vector. Style tags to classify (e.g., from
art_style_ai()output or user-submitted tags). Each tag is mapped to a standardized category.- exist_cats
Character vector. Existing categories to prefer when classifying, ensuring consistency with previously categorized tags in the database. If NULL, the model creates appropriate categories.
Value
Character string with artwork description. Includes prompt_versions,
model/modelVersion, and usage/usageMetadata attributes.
data.table with columns tag, tag_norm, and desc. Includes
prompt_versions, model/modelVersion, and usage/usageMetadata attributes.
data.table with columns tag (original input) and category (standardized).
Includes prompt_versions attribute for auditing. Row order matches input order.
Details
Provider Selection Logic:
If
providerparameter is specified, use that providerElse if
ARTCURATOR_PROVIDERenv var is set, use thatElse default to "gemini"
Note: artgemini and artopenai previously exported these functions but they have been removed. Use artcurator for all artwork analysis.
Functions
art_about_ai(): Generate natural language artwork descriptionart_style_ai(): Extract 5-10 key stylistic features from artworkclassify_styles_ai(): Standardize style tags into consistent categories
Examples
if (FALSE) { # \dontrun{
# Auto-detect provider (defaults to gemini)
desc <- art_about_ai("path/to/artwork.png")
# Use Gemini explicitly
desc <- art_about_ai("path/to/artwork.png", provider = "gemini", temp = 0.7)
# Use OpenAI
desc <- art_about_ai("path/to/artwork.png", provider = "openai", ml = "gpt-5.1")
} # }
if (FALSE) { # \dontrun{
# Auto-detect provider
styles <- art_style_ai("path/to/artwork.png")
# Use Gemini with deterministic output
styles <- art_style_ai("path/to/artwork.png", provider = "gemini", temp = 0)
} # }
if (FALSE) { # \dontrun{
tags <- c("Photorealistic", "Detailed Rendering", "Vibrant Colors")
# Auto-detect provider
classified <- classify_styles_ai(tags)
# Use Gemini with existing categories
classified <- classify_styles_ai(tags,
exist_cats = c("Realism", "Color Theory"),
provider = "gemini"
)
} # }
