Skip to contents

One call per row of new_data (its columns named like the function's inputs). Columns follow tidymodels: .pred_class when the answer is a choice (a factor), .pred for other answers, .pred_<output> for several outputs; then .call (the call's id, for rate()) and .error (why a row has no answer: its call's error, or an input missing where its type takes no null, which makes no call). augment() adds them to new_data, ready for yardstick.

Usage

# S3 method for class 'functai_fn'
predict(object, new_data, type = NULL, samples = 1L, temperature = 1, ...)

# S3 method for class 'functai_fn'
augment(x, new_data, ...)

Arguments

object, x

An AI function.

new_data

A data frame.

type

"class" or "numeric" (the answer, whatever its type) or "prob" (a choice's probabilities; needs samples).

samples

Answers per row (1: one call, no probabilities).

temperature

The sampling temperature when samples > 1.

...

Settings for these calls (lm = ...).

Value

A tibble.

Details

Probabilities. Most providers (OpenAI, Anthropic, Gemini) do not measure how likely each answer is, and FunctAI never makes a number up. With samples = k, each row is answered k times at temperature (1 by default) and type = "prob" gives the share of answers per level (.pred_<level>), while type = "class" gives the most frequent one (a majority vote, which is often more accurate than one answer). It costs k calls per row; class and probability predictions of the same rows share them.