This is an experimental, dispatch-based mechanism for customized (de)serialization of R objects. The driving use case is persistence of TextStore objects, which will often reference externally persisted indices.

persist(x, file)
restore(file)

Arguments

x

The object being persisted.

file

The file holding the (partially) serialized R object. persist may create additional files, which will be required by restore to fully restore the object.

Value

For restore, the fully restored object.

Author

Michael Lawrence

Examples

if (FALSE) { # \dontrun{
    chunks <- chunk(tools::Rd_db("S7"))
    store <- text_store(nomic(), chunks)
    file <- tempfile("text", fileext = ".rds")
    persist(store, file)
    store <- restore(file)
    agent <- llama() |> prompt_as(rag_with(store))
    predict(agent, "new_property example")
} # }