A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/mlverse/chattr below:

GitHub - mlverse/chattr

chattr is an interface to LLMs (Large Language Models). It enables interaction with the model directly from RStudio and Positron. chattr allows you to submit a prompt to the LLM from your script, or by using the provided Shiny Gadget.

This package’s main goal is to aid in exploratory data analysis (EDA) tasks. The additional information appended to your request, provides a sort of “guard rails”, so that the packages and techniques we usually recommend as best practice, are used in the model’s responses.

To install the CRAN version of this package use:

install.packages("chattr")

If you wish to use the development version use:

pak::pak("mlverse/chattr")

Starting with version 0.3, chattr integrates with LLM’s via the ellmer package. ellmer has a growing list of LLM integrations, including OpenAI, Gemini, Deepseek and others.

There are several ways to let chattr know which LLM to use:

For convenience, chattr contains some provider/model combinations that you can use by passing what is under Use value to chattr_use():

Model & Provider Use value DBRX (Databricks) databricks-dbrx Meta Llama 3.3 70B (Databricks) databricks-meta-llama31-70b Mixtral 8x7b (Datbricks) databricks-mixtral8x7b GPT 4.1 Mini (OpenAI) gpt41-mini GPT 4.1 Nano (OpenAI) gpt41-nano GPT 4.1 (OpenAI) gpt41 GPT 4 Omni (OpenAI) gpt4o Llama 3.2 (Ollama) ollama

If the provider and/or model you wish to use is not listed in the table above, you can create an ellmer chat connection directly. And then pass that chat object to chattr_use(). Here is a list of the providers that are currently available in that package:

The main way to use chattr is through the Shiny Gadget app. By default, in RStudio the app will run inside the Viewer pane.

chattr_use("ollama")
chattr_app()

Screenshot of the Sniny gadget app in a dark mode RStudio theme

After the LLM finishes its response, the chattr app processes all markdown code chunks. It will place three convenience buttons:

A lot of effort was put in to make the app’s appearance as close as possible to the IDE. This way it feels more integrated with your work space. This includes switching the color scheme based on the current RStudio theme being light, or dark.

The settings screen can be accessed by clicking on the “gear” button. The screen that opens will contain the following:

Screenshot of the Sniny gadget options Additional ways to interact

Apart from the Shiny app, chattr provides two more ways to interact with the LLM. For details, see: Other interfaces

chattr enriches your request with additional instructions, name and structure of data frames currently in your environment, the path for the data files in your working directory. If supported by the model, chattr will include the current chat history.

Diagram that illustrates how chattr handles model requests

To see what chattr will send to the model, set the preview argument to TRUE:

library(chattr)

data(mtcars)
data(iris)

chattr_use("gpt4o")
#> 
#> ── chattr
#> • Provider: OpenAI - Chat Completions
#> • Model: gpt-4o
#> • Label: GPT 4 Omni (OpenAI)

chattr(preview = TRUE)
#> 
#> ── chattr ──────────────────────────────────────────────────────────────────────
#> 
#> ── Preview for: Console
#> • Provider: OpenAI - Chat Completions
#> • Model: gpt-4o
#> • Label: GPT 4 Omni (OpenAI)
#> • temperature: 0.01
#> • max_tokens: 1000
#> • stream: TRUE
#> 
#> ── Prompt:

The best way to access chattr’s app is by setting up a keyboard shortcut for it. This package includes an RStudio Addin that gives us direct access to the app, which in turn, allows a keyboard shortcut to be assigned to the addin. The name of the addin is: “Open Chat”. If you are not familiar with how to assign a keyboard shortcut see the next section.

How to setup the keyboard shortcut

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4