Other interfaces

Besides the app, there are a couple of more ways to interact with the LLM via chattr:

Output

Based on where you are making the request from, chattr will return the response appropriately in the following manner:

Using the chattr() function

The fastest way to interact with the LLM is by simply calling the chattr() function and enter your request there. Here is an example of a request made to OpenAI:

library(chattr)
chattr("show me a simple recipe")
# Load required packages
library(tidymodels)

# Create a simple recipe for the iris dataset
iris_recipe <- recipe(Species ~ ., data = iris) 

# Print the recipe
iris_recipe

Highlight the request in a script

In a script, chattr will process the current line, or the highlighted line(s), as the prompt. Because we assume that the request is not going to be code, then chattr will comment out the line or lines that were highlighted. As mentioned in the Output section, the response will be inserted in your document.

Here is an example of a request submitted to OpenAI:

Create a function that:
  - Removes specified variables
  - Behaves like dplyr's select function

And here are the results:

# Create a function that:
#   - Removes specified variables
#   - Behaves like dplyr's select function


# This function removes specified variables and behaves like dplyr's select function
# It uses the tidyverse packages: dplyr and tidyr

remove_vars <- function(data, ...) {
    data %>%
        select(-one_of(...))
}


}