Ross McNairn commited on
Commit
f04542f
·
1 Parent(s): 37d7532

add error message for no api key set

Browse files
Files changed (1) hide show
  1. hello_wordsmith/wordsmith.py +4 -0
hello_wordsmith/wordsmith.py CHANGED
@@ -114,6 +114,10 @@ class WordsmithRAGCLI(RagCLI):
114
 
115
 
116
  def main():
 
 
 
 
117
  vector_store = initialize_chroma_db()
118
  storage_context = StorageContext.from_defaults(vector_store=vector_store)
119
  index = setup_document_storage(
 
114
 
115
 
116
  def main():
117
+ api_key = os.getenv("OPENAI_API_KEY")
118
+ if not api_key:
119
+ print("Error: Environment variable 'OPENAI_API_KEY' is not set. Please set this before running.")
120
+ sys.exit(1)
121
  vector_store = initialize_chroma_db()
122
  storage_context = StorageContext.from_defaults(vector_store=vector_store)
123
  index = setup_document_storage(