GenAI - Generative Artificial Intelligence Toolbox

Now, you can seamlessly utilize both ChatGPT from OpenAI and Gemini Pro from Google! Enjoy enhanced chat conversion and the ability to engage in multiple chat sessions with ease!

💡 2024/02/15 - R Package 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!


GenAI harnesses the power of advanced models like GPT-4 and Gemini Pro to serve as versatile coding and writing assistants for users in both R and, soon, Python. This toolbox empowers users with a range of capabilities, including text generation, code optimization, natural language processing, chat assistance, and image interpretation. The ultimate objective is to simplify and enhance the coding and language processing experience for users of both R and Python.

The following image is a flowchart that describes how to use the GenAI package to generate text and chat. The flowchart starts with the user importing the GenAI package into their R or Python environment. The user is then prompted to connect to the Generative AI service providers' APIs with or without GenAI's API proxy service. If the user is successful in connecting to the API, they will be able to use the GenAI functions to generate text and chat.

Flowchart of how GenAI works

The GenAI package provides a variety of functions for generating text, including functions for generating text explanations of code, fixing grammar, optimizing code, and generating images from text. The package also provides a variety of functions for generating chat, including functions for editing chat, converting chat to text, and setting up chat.

The output of the GenAI package is a text or chat response. The response is generated using the user's input and the GenAI functions.


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

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

  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.

API Proxy Service

For individuals utilizing Generative AI service providers with API usage location restrictions in certain countries/regions, this service is tailored for those who possess a valid API key but find themselves outside their home countries/regions due to travel, work, or study in regions not covered by some Generative AI service providers.


This work is licensed under CC BY 4.0ccby