Convenience wrapper for generate_topic_content with
content_type = "survey_item". Generates Likert-scale survey items
for scale development.
Usage
generate_survey_items(
topic_terms_df,
topic_var = "topic",
term_var = "term",
weight_var = "beta",
provider = c("openai", "ollama"),
model = "gpt-3.5-turbo",
temperature = 0,
system_prompt = NULL,
user_prompt_template = NULL,
max_tokens = 150,
api_key = NULL,
verbose = TRUE
)Arguments
- topic_terms_df
A data frame with topic terms, containing columns for topic identifier, term, and optionally term weight (beta).
- topic_var
Name of the column containing topic identifiers (default: "topic").
- term_var
Name of the column containing terms (default: "term").
- weight_var
Name of the column containing term weights (default: "beta").
- provider
LLM provider: "openai" or "ollama" (default: "openai").
- model
Model name. For OpenAI: "gpt-3.5-turbo", "gpt-4", etc. For Ollama: "llama3", "mistral", etc.
- temperature
Sampling temperature (0-2). Lower = more deterministic (default: 0).
- system_prompt
Custom system prompt. If NULL, uses default for content_type.
- user_prompt_template
Custom user prompt template with {terms} placeholder. If NULL, uses default for content_type.
- max_tokens
Maximum tokens for response (default: 150).
- api_key
OpenAI API key. If NULL, reads from OPENAI_API_KEY environment variable.
- verbose
Logical, if TRUE, prints progress messages.
See also
Other ai:
analyze_contrastive_similarity(),
call_ollama(),
check_ollama(),
create_label_selection_data(),
format_label_candidates(),
generate_topic_content(),
generate_topic_labels_langgraph(),
get_content_type_prompt(),
get_content_type_user_template(),
get_recommended_ollama_model(),
list_ollama_models(),
run_rag_search(),
validate_topic_labels_langgraph()
