diff --git a/README.md b/README.md index f7e33fd..ec04c35 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ - # ggfigdone: Manage ggplot figures using ggfigdone [![R](https://github.com/wenjie1991/ggfigdone/actions/workflows/r.yml/badge.svg)](https://github.com/wenjie1991/ggfigdone/actions/workflows/r.yml) @@ -15,9 +14,21 @@ You need to change the figure size, modify the title, label, themes, etc. It is inconvinient to go back to the original code to make these changes. This package provides a simple way to manage ggplot figures. -You can easily add the figure to the database and update them later using CLI (command line interface) or GUI (graphical user interface). +## Features + +### Manage figures + +You can easily add the figure to the database and manage it later using CLI (command line interface) or GUI (graphical user interface). + +https://github.com/user-attachments/assets/7bcccfdd-e48d-49c7-9c18-ec0c41ee0481 + + -![ggfigdone_demo](https://github.com/user-attachments/assets/a0d4d01d-105a-4fc0-bda5-c7cc3e6dbd48) +### Update figures by LLM + +Utilizing the LLM to convert your natural language idea into {ggplot2} code. + +https://github.com/user-attachments/assets/524a6d44-012d-4a55-8a5a-83b44f1ffadd ## Installation @@ -35,7 +46,6 @@ remotes::install_github("wenjie1991/ggfigdone") ``` - ## Demo ### Initialize the database @@ -79,6 +89,70 @@ fd_server("./fd_dir") ## Open the browser and go to http://localhost:8080/index.html ``` +## Configure LLM Service + +### LLM API key + +**OpenAI API** + + +Please visit the OpenAI website at https://openai.com/ and follow the instructions in the video. You may need to update your payment methods. + +https://github.com/user-attachments/assets/e5fc4feb-5dc4-4473-826d-ec69b5c0d9a5 + + +**Free API key** + + +You can access a free LLM service at this link: https://github.com/cheahjs/free-llm-api-resources + +The following video demonstrates how to apply the GroqCloud key for free. + +Link: https://console.groq.com/login + + +https://github.com/user-attachments/assets/5624798a-1c86-4694-b7a0-69daaacf470f + + +### Configure {ggfigdone} + + +**Example: OpenAI service** + +The default configuration is the OpenAI service, where you only need to provide the OpenAI API key. + +```r +fd_server("./fd_dir", + llm_api_key = "sk-use_your_own_key_here"), +) +``` + +**Example: Groq service** + +To use Croq or any other service, you must configure the parameters `llm_api_url`, `llm_api_key`, and `llm_model`. + +```r +fd_server("./fd_dir", + llm_api_url = "https://api.groq.com/openai/v1/chat/completions", + llm_api_key = "gsk_use_your_own_key_here"), + llm_model = "llama-3.3-70b-versatile", +) +``` + +### Set default service + +You can configure the default LLM service in `.Rprofile` using the following code. + +```r +options( + llm_api_key = "gsk-use_your_own_key_here", + llm_api_url = "https://api.groq.com/openai/v1/chat/completions", + llm_model = "llama-3.3-70b-versatile", + llm_temperature = "0.5", + llm_max_tokens = 1000 +) +``` + ## Contribution This package is being developed. Feel free to contribute to the package by sending pull requests or creating issues.