cat.vader addscat.vader is a thin domain wrapper around
cat.stack that adds social-media platform
connectors plus prompt framing tuned for short, informal,
online language. You can use it two ways:
sm_source, sm_handle,
sm_credentials arguments, then classify.cat.stack::classify() but with
social-media-aware prompt context.Everything else — supported models, output format, ensemble voting —
is identical to cat.stack.
The simplest path — pass a character vector of post text:
posts <- c(
"Just had the best coffee ever! Highly recommend the new place downtown.",
"Politicians are all the same. Nothing ever changes.",
"Looking forward to the game tonight!",
"This new policy is going to ruin small businesses.",
"Anyone know a good vet in the area?"
)
results <- classify(
input_data = posts,
categories = c("Positive sentiment", "Negative sentiment",
"Question/request", "Other"),
api_key = Sys.getenv("OPENAI_API_KEY"),
user_model = "gpt-4o-mini"
)If you want to analyse your own posting history or a public account,
cat.vader can pull posts directly and feed them through the
classifier:
# Authenticate once with your Threads API credentials, then:
results <- classify(
sm_source = "threads",
sm_handle = "your_username",
sm_months = 6L, # last 6 months
sm_credentials = Sys.getenv("THREADS_TOKEN"),
categories = c("Personal", "Political", "Promotional",
"Question", "Other"),
api_key = Sys.getenv("OPENAI_API_KEY"),
user_model = "gpt-4o-mini"
)The returned data.frame includes the original text
and platform engagement metrics (likes, replies,
reposts, etc.) so you can correlate content categories with reach.
Each platform has its own authentication setup; check the cat-vader Python docs for the current credential formats.
Before classifying, see what themes are actually present:
cats <- extract(
input_data = df$posts,
max_categories = 10L,
api_key = Sys.getenv("OPENAI_API_KEY"),
user_model = "gpt-4o-mini"
)
cats$top_categoriesThen iterate — drop noise categories, merge similar ones, and re-run
classify() with the cleaned scheme.
vignette("getting-started", package = "cat.llm")?cat.vader::classify,
?cat.vader::extract, ?cat.vader::explore