Create a text format that augments prompts with relevant text chunks retrieved from a text store.

rag_with(store, k = 5L, min_similarity = 0L, ...)

Arguments

store

A TextStore object containing the text chunks to search.

k

The number of chunks to retrieve.

min_similarity

The minimum similarity score for a chunk to be included.

...

Additional arguments passed to the vector index.

Value

A RetrievalAugmentedFormat object that can be passed to prompt_as, to which the return value of rag_with is passed.

Author

Michael Lawrence

See also

prompt_as, to which the return value of rag_with should be passed in order to configure an agent to use RAG.

Note

The RAG capabilities of wizrd are currently experimental and quite primitive. They may be removed or moved to a different package in the future.

Examples

if (FALSE) { # \dontrun{
    chunks <- chunk(tools::Rd_db("S7"))
    store <- text_store(nomic(), chunks)
    agent <- llama() |> prompt_as(rag_with(store))
    predict(agent, "new_property example")
} # }