Agent-facing helpers for retrieving curator-ready context from the
agents.artist_context_hot view.
Usage
get_agent_ctx(
artist,
cn = NULL,
comp = FALSE,
use_cache = TRUE,
cache_ttl = 300,
incl_meta = FALSE,
use_matview = TRUE
)
decomp_ctx(comp_ctx)Arguments
- artist
character scalar, artist UUID.
- cn
optional DBI connection; if NULL uses
artcore::dbc()and closes on exit.- comp
logical, whether to comp the response with gzip. Default FALSE.
- use_cache
logical, whether to use caching. Default TRUE.
- cache_ttl
numeric, seconds until cache expiry. Default 300 (5 minutes).
- incl_meta
logical, whether to include metadata about the response. Default FALSE.
- use_matview
logical, whether to use materialized view for faster queries. Default TRUE.
- comp_ctx
A compressed context object from get_agent_ctx(comp=TRUE)
Value
list of JSON strings: artist_profile, lifetime_stats, style_overview, collections, artworks (character vector), and artist_uuid. If comp=TRUE, returns a list with compressed data and metadata. If incl_meta=TRUE, returns a list with "meta" and "data" components. The res includes an attribute "from_cache" indicating whether data came from cache.
The original uncompressed context list
See also
Other curator-context:
curator_chat_new()
Examples
if (FALSE) { # \dontrun{
# Normal usage
ctx <- get_agent_ctx("746b8207-72f5-4ab6-8d19-a91d03daec3d")
# With compression (91% size reduction)
ctx_compressed <- get_agent_ctx("746b8207-72f5-4ab6-8d19-a91d03daec3d", comp = TRUE)
ctx_decompressed <- decomp_ctx(ctx_compressed)
# Without caching
ctx <- get_agent_ctx("746b8207-72f5-4ab6-8d19-a91d03daec3d", use_cache = FALSE)
} # }
if (FALSE) { # \dontrun{
ctx_compressed <- get_agent_ctx(artist_uuid, comp = TRUE)
ctx <- decomp_ctx(ctx_compressed)
} # }
