Authors | Last update |
---|---|
Hauke Licht (https://github.com/haukelicht) | 2024-05-29 |
This repository contains the materials for the workshop "Hands-On Text Coding with Large Language Models for Social Scientists with R".
Below I describe the software requirements ...
... and necessary setup steps.
rollama
If you run into difficulties, email me at hauke.licht [at] wiso [dot] uni-koeln [dot] de
or post an issue.
One main prerequisite for the workshop is that you have programmed in R before. Hence, I am assuming that you have a working R installation on the computer you will be using during the workshop.
R.version
in your R console or R --version
in your Terminal app (MacOS users) or Command Prompt (Windows users)We will be using RStudio as a code editor in the workshop. Please install RStudio before the workshop if neede as described here https://posit.co/download/rstudio-desktop/
Next, you need to install install all required packages.
I recommend you use renv
for this:
Alternative: If you don't want to use renv
for installing and managing required packages, you can mannually install the packages (in the versions) listed in file setup/requirements.txt
ollama
We will be using ollama
to interact with open-source LLMs.
Please install ollama
from here: https://ollama.com/download
Note — You will need macOS 11 Big Sur (or later) or Windows 10 (or later).
ollama
in RRun the code in notebook test_ollama.qmd to verify that you can access API key is accessible in RStudio and your API access works.
Go to OpenAI and create an account.
Go to the API keys page.
Create a new API key by clicking on the "Create new secret key" button.
Fill your information in the form show below ...
... and click on the "Create secrete " button.
Note — This will be the only time you will be able to see your API key. Make sure you take the next step described below to store it in a safe place.
Create a file called .Renviron
in the root of your project folder.
(It's important that the file name starts with a dot!)
Open it in a text editor
Alternative — Directly create and open the .Renviron
file by running usethis::edit_r_environ(scope = "project")
in your R console in RStudio (see https://github.com/irudnyts/openai?tab=readme-ov-file#authentication).
Now,
OPENAI_API_KEY=
in the first line of the file, .Renviron
file behind the =
Run the code in notebook test_openai_key.qmd to verify that your API key is accessible in RStudio and your API access works.
If you have a question or encounter any issues, email me at hauke.licht [at] wiso [dot] uni-koeln [dot] de
or post an issue.