Returned by gr_call(). Designed so a caller can never be handed NULL or
character(0) where a string is expected.
Fields
okLogical(1).
FALSEfor transport failures, HTTP errors, and successful calls that returned no text (a refusal or content filter).textCharacter(1), always.
""whenokisFALSE. NeverNULL, nevercharacter(0), and newlines are preserved.errorCharacter or
NULL. What went wrong, including the HTTP body for API-side errors.usageList with
inputandoutputtoken counts as reported by the API.status,finish_reason,retryable,model,rawHTTP status, the API's stop reason, whether a retry could help, the model id, and the parsed response body.
Methods
print() shows ok, the model, the token usage and either the text or the
error.
See also
gr_call() which returns one, gr_client(), gr_mock_client()
Examples
res <- gr_call(gr_mock_client(function(m, p) "hello"), "hi")
c(ok = res$ok, text = res$text)
#> ok text
#> "TRUE" "hello"