Skip to contents

The embeddings are currently retrieved from a local 'ollama' server running Jina AI embeddings.

Usage

pkgmatch_embeddings_from_pkgs(packages = NULL, functions_only = FALSE)

Arguments

packages

A vector of local paths to directories containing R packages.

functions_only

If TRUE, calculate embeddings for function descriptions only. This is intended to generate a separate set of embeddings which can then be used to match plain-text queries of functions, rather than entire packages.

Value

If !functions_only, a list of two matrices of embeddings: one for the text descriptions of the specified packages, including individual descriptions of all package functions, and one for the entire code base. For functions_only, a single matrix of embeddings for all function descriptions.

See also

Other embeddings: pkgmatch_embeddings_from_text()

Examples

if (FALSE) { # \dontrun{
packages <- c ("cli", "fs")
emb_fns <- pkgmatch_embeddings_from_pkgs (packages, functions_only = TRUE)
colnames (emb_fns) # All functions of the two packages
emb_pkg <- pkgmatch_embeddings_from_pkgs (packages, functions_only = FALSE)
names (emb_pkg) # text_with_fns, text_wo_fns, code
colnames (emb_pkg$text_with_fns) # cli, fs
} # }