Externalized API Key

This commit is contained in:
B.J. Dweck 2023-09-08 12:32:49 +03:00
parent b4be376ec8
commit 8213eff41b
2 changed files with 14 additions and 2 deletions

View File

@ -31,6 +31,15 @@ A comprehensive toolkit that offers:
```bash ```bash
pip install -r requirements.txt pip install -r requirements.txt
``` ```
## Configuration
Before using the `text2csvdeck.py` script, ensure that you have set the `OPENAI_API_KEY` environment variable:
```bash
export OPENAI_API_KEY=your_openai_api_key_here
```
Remember to replace `your_openai_api_key_here` with your actual OpenAI API key.
## Usage ## Usage

View File

@ -1,8 +1,11 @@
import openai import openai
import sys import sys
import os
API_KEY = os.environ.get("OPENAI_API_KEY")
if not API_KEY:
raise ValueError("Please set the OPENAI_API_KEY environment variable.")
# Set up the OpenAI API key
API_KEY = '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'
openai.api_key = API_KEY openai.api_key = API_KEY
# Given prompt template # Given prompt template