Skip to content

Commit

Permalink
updating openai key from env
Browse files Browse the repository at this point in the history
  • Loading branch information
ido777 committed Jun 19, 2023
1 parent 7c73aca commit ebc10b6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import yaml
import os
from dotenv import load_dotenv

import openai
from relevancy import generate_relevance_score, process_subject_fields
from download_new_papers import get_papers

Expand Down Expand Up @@ -280,8 +280,10 @@ def generate_body(topic, categories, interest, threshold):
args = parser.parse_args()
with open(args.config, "r") as f:
config = yaml.safe_load(f)

if "OPENAI_API_KEY" not in os.environ:
raise RuntimeError("No openai api key found")
openai.api_key = os.environ.get("OPENAI_API_KEY")

topic = config["topic"]
categories = config["categories"]
Expand Down

0 comments on commit ebc10b6

Please sign in to comment.