if (FALSE) {
# Processing time is often longer than ten seconds
# because the function uses a large language model.
library(NaileR)
data(fabric)
intro_car <- "For this consumer study,
a car seat fabric was evaluated by consumers.
Some of them didn't like it (group '0'),
others liked it (group '1'). The consumers
gave their reasons for disliking or liking the fabric."
intro_car <- gsub('\n', ' ', intro_car) |>
stringr::str_squish()
request_car <- "Based on the comments provided by the consumers,
please explain the reasons why
the fabric was not appreciated for group '0',
and the reasons why the fabric was appreciated for group '1'.
In other words, what are the drivers
for disliking and liking this fabric."
request_car <- gsub('\n', ' ', request_car) |>
stringr::str_squish()
fabric_A <- droplevels(fabric[fabric$Fabric=="A",])
res_nail_textual_fabric <- nail_textual(fabric_A, num.var = 4,
num.text = 3,
introduction = intro_car,
request = request_car,
model = 'llama3',
isolate.groups = FALSE,
generate = FALSE)
res_nail_textual_fabric |> cat()
res_nail_textual_fabric <- nail_textual(fabric_A, num.var = 4,
num.text = 3,
introduction = intro_car,
request = request_car,
model = 'llama3',
isolate.groups = FALSE,
generate = TRUE)
res_nail_textual_fabric$response |> cat()
}
Run the code above in your browser using DataLab