artopenai 0.12.1
Patch — R CMD check hygiene
-
tests/testthat/fixtures/is now shipped with the package tarball (removed from.Rbuildignore). The 0.11-era exclusion brokeR CMD checkoffline: underdevtools::check()the tarball was extracted without fixtures,httptest2fell back to capture mode, and every mocked test attempted a real API call. -
is_artwork()tests reinstated as capture/replay (with_mock_dir) for consistency with the rest of the suite. Fixtures live undertests/testthat/fixtures/is-artwork/andis-artwork-portrait/. -
Vignette (
vignettes/artopenai.qmd) now falls back to a placeholderART_OPENAI_KEYwhen the env var isn’t set. The key is never used —httptest2replays fromvignettes/artopenai/fixtures — but.get_openai_cfg()requires a non-empty key to build the request. -
Shortened
fixtures/openai-chat/conversation/→.../multi/to keep final fixture paths under the 100-byte portable-name threshold.
With these, devtools::check() passes clean: 0 errors, 0 warnings, 0 notes.
artopenai 0.12.0
New Feature — is_artwork() Image Classifier
-
is_artwork(img_path)— exported predicate that asks OpenAI whether an image depicts artwork (digital artwork or professional flat digitization). Returns a list withis_artwork(boolean),confidence(0–1),reason,model, andusage.res <- is_artwork("path/to/thumbnail.jpg") if (res$is_artwork && res$confidence > 0.8) { ... } Thumbnail-input contract. The function enforces
file.info(img_path)$size <= max_bytes(default 2 MB) and errors with an actionable message otherwise. Callers are expected to pre-resize during ingestion; the function performs nomagickwork.-
Hardcoded efficiency choices:
- Model:
gpt-5.4-nano(smallest vision-capable GPT-5 tier). -
reasoning = list(effort = "none")— no chain-of-thought tokens. -
detail = "low"on the image — 85-token tile regardless of resolution. - Raw-byte read + magic-byte mime detection (PNG / JPEG / WebP / GIF).
- Strict JSON schema output.
End-to-end latency on a 512x512 thumbnail: ~1.1 s median (inference-bound).
- Model:
API Additions
openai_responses()now accepts areasoningargument that is passed through to the Responses API (e.g.list(effort = "none")). Only meaningful for reasoning models (GPT-5 family).openai_with_tools()andopenai_continue()now acceptmax_tokensandtimeoutpassthrough arguments for consistency withopenai_responses().
Reliability
artopenai_health_check()now reads its URL from.get_openai_cfg(), soART_OPENAI_BASE_URLis honored (previously hardcoded).Retry logic replaced with
httr2::req_retry(max_tries = 3); the hand-rolled regex-based retry helper is gone. Transient 429s and 5xx are now retried with properRetry-Afterheader support.
Dependencies
- Dropped
data.tablefrom Imports (unused after artwork-analysis functions moved to artcurator in 0.10.0). - Bumped
ellmerminimum to>= 0.4.0— required bycredentials =inopenai_chat().
Internal
- Removed stray
magick::magick_set_seed(42)at package load (magick was never in Imports; the call was a non-functional artifact of a prior httptest2 fixture-stability workaround). - Removed dead
data.tableNSE@importFromblock andglobalVariables()list left over from removed 0.10.0 functions. - Renamed internal
..api_openai_key()to.api_openai_key()to match R convention. -
inst/httptest2/redact.Rretabbed to 2-space indentation.
artopenai 0.11.0
New Feature - Interactive Chat with Streaming
-
New
openai_chat()function - Creates reusable chat objects for interactive, multi-turn conversations with streaming support. Built on {ellmer} for robust provider integration.# Create chat object chat <- openai_chat(sys_prompt = "You are an art expert.") # Multi-turn conversation chat$chat("What is Baroque art?") chat$chat("How does it differ from Renaissance?") # Streaming for real-time UI stream <- chat$stream("Tell me about Impressionism.") coro::loop(for (chunk in stream) cat(chunk)) # Structured output schema <- ellmer::type_object( style = ellmer::type_string("Art style"), period = ellmer::type_string("Time period") ) chat$chat_structured("Describe Cubism", type = schema) -
ellmer Chat object methods:
-
$chat(...)- Send message(s), receive text response -
$stream(...)- Stream response chunks for real-time display -
$chat_structured(prompt, type)- Extract structured data with type validation -
$register_tool(tool)- Add tools for function calling
-
-
Image and file input via ellmer content helpers:
chat$chat(ellmer::content_image_file("artwork.png"), "Describe this.") chat$chat(ellmer::content_image_url("https://..."), "What style?")
Use Case Guidance
| Use Case | Function | Why |
|---|---|---|
| Interactive chat | openai_chat() |
Multi-turn, streaming, session state |
| Pipeline/structured | openai_responses() |
Single-turn, JSON schemas, batch |
| Manual conversation | openai_continue() |
Fine-grained control |
artopenai 0.10.0
Breaking Changes - API Consolidation
-
Artwork analysis functions deprecated - The following functions are deprecated and will be removed in a future release:
-
art_about_ai()→ Useartcurator::art_about_ai()instead -
art_style_ai()→ Useartcurator::art_style_ai()instead -
classify_styles_ai()→ Useartcurator::classify_styles_ai()instead -
art_profile_ai()→ Useartcurator::art_profile_ai()instead -
art_profile_full_ai()→ Useartcurator::art_profile_full_ai()instead
Rationale: artcurator now provides a unified interface for artwork analysis with provider abstraction (switch between Gemini/OpenAI). All artwork-specific prompts and high-level functions have been consolidated there.
-
-
Removed internal utilities (now provided by artcore):
- Removed
b64EncodeImage()fromR/internal-utils.R→ Useartcore::b64EncodeImage() - Removed
%||%operator definition → Imported fromartcore - Removed duplicate utility functions from
R/internal-utils.R
- Removed
New Exports - Low-Level API
-
Exported
openai_responses()- Previously internal.openai_responses()is now exported for use by artcurator and other packages- Provides low-level access to OpenAI Responses API
- Supports full parameter control: msgs, temp, json_schema, tools, store, prev_response_id, etc.
- Use for custom prompts and advanced workflows
-
b64EncodeImage()now provided by artcore- No longer exported from
artopenai; callartcore::b64EncodeImage()directly
- No longer exported from
Dependencies
- Added to Imports:
artcore (>= 1.4.0)- Provides shared HTTP, config, and image utilities - Removed from Imports:
base64enc,magick- Now provided by artcore dependency - Dependencies alphabetized for consistency
Tests
- Removed legacy artwork httptest2-based tests that depended on
b64EncodeImage()in this package- Test files removed:
test-artwork-ai.R,test-artwork-plus-ai.R - Artwork analysis testing is now handled in the
artcuratorpackage alongside the consolidated API
- Test files removed:
Migration Guide
For artpipelines and Other Consumers
Replace direct artopenai function calls with artcurator:
# Before
artopenai::art_about_ai(img_path)
artopenai::art_style_ai(img_path)
# After
artcurator::art_about_ai(img_path, provider = "openai")
artcurator::art_style_ai(img_path, provider = "openai")See vignette("artpipelines-integration", package = "artcurator") for complete migration guide.
artopenai 0.9.3
Reliability
- Added
ART_OPENAI_MAX_OUTPUT_TOKENS(default:4096) to control the defaultmax_output_tokenssent to the OpenAI Responses API. - Improved error handling for truncated Responses API outputs (
status = "incomplete",incomplete_details.reason = "max_output_tokens") with a clear, actionable message.
artopenai 0.9.2
Documentation Quality Improvements
-
@param Documentation: Enhanced all exported function parameters to meet quality gate:
- Added Type + Format + Source + Purpose for all parameters
- Updated
openai-api.R: internal API functions with comprehensive parameter docs - Updated
artwork-ai.R:art_about_ai(),art_style_ai()with full context
@description WHY: All function descriptions now explain WHY/WHEN to use each function, not just WHAT it does
-
README Enhancements:
- Added package description paragraph
- Added “Quick Example” section with realistic code snippets
- Added “Package Hierarchy” section showing ecosystem position
- Added “Documentation” section with links to docs.artalytics.dev
- Added “Development” section with AGENTS.md reference
Vignette Conversion: Converted
artopenai.Rmdtoartopenai.qmdfor Quarto-native format consistency with other Artalytics packages
artopenai 0.9.1
Testing & Tooling
- Added httptest2-based fixtures for all OpenAI calls (continue, tools, style, full profile, health check) so tests replay offline. See
tests/testthat/test-openai-continue.R,test-openai-tools.R,test-artwork-ai.R,test-artwork-plus-ai.R,test-health-check.R, and fixture dirs undertests/testthat/fixtures/. - Restored prompts/utils tests; suite now runs offline (except ImageMagick data URI skip) using recorded fixtures.
