llm_api_call: Base LLM API Call Wrapper
Description
Sends a prompt (with background academic definitions) to an LLM API
(defaulting to 'OpenAI') and returns the LLM response.
Usage
llm_api_call(
prompt_text,
model = "gpt-3.5-turbo",
api_key = "",
top_p = 1,
temp = 0
)
Value
A character string containing the LLM's response.
Arguments
- prompt_text
A character string containing the user prompt.
- model
A character string specifying the LLM model (default "gpt-3.5-turbo").
- api_key
API key as a character string.
- top_p
Numeric value for the probability mass (default 1).
- temp
Numeric value for the sampling temperature (default 0).
Details
The system prompt includes academic definitions for word frequency, lexical coverage,
Zipf's law, Levenshtein distance, and semantic transparency.
Examples
Run this codeif (FALSE) {
response <- llm_api_call("Please provide a rating for the stimulus 'apple'.")
cat(response)
}
Run the code above in your browser using DataLab