Compute cosine similarity between all pairs of embeddings.
Usage
hf_similarity(embeddings, text_col = "text")
Arguments
- embeddings
A tibble with an 'embedding' column (from hf_embed).
- text_col
Character string. Name of the text column. Default: "text".
Value
A tibble with columns: text_1, text_2, similarity
Examples
if (FALSE) { # \dontrun{
sentences <- c("I love cats", "I adore felines", "Dogs are great")
embeddings <- hf_embed(sentences)
similarities <- hf_similarity(embeddings)
} # }