# Minimal fabricated example (no network):
r <- structure(
list(
text = "Hello!",
provider = "openai",
model = "demo",
finish_reason = "stop",
usage = list(sent = 12L, rec = 5L, total = 17L, reasoning = NA_integer_),
response_id = "resp_123",
duration_s = 0.012,
raw = list(choices = list(list(message = list(content = "Hello!")))),
raw_json = "{}"
),
class = "llmr_response"
)
as.character(r)
finish_reason(r)
tokens(r)
print(r)
if (FALSE) {
fr <- finish_reason(r)
}
if (FALSE) {
u <- tokens(r)
u$total
}
if (FALSE) {
if (is_truncated(r)) message("Increase max_tokens")
}
Run the code above in your browser using DataLab