Skip to contents

This function creates a virtual environment and installs the openai package in it.

Usage

setup_py(venv_name = "r-gpt-venv", ask = interactive())

Arguments

venv_name

(chr, default "r-gpt-venv") The name of the virtual environment to be created.

ask

(lgl, default TRUE if in interactive session, FALSE otherwise) If TRUE, the user is asked if they want to create the virtual environment.

Value

(lgl) TRUE if the virtual environment was created, FALSE otherwise.

Examples

if (FALSE) {
  library(gpteasyr)
  setup_py()

  prompt <- compose_prompt_api(
    sys_prompt = "You are the assistant of a university professor.",
    usr_prompt = "Tell me about the last course you provided."
  )

  res <- query_gpt(
      prompt = prompt,
      use_py = TRUE
    ) |>
      get_content()

   cat(res)
}