GenAI - R Package "GenAI" Documentation

Last update: 2024/02/15

Utilizing 'Generative Artificial Intelligence' models like 'GPT-4' and 'Gemini Pro' as coding and writing assistants for 'R' users. Through these models, 'GenAI' offers a variety of functions, encompassing text generation, code optimization, natural language processing, chat, and image interpretation. The goal is to aid 'R' users in streamlining laborious coding and language processing tasks.

💡 Update: version 0.2.0 💡
Utilizing R6 class, enhancing user friendiliness. Support one more generative AI - Moonshot AI. Moreover, you can now generate image using this package!


Prior to utilizing the GenAI package, several prerequisites must be met.

  1. Ensure that you possess an eligible device equipped with R.

  2. Access to the internet is essential to generate text or engage in chat through GenAI.

  3. Obtain an API key from the selected Generative AI service provider. GenAI currently supports Generative AI models from Google, Moonshot AI, and OpenAI.


1. Install the package from The Comprehensive R Archive Network (CRAN).


2. Install the package from GenAI official website.

                     dependencies = TRUE,
                     method = "libcurl")


Text Generation

Chat Generation

Image Generation