Skip to contents

Create a store

Usage

trainModel(embed, chunks, name, overwrite = FALSE, ...)

Arguments

embed

A function that is called with a character vector and returns a matrix of embeddings. Note this function will be serialised and then deserialised in new R sessions, so it cannot reference to any objects in the global or parent environments. Make sure to namespace all function calls with ::. If additional R objects must be available in the function, you can optionally supply a carrier::crate() with packaged data. It can also be NULL for stores that don't need to embed their texts, for example, if only using FTS algorithms such as ragnar_retrieve_bm25().

chunks

a character vector or a dataframe with a text column, and optionally, a pre-computed embedding matrix column. If embedding is not present, then store@embed() is used. chunks can also be a character vector.

name

Store name.

overwrite

Whether to overwrite a preexisting store.

...

Passed to ragnar::ragnar_store_create().

Value

Path to the trained model.