PacketLLM is an RStudio gadget for AI-assisted development. It runs in the Viewer pane and connects to an AI backend, giving you a chat interface without leaving RStudio.
With PacketLLM, you can: - Generate code and explanations. - Analyze text from uploaded files (.R, .pdf, .docx). - Manage multiple conversations in tabs. - Customize model behavior through settings.
This vignette will guide you through the essential setup and basic usage.
PacketLLM requires an API key set in your environment.
Obtain an API key: Create an API key with your AI provider.
Configure the API Key:
The recommended method is to set the OPENAI_API_KEY
environment variable.
Using .Renviron (recommended):
Add the following line to your user or project .Renviron
file (replace 'your_secret_api_key_here' with your actual
key):
You can open the file using (requires the usethis
package):
Important: Restart your R session after editing
.Renviron.
Temporary Solution:
For the current session only, run:
Install PacketLLM from CRAN:
Development version from GitHub:
Once installed and your API key is set, launch the gadget from the R console:
This command should be executed in an interactive RStudio session.
The PacketLLM interface consists of:
Top Navigation Bar:
Conversation Tabs:
Switch between multiple chat sessions; each tab can be closed
individually.
Chat History Area:
Displays the dialogue between you and the AI.
Input Area:
run_llm_chat_app().Optional steps: - Add File Context: Click the + button to attach files before sending. - Start a New Conversation: Click New Conversation for a fresh session. - Adjust Settings: Use Settings to change model options before sending the first message.
Experiment with different models, system prompts, and file attachments to enhance your workflow with PacketLLM. For issues or suggestions, please visit the GitHub Issues page.