Generative AI in RStudio

Using GitHub Copilot, ChatGPT, & more in your favorite IDE

James Wade

Three ways to use GenAI in RStudio


  1. GitHub Copilot
  2. RStudio Addins {gptstudio}, {chattr}, {gpttools}
  3. API Wrappers {openai}, {chattr}, {gptstudio}

GitHub Copilot Integration

Go watch Tom Mock’s talk to learn more Copilot in RStudio.

‘Trust’ but Verify

  • Generative AI doesn’t have a ‘brain’ or general intelligence
  • It’s just a model that’s been trained on a lot of data
  • It’s not always right, appropriate, or optimal
  • It can make up things that aren’t true, or use code that doesn’t actually exist (or run!)
  • So it’s important to verify the output before using it
  • But we can use it to quickly experiment and maybe provide a novel direction
    (basically “prompt” ourselves and our own knowledge)

What is Copilot

GitHub Copilot is an AI pair programmer that offers autocomplete-style suggestions and real-time hints for the code you are writing by providing suggestions as “ghost text” based on the context of the surrounding code - GitHub Copilot docs

Autocomplete

  • Parses code and environment
  • Supplies possible completions
  • Static set of completions in popup
  • IDE provided from local disk

Copilot

  • Parses code, environment and training data
  • Supplies likely completions
  • Dynamic set of completions via ‘ghost text’
  • Generative AI provided via API endpoint

Autocomplete vs Copilot

Copilot in RStudio

Let’s Talk Packages

{gptstudio}

{gptstudio}

{chattr}

{chattr}

{gpttools}

{gpttools}