Chat in Source

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Quick Start

The Chat in Source addin can be accessed from the RStudio Addins menu. The addin allows you to send selected code to the OpenAI API and insert the response into your .Rmd file.

Usage:

  1. Select the R code in your .Rmd file that you want to send to OpenAI.
  2. Go to the RStudio Addins menu and choose "Chat in Source".
  3. The response from OpenAI will be inserted at the location of your selected code.

Optional:

To set a keyboard shortcut for the "Chat in Source" addin, follow these steps:

What is Chat in Source?

The Chat in Source addin will modify your files directly. You can access it from the RStudio Addins menu. To use the addin, you first need to select the code you want to modify. Then, you can call the addin. The addin will send the selected code to the OpenAI API and insert the response in your file.

For convenience, you may want to map the addin to a keyboard shortcut. You can do this by going to Tools > Modify Keyboard Shortcuts and searching for "Chat in Source". You can then assign a custom keyboard shortcut to the addin.

Changing the Service & Model

The Chat in Source addin allows you to customize the model and API service used by the app. Like the Chat addin, the default service is OpenAI. To change this, you need to change the settings in the Chat app. This will change the model for both the Chat and Chat in Source addins.

{width=700px}

Examples and Use Cases

The "Chat in Source" addin can augment your R workflow in many creative ways. Below are some practical examples:

Documentation Assistance

Code Improvement

Code Generation

Education and Learning

Collaboration



Try the gptstudio package in your browser

Any scripts or data that you put into this service are public.

gptstudio documentation built on May 29, 2024, 12:30 p.m.