Skip to content
Snippets Groups Projects
README.md 1.44 KiB
Newer Older
owzar001@duke.edu's avatar
owzar001@duke.edu committed
# Set API key
Create a text file .env with the following line

```
OPENAI_API_KEY=MYAPIKEYNOQOUTES
```

Make this file readable and writable by only by the owner 

```
chmod 700 .env
```

Alternatively, one can export the key from the UNIX shell (but it is unclear if this is secure)

```
$ export OPENAI_API_KEY=MYAPIKEYNOQOUTES
```

See [https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety] for additional details

# Toy examples for testing setup on DCC

## Test langroid toy example
owzar001@duke.edu's avatar
owzar001@duke.edu committed
```
owzar001@duke.edu's avatar
owzar001@duke.edu committed
srun \
    --account biostat \
    --partition biostat \
    --mem 32G \
owzar001@duke.edu's avatar
owzar001@duke.edu committed
    apptainer exec \
    /opt/apps/containers/community/owzar001/langroid-dcc.sif \
owzar001@duke.edu's avatar
owzar001@duke.edu committed
    /opt/langroid/bin/python3 toyexamples/langroid-toy.py
owzar001@duke.edu's avatar
owzar001@duke.edu committed
```

owzar001@duke.edu's avatar
owzar001@duke.edu committed
## Test langroid toy example on GPU node
owzar001@duke.edu's avatar
owzar001@duke.edu committed
```
srun \
    --account biostat \
    --partition biostat-gpu \
    --gres=gpu \
    --mem 32G \
    apptainer exec \
    --nv \
    /opt/apps/containers/community/owzar001/langroid-dcc.sif \
owzar001@duke.edu's avatar
owzar001@duke.edu committed
    /opt/langroid/bin/python3 toyexamples/langroid-toy.py
owzar001@duke.edu's avatar
owzar001@duke.edu committed
## Test openAI API toy example
owzar001@duke.edu's avatar
owzar001@duke.edu committed

```
srun \
    --account biostat \
    --partition biostat \
    --mem 32G \
    apptainer exec \
    /opt/apps/containers/community/owzar001/langroid-dcc.sif \
owzar001@duke.edu's avatar
owzar001@duke.edu committed
    /opt/openai/bin/python3 toyexamples/openai-toy.py
owzar001@duke.edu's avatar
owzar001@duke.edu committed
```
owzar001@duke.edu's avatar
owzar001@duke.edu committed

# OpenAI Deprecated Models
https://stackoverflow.com/questions/77789886/openai-api-error-the-model-text-davinci-003-has-been-deprecated
https://platform.openai.com/docs/deprecations