Externalized API Key
This commit is contained in:
		
							parent
							
								
									b4be376ec8
								
							
						
					
					
						commit
						8213eff41b
					
				|  | @ -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 | ||||
| 
 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user