groqR

The objective of groqR is to offer R users an intuitive interface for leveraging the capabilities of the ‘Groq API’. Utilizing the supplied functions, users can enhance their programming productivity by incorporating Large Language Models. Furthermore, groqR includes an RStudio addin, enabling seamless interactive integration of ‘Groq’ prompts.

Why Choose groqR?

Installation

You can install the development version of groqR from GitHub with:

# install.packages("devtools")
# devtools::install_github("GabrielKaiserQFin/groqR")
install.packages("groqR", repos = c('https://gabrielkaiserqfin.r-universe.dev', 'https://cloud.r-project.org'))

Requirements

You need to create a free account and a free ‘API’ key by accessing ‘Groq API’ page, otherwise you can not use {groqR}. To use your ‘API’ key in {groqR}, you need to configure the function parameters in the .Renviron file.

Initial Steps

When you run it for the first time, a Shiny app will launch to guide you through the initial steps, setting up the necessary environment variables for the GROQ system.

Addins

In your RStudio go to Addins and select Ask ‘Groq’, which will open an interactive prompt in your Viewer, where you can choose between different models and adjust the temperature and the number of tokens to be used. Simply ask anything of your interest and hit the confirm button. The Done button lets you close the App. Similarly, you can mark or copy any text or code and use the other Addins as described below. Addin shortcuts will improve your efficiency.

How It Works

ask:

This is a basic example which shows you how to ask any question.

ask("What do you think about Large language models?")

rewriter:

This is a basic example which shows you how to rewrite text.

rewriter("Dear Recipient, I hope this message finds you well.")

translater:

This is a basic example which shows you how to translate text.

translater("Dear Recipient, I hope this message finds you well.", toLanguage = "Spanish")

codeComment:

This is a basic example which shows you how to document code.

codeComment("z <- function(x) scale(x)^2")

unitTests:

This is a basic example which shows you how to build Unit Tests for your function.

unitTests("z <- function(x) scale(x)^2")

debug:

This is a basic example which shows you how to find bugs in your code.

debug("z <- function(x) scale(x)2")

roxy:

This is a basic example which shows you how to document your code. Formatting style is Roxygen2 but can be set to anything.

roxy("z <- function(x) scale(x)^2")

coder:

This is a basic example which shows you how to finish your code by ‘Groq’.

coder("# A function to scale a vector and square the resulting z-score z2 <- function(")

optimizer:

This is a basic example which shows you how to optimize your code.

optimizer("z <- function(x) scale(x)^2")

codeConverter:

This is a basic example which shows you how to translate your code.

codeConverter("z <- function(x) scale(x)^2", from = "R", to = "Python")

nameIt:

This is a basic example which shows you how to create a function or variable name.

nameIt("function(x) scale(x)^2")

Groq Model Arguments

The model parameters can be adjusted by passing functional arguments.

modelCall()[,1:5]
NULL