R/prompts.R
generate_plausibility_table_direct.Rd
This function constructs a detailed prompt with specific IDPs, Outcomes, Domains, scoring principles, and desired output format, then queries an LLM (Groq or OpenRouter) to generate a complete plausibility table.
generate_plausibility_table_direct(
backend = c("groq", "openrouter"),
model = NULL,
api_key_env = NULL,
max_retries = 5,
retry_delay_base = 1,
temperature = 0.01,
verbose = TRUE,
return_prompt = FALSE,
custom_system_prompt = NULL,
custom_idps = NULL,
custom_outcomes = NULL,
custom_domains = NULL
)
Character string, specifies which API backend to use: "groq" or "openrouter".
Character string, model name for the chosen backend. Defaults to "llama3-70b-8192" for Groq and "openai/gpt-4o" for OpenRouter.
Character string, name of the environment variable storing the API key.
Integer, maximum number of retries in case of API errors or malformed responses.
Numeric, base delay in seconds for exponential backoff between retries.
Numeric, sampling temperature for the LLM. A very low value (e.g., 0.01) is recommended for deterministic, instruction-following behavior.
Logical, if TRUE, prints progress and debugging information.
Logical, if TRUE, returns the constructed system and user prompts as a list without calling the LLM. Useful for debugging prompts.
Character string, an optional custom system prompt to use. If NULL, the default detailed system prompt (acting as a neuroscientist) is used.
Character vector, an optional custom list of IDPs to use. If NULL, the globally defined 'idps' list is used.
Character vector, an optional custom list of Outcomes to use. If NULL, the globally defined 'outcomes' list is used.
Character vector, an optional custom list of Domains to use. If NULL, the globally defined 'domains' list is used.
A list containing:
dataframe
: A data.frame with IDPs as rows, Outcomes as columns, and plausibility scores as values.
raw_json
: The raw JSON string received from the LLM.
If return_prompt
is TRUE, returns a list with system_prompt
and user_prompt
.