if (FALSE) {
# Processing time is often longer than ten seconds
# because the function uses a large language model.
### Example 1: QDA data on chocolates with isolate.groups = FALSE ###
library(NaileR)
library(SensoMineR)
data(chocolates)
intro_sensochoc <- "Six chocolates were measured according
to sensory attributes by a trained panel.
I will give you the results from this study.
You will have to identify what sets these chocolates apart."
intro_sensochoc <- gsub('\n', ' ', intro_sensochoc) |>
stringr::str_squish()
req_sensochoc <- "Please explain what makes each chocolate different
and provide a sensory profile of each chocolate, as well as a name."
req_sensochoc <- gsub('\n', ' ', req_sensochoc) |>
stringr::str_squish()
res_nail_qda <- nail_qda(sensochoc,
                         formul="~Product+Panelist",
                         firstvar = 5,
                         introduction = intro_sensochoc,
                         request = req_sensochoc,
                         model = 'llama3',
                         isolate.groups = FALSE,
                         drop.negative = FALSE,
                         proba = 0.05,
                         generate = TRUE)
cat(res_nail_qda$prompt)
cat(res_nail_qda$response)
### Example 2: QDA data on chocolates with isolate.groups = TRUE ###
library(NaileR)
library(SensoMineR)
data(chocolates)
intro_sensochoc <- "A chocolate was measured according
to sensory attributes by a trained panel.
I will give you the results from this study.
You will have to identify the characteristics of this chocolate."
intro_sensochoc <- gsub('\n', ' ', intro_sensochoc) |>
stringr::str_squish()
req_sensochoc <- "Please provide a detailed sensory profile for this chocolate,
as well as a name."
req_sensochoc <- gsub('\n', ' ', req_sensochoc) |>
stringr::str_squish()
res_nail_qda <- nail_qda(sensochoc,
                         formul="~Product+Panelist",
                         firstvar = 5,
                         introduction = intro_sensochoc,
                         request = req_sensochoc,
                         model = 'llama3',
                         isolate.groups = TRUE,
                         drop.negative = FALSE,
                         proba = 0.05,
                         generate = TRUE)
cat(res_nail_qda[[1]]$prompt)
cat(res_nail_qda[[1]]$response)
}
Run the code above in your browser using DataLab