Skip to contents

The “Chat” app in gptstudio is an interactive Shiny app that can be launched directly from RStudio. It serves as a powerful tool to converse with various AI models, similar to ChatGPT and GitHub Copilot Chat, but integrated within your R environment.

Chat App from gptstudio

Chat App from gptstudio

Usage:

  1. Open the RStudio Addins menu and select “Chat”.
  2. A Shiny app window will appear, providing an interface to interact with the AI.
  3. Type your questions, code snippets, or text in the provided input box.
  4. The AI model, such as OpenAI’s GPT, will process your input and display the response within the app.

This app is ideal for a range of tasks, including querying AI for coding advice, explanations of complex concepts, or generating code snippets.

Optional:

While “Chat” does not modify your files directly like “Chat in Source”, it’s an invaluable tool for interactive learning and coding assistance. You can easily copy the responses from the “Chat” app and paste them into your R scripts or .Rmd files.

What is Chat?

The Chat app in gptstudio is your interactive AI assistant within RStudio. Unlike Chat in Source, which operates directly on your source code, Chat provides a separate interface where you can engage in a two-way conversation with AI models. This setup is especially useful for:

  • Exploring ideas or seeking advice on R coding problems.
  • Getting quick explanations or clarifications on programming concepts.
  • Experimenting with AI-generated code or text before incorporating it into your projects.
  • Using it as a learning tool to enhance your understanding of R and data science topics.

Remember, while Chat is a powerful tool, it’s always important to critically evaluate the AI’s responses and ensure they align with your project’s requirements and standards.

Usage

Some examples of how to use the package are below.

Chat in RStudio

  1. Addins > gptstudio > Chat
  2. Type your question.
  3. Click “Send” button or press “Enter”
  4. Ask more questions
  5. Copy and try code

The Chat addin supports internationalization. You can set the “GPTSTUDIO_LANGUAGE” environmental variable to the language of your preference (i.e. GPTSTUDIO_LANGUAGE="es" for spanish). See the full list of supported languages in the translation file ("inst/translations/translation.json").

Using Other Models

We’re excited to announce that our service now includes models from HuggingFace’s inference API, Anthropic’s claude models, and Google’s AI Studio, Azure OpenAI, and local models with Ollama broadening the range of AI solutions you can use. You can set the model using the setting (gear) button in the Chat addin app.


Persistent User Settings & Custom Prompt

You can now save your app settings across sessions. These are saved in a user config file. The easiest way to change these settings is the “Save as Default” button in the add-in app. This also allows you to specify your own custom prompt to pass to the model as instructions.


Provide your own instructions in R, R Markdown, or Quarto files

Addins > GPTSTUDIO > Chat in Source: Apply any edit what YOU desire or can dream up to a selection of code or text.


Spelling ang grammar check

Addins > GPTSTUDIO > Spelling and Grammar: Takes the selected text sends it to OpenAI’s best model and instructs it to return a spelling and grammar checked version.

spelling

Comment your code:

Addins > GPTSTUDIO > Comment your code: Takes the selected text sends it to OpenAI as a prompt for a code specific model to work with, asks for a version with a comment added explaining the code line by line.

add comments to code