chat4R {chatAI4R}R Documentation

Chat4R: Interact with GPT-3.5 (default) using OpenAI API

Description

This function uses the OpenAI API to interact with the GPT-3.5 model (default) and generates responses based on user input.

Usage

chat4R(
  content,
  Model = "gpt-3.5-turbo-16k",
  temperature = 1,
  simple = TRUE,
  fromJSON_parsed = FALSE,
  api_key = Sys.getenv("OPENAI_API_KEY")
)

Arguments

content

A string containing the user's input message.

Model

A string specifying the GPT model to use (default: "gpt-3.5-turbo-16k").

temperature

A numeric value controlling the randomness of the model's output (default: 1).

simple

Logical, if TRUE, only the content of the model's message will be returned.

fromJSON_parsed

Logical, if TRUE, content will be parsed from JSON.

api_key

A string containing the user's OpenAI API key. Defaults to the value of the environment variable "OPENAI_API_KEY".

Details

Chat4R Function

Value

A data frame containing the response from the GPT model.

Author(s)

Satoshi Kume

Examples

## Not run: 
Sys.setenv(OPENAI_API_KEY = "Your API key")
response <- chat4R("What is the capital of France?")
response

## End(Not run)

[Package chatAI4R version 0.2.10 Index]