Skip to contents

This is a row-wise wrapper around vertex_compare_pair_live(). It takes a tibble of pairs (ID1 / text1 / ID2 / text2), submits each pair to the Vertex AI Gemini API, and collects the results with optional incremental saving and resume support.

Usage

submit_vertex_pairs_live(
  pairs,
  model,
  trait_name,
  trait_description,
  prompt_template = set_prompt_template(),
  api_key = NULL,
  temperature = NULL,
  top_p = NULL,
  top_k = NULL,
  max_output_tokens = NULL,
  thinking_level = NULL,
  thinking_budget = NULL,
  service_tier = "standard",
  api_version = "v1",
  verbose = TRUE,
  status_every = 1L,
  progress = TRUE,
  include_raw = FALSE,
  include_thoughts = FALSE,
  save_path = NULL,
  parallel = FALSE,
  workers = 1,
  ...
)

Arguments

pairs

Tibble/data frame with columns ID1, text1, ID2, text2.

model

Vertex Gemini model name (for example "gemini-2.5-flash").

trait_name

Trait name.

trait_description

Trait description.

prompt_template

Prompt template string, typically from set_prompt_template().

api_key

Optional Vertex API key.

temperature

Optional numeric temperature; forwarded to vertex_compare_pair_live().

top_p

Optional numeric; forwarded to vertex_compare_pair_live().

top_k

Optional numeric; forwarded to vertex_compare_pair_live().

max_output_tokens

Optional integer; forwarded to vertex_compare_pair_live().

thinking_level

Optional Gemini 3 thinking level; forwarded to vertex_compare_pair_live().

thinking_budget

Optional integer; forwarded to vertex_compare_pair_live().

service_tier

Vertex AI service tier forwarded to vertex_compare_pair_live().

api_version

API version; default "v1".

verbose

Logical; print status/timing every status_every pairs.

status_every

Integer; how often to print status (default 1 = every pair).

progress

Logical; show a text progress bar.

include_raw

Logical; if TRUE, each row of the returned tibble will include a raw_response list-column with the parsed JSON body.

include_thoughts

Logical; if TRUE, requests explicit reasoning output and stores it in the thoughts column of the result.

save_path

Character string; optional file path to save results incrementally. If the file exists, the function reads it to identify and skip pairs that have already been processed (resume mode). Requires the readr package.

parallel

Logical; if TRUE, enables parallel processing using future.apply. Requires the future and future.apply packages.

workers

Integer; the number of parallel workers to use if parallel = TRUE. Defaults to 1.

...

Reserved for future extensions; passed through to vertex_compare_pair_live().

Value

A list containing three elements:

results

A tibble with one row per successfully processed pair.

failed_pairs

A tibble containing the rows from pairs that failed to process, along with an error_message column.

failed_attempts

A tibble of attempt-level failures separate from observed outcomes.

Examples

if (FALSE) { # \dontrun{
data("example_writing_samples", package = "pairwiseLLM")
pairs <- make_pairs(example_writing_samples[1:3, ])
td <- trait_description("overall_quality")
out <- submit_vertex_pairs_live(
  pairs = pairs,
  model = "gemini-3.8-flash",
  trait_name = td$name,
  trait_description = td$description,
  thinking_level = "low",
  parallel = FALSE
)
out$failed_pairs
} # }