diff --git a/README.md b/README.md index 9e5a164..2499704 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,15 @@ A comprehensive toolkit that offers: ```bash 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 diff --git a/text2csvdeck.py b/text2csvdeck.py index 9919c07..29d68ea 100644 --- a/text2csvdeck.py +++ b/text2csvdeck.py @@ -1,8 +1,11 @@ import openai 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 # Given prompt template