if (FALSE) {
Sys.setenv(PROVIDER_API_URL = "https://api.together.xyz/v1/chat/completions")
Sys.setenv(PROVIDER_API_TOKEN = "your_secret_token_here")
toy_groups <- c("engineer", "clown", "firefighter") # Minimal example
toy_descriptions <- c("patient", "funny", "fearful")
toy_result <- generate_typicality(
groups = toy_groups,
descriptions = toy_descriptions,
api_url = Sys.getenv("PROVIDER_API_URL"),
api_token = Sys.getenv("PROVIDER_API_TOKEN"),
model = "meta-llama/Llama-3.3-70B-Instruct-Turbo",
n = 10,
min_valid = 8,
matrix = FALSE,
return_raw_scores = TRUE,
return_full_responses = FALSE,
verbose = TRUE
)
print(toy_result)
}
if (FALSE) {
ratings <- download_data("validation_ratings") # Full-scale example
new_scores <- generate_typicality(
groups = ratings$group,
descriptions = ratings$adjective,
api_url = Sys.getenv("PROVIDER_API_URL"),
api_token = Sys.getenv("PROVIDER_API_TOKEN"),
model = "meta-llama/Llama-3.3-70B-Instruct-Turbo",
n = 25,
min_valid = 20,
max_tokens = 5,
retries = 1,
matrix = FALSE,
return_raw_scores = TRUE,
return_full_responses = TRUE,
verbose = TRUE
)
head(new_scores)
}
Run the code above in your browser using DataLab