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!
Prerequisites
Prior to utilizing the GenAI package, several prerequisites must be met.
-
Ensure that you possess an eligible device equipped with R.
-
Access to the internet is essential to generate text or engage in chat through GenAI.
-
Obtain an API key from the selected Generative AI service provider. GenAI currently supports Generative AI models from Google, Moonshot AI, and OpenAI.
- To acquire an API key for Google's models, refer to: Google Generative AI - API key
- To acquire an API key for Moonshot AI's models, refer to: Moonshot AI - API Key
- To acquire an API key for OpenAI's models, refer to: OpenAI - API Key
Installation
1. Install the package from The Comprehensive R Archive Network (CRAN).
install.packages("GenAI")
2. Install the package from GenAI official website.
remotes::install_url("https://genai.gd.edu.kg/release/R/GenAI_latest.tar.gz",
dependencies = TRUE,
method = "libcurl")
Setup
Text Generation
Chat Generation
-
Chat Generation with Text as the Input
chat
-
Chat Edit with New Text as the Input
chat.edit
-
Chat History Convert
chat.history.convert
-
Chat History Export
chat.history.export
-
Chat History Import
chat.history.import
-
Chat History Print
chat.history.print
-
Chat History Reset
chat.history.reset
-
Chat History Save
chat.history.save