Learn R Programming

tidyllm (version 0.2.0)

chatgpt: ChatGPT Wrapper (Deprecated)

Description

Provides a wrapper for the openai() function to facilitate migration from the deprecated chatgpt() function. This ensures backward compatibility while allowing users to transition to the updated features.

Usage

chatgpt(
  .llm,
  .model = "gpt-4o",
  .max_tokens = 1024,
  .temperature = NULL,
  .top_p = NULL,
  .top_k = NULL,
  .frequency_penalty = NULL,
  .presence_penalty = NULL,
  .api_url = "https://api.openai.com/",
  .timeout = 60,
  .verbose = FALSE,
  .json = FALSE,
  .stream = FALSE,
  .dry_run = FALSE
)

Value

An LLMMessage object with the assistant's reply.

Arguments

.llm

An LLMMessage (passed directly to the openai() function)

.model

A character string specifying the model to use.

.max_tokens

An integer specifying the maximum number of tokens (mapped to .max_completion_tokens in openai())

.temperature

A numeric value for controlling randomness. This is

.top_p

A numeric value for nucleus sampling, indicating the top

.top_k

Currently unused, as it is not supported by openai().

.frequency_penalty

A numeric value that penalizes new tokens based on their frequency so far.

.presence_penalty

A numeric value that penalizes new tokens based on whether they appear in the text so far.

.api_url

Character string specifying the API URL. Defaults to the OpenAI API endpoint.

.timeout

An integer specifying the request timeout in seconds. This is

.verbose

Will print additional information about the request (default: false)

.json

Should json-mode be used? (detault: false)

.stream

Should the response be processed as a stream (default: false)

.dry_run

Should the request is constructed but not actually sent. Useful for debugging and testing. (default: false)

Details

This function is deprecated and is now a wrapper around openai(). It is recommended to switch to using openai() directly in future code. The chatgpt() function remains available to ensure backward compatibility for existing projects.

See Also

Use openai() instead.

Examples

Run this code
if (FALSE) {
# Using the deprecated chatgpt() function
result <- chatgpt(.llm = llm_message(), .prompt = "Hello, how are you?")
}

Run the code above in your browser using DataLab