dark-peak-analytics / assertHE

R package to assist in the verification of health economic decision models.
https://dark-peak-analytics.github.io/assertHE/
Other
4 stars 10 forks source link

Create tutorial for using GPT-3.5 #86

Closed RobertASmith closed 3 months ago

RobertASmith commented 4 months ago

The LLM GPT-3.5 openai functionality requires an account to be set up with OpenAI.

First, create an OpenAI account or sign in. Next, navigate to the API key page and "Create new secret key", optionally naming the key. Make sure to save this somewhere safe and do not share it with anyone.

Then, you must create two system environment variables. If you want to do this as a one-off they can be created like this:

Sys.setenv(LLM_API_URL = "https://api.openai.com/v1/chat/completions")
Sys.setenv(LLM_API_KEY = <INSERT KEY HERE>)

However, if you want R to always have access to these system environment variables you'll want to follow this guide.

Personally, I have a .Renviron file stored in my Documents folder that contains among other things, OPENAIKEY = <MY KEY>. This is loaded every time I open RStudio so I can always access those environment variables.