Skip to content

These generic functions can be use to convert Turn/Content objects into easily serializable representations (i.e. lists and atomic vectors).

  • contents_record() accepts a Turn or Content and return a simple list.

  • contents_replay() takes the output of contents_record() and returns a Turn or Content object.

Usage

contents_record(x)

contents_replay(x, tools = list(), .envir = parent.frame())

Arguments

x

A Turn or Content object to serialize; or a serialized object to replay.

tools

A named list of tools

.envir

The environment in which to look for class definitions. Used when the recorded objects include classes that extend Turn or Content but are not from the ellmer package itself.