dist_mat_llm {NaileR}R Documentation

LLM distance matrix

Description

Compute a distance matrix between randomly-generated responses to an LLM prompt.

Usage

dist_mat_llm(ppt, n, per_miss = 0)

Arguments

ppt

an LLM prompt.

n

the number of responses to be generated.

per_miss

the proportion of missing values in the final matrix (between 0 and 1; 0 by default).

Details

The final percentage of missing values might differ from the per_miss parameter value; rather than a percentage of values being turned to NA, each value has a per_miss probability of being NA.

Value

A list containing:

Examples

## Not run: 
# Processing time is often longer than ten seconds
# because the function uses a large language model.

data(iris)

intro_iris <- "A study measured various parts of iris flowers
from 3 different species: setosa, versicolor and virginica.
I will give you the results from this study.
You will have to identify what sets these flowers apart."
intro_iris <- gsub('\n', ' ', intro_iris) |>
stringr::str_squish()

req_iris <- "Please explain what makes each species distinct.
Also, tell me which species has the biggest flowers,
and which species has the smallest."
req_iris <- gsub('\n', ' ', req_iris) |>
stringr::str_squish()

res_iris <- nail_catdes(iris, num.var = 5,
introduction = intro_iris, request = req_iris)

dist_mat_llm(res_iris$prompt, n = 5, per_miss = 0)

## End(Not run)

[Package NaileR version 1.2.3 Index]