Skip to contents

Creates a function compatible with vitals Tasks that executes a DSPrrr module against batches of inputs. The solver uses run_dataset() internally, ensuring that the module's demos, templates, and input descriptions are properly used in prompt construction.

For multi-input modules, the solver expects the vitals input column to contain nested data (list of tibbles/lists) where each element has fields matching the module's signature inputs. Use as_vitals_task() to automatically create this structure from a flat dataset.

The solver uses ellmer's parallel processing for efficiency. For structured outputs, mock Chat objects are created for vitals logging compatibility (following the same pattern as vitals' generate_structured()).

Usage

as_vitals_solver(module, .llm = NULL, ...)

Arguments

module

A DSPrrr module (e.g., created via module()).

.llm

An ellmer chat object. If NULL (default), uses the module's stored chat or falls back to get_default_chat(). The chat is cloned for each batch invocation.

...

Additional arguments forwarded to run_dataset().

Value

A function accepting a list of input objects and returning a list with components result, solver_chat, and optionally solver_metadata.