module_fn() wraps an ordinary R function in a dsprrr Module. This gives
custom callables the same run() and evaluate() surface as built-in
modules without requiring users to subclass dsprrr internals.
Usage
module_fn(signature, forward, chat = NULL, name = NULL, config = list())Arguments
- signature
A Signature object or signature string.
- forward
Function called with named signature inputs. If the function accepts
.llmor..., the active chat object is passed as.llm. Return a named list matching the signature output fields, or a scalar when the signature has exactly one output field.forwardis invoked once per row; userun_dataset()orevaluate()to process multi-row datasets.- chat
Optional ellmer Chat object stored on the module.
- name
Optional module name stored in
config$name.- config
Optional configuration metadata.