File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -21,19 +21,20 @@ def push_docs_to_weaviate(
2121 # Load environment variables from .env file
2222 load_dotenv ()
2323
24- os .getenv ("WEAVIATE_URL" )
24+ openai_api_key = os .getenv ("OPENAI_API_KEY" )
25+ if openai_api_key is None :
26+ raise ValueError ("OPENAI_API_KEY environment variable is not set" )
27+
2528
2629 client = weaviate .connect_to_custom (
2730 http_host = "localhost" ,
28- http_port = " 8080" ,
31+ http_port = 8080 ,
2932 http_secure = False ,
3033 grpc_host = "localhost" ,
31- grpc_port = " 50051" ,
34+ grpc_port = 50051 ,
3235 grpc_secure = False ,
3336 headers = {
34- "X-OpenAI-Api-Key" : os .getenv (
35- "OPENAI_API_KEY"
36- ) # Or any other inference API keys
37+ "X-OpenAI-Api-Key" : openai_api_key # Or any other inference API keys
3738 },
3839 )
3940
You can’t perform that action at this time.
0 commit comments