gptr_fake_provider() returns a provider spec that plays a script instead of calling a
model. It needs no network and no keys, so examples, tests and documents can run gptr end to
end offline. Use it as model = <spec> or register it with gptr_register().
Usage
gptr_fake_provider(script, name = "fake", type = c("chat", "classifier"))Value
A provider spec: a list of class c("gptr_provider", "gptr_spec") with id = name,
api "fake" or "fake-classifier", one model ("<name>/<name>-1", or
"<name>/<name>-s1" for classifiers), offline = TRUE, the script, and log, an
environment whose requests element lists every request the provider received.
Details
A chat script is a list of replies (request i gets reply min(i, length(script)), so the
last reply repeats) or a function of the request returning one reply. The request is a list
with n, model, system, tools, messages, last_user, last_results and params. A
reply is a string (the answer text) or a list with any of: text; thinking and
signature; tool with input and id (one tool call); tools (a list of
list(name, input) for parallel calls); stop ("length", "refusal", "pause" or
"stop"); error with status and after (fail after after text deltas);
overflow = TRUE; hang = TRUE; json (a structured answer); and the modifiers delay,
gap, chunk and usage.
A classifier script (type = "classifier") answers System 1 questions: a list of answers
(recycled the same way, one answer per question asked) or function(state, question). An
answer is a probability for yes/no questions, a named probability vector for choices, a
vector of level probabilities for scores, or list(error =, status =). Classifier results
use the provider-neutral decision shape and report calibration as unknown (NA).