conversation4R {chatAI4R}R Documentation

Conversation Interface for R

Description

Interface to communicate with OpenAI's models using R, maintaining a conversation history and allowing for initialization of a new conversation.

Usage

conversation4R(
  message,
  api_key = Sys.getenv("OPENAI_API_KEY"),
  template = "",
  ConversationBufferWindowMemory_k = 2,
  Model = "gpt-3.5-turbo-16k",
  language = "English",
  initialization = FALSE,
  verbose = TRUE
)

Arguments

message

A string containing the message to be sent to the model.

api_key

A string containing the OpenAI API key. Default is retrieved from the system environment variable "OPENAI_API_KEY".

template

A string containing the template for the conversation. Default is an empty string.

ConversationBufferWindowMemory_k

An integer representing the conversation buffer window memory. Default is 2.

Model

A string representing the model to be used. Default is "gpt-3.5-turbo-16k".

language

A string representing the language to be used in the conversation. Default is "English".

initialization

A logical flag to initialize a new conversation. Default is FALSE.

verbose

A logical flag to print the conversation. Default is TRUE.

Details

Conversation Interface for R with OpenAI

This function provides an interface to communicate with OpenAI's models using R. It maintains a conversation history and allows for initialization of a new conversation.

Value

Prints the conversation if verbose is TRUE. No return value.

Author(s)

Satoshi Kume

Examples

## Not run: 
conversation4R(message = "Hello, OpenAI!",
               api_key = "your_api_key_here",
               language = "English",
               initialization = TRUE)

## End(Not run)

[Package chatAI4R version 0.2.10 Index]