Welcome to PacketLLM! This package provides a seamless way to interact with OpenAI’s Large Language Models (LLMs) such as GPT-4o directly within your RStudio environment. It runs as an RStudio Gadget, offering a familiar chat interface without the need to switch between applications.
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 OpenAI API key.
Obtain an API Key:
Sign up on the OpenAI Platform and create an API key.
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:
Important: Restart your R session after editing
.Renviron
.
Temporary Solution:
For the current session only, run:
Install PacketLLM 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.