Prakhar Bhandari commited on
Commit
fd975a4
·
1 Parent(s): c8025cd

Added .env to hide api keys

Browse files
.gitignore CHANGED
@@ -1 +1,2 @@
1
- graphrag/
 
 
1
+ graphrag/
2
+ .env
kg_builder/src/api_connections.py CHANGED
@@ -1,16 +1,20 @@
1
 
2
  from langchain_community.graphs import Neo4jGraph
 
3
  import os
4
 
5
- # Neo4j connection setup
6
- url = "neo4j+s://2f409740.databases.neo4j.io"
7
- username = "neo4j"
8
- password = "oe7A9ugxhxcuEtwci8khPIt2TTdz_am9AYDx1r9e9Tw"
 
 
 
 
9
  graph = Neo4jGraph(
10
  url=url,
11
  username=username,
12
  password=password
13
  )
14
 
15
- # OpenAI API key setup
16
- os.environ["OPENAI_API_KEY"] = "sk-proj-hceIL56CC2zfjAvAlMjbT3BlbkFJyHKX2wbiQxsG9yy8dGJN"
 
1
 
2
  from langchain_community.graphs import Neo4jGraph
3
+ from dotenv import load_dotenv
4
  import os
5
 
6
+ load_dotenv() # This loads the variables from .env into os.environ
7
+
8
+ # Now use os.getenv to access your variables
9
+ url = os.getenv("NEO4J_URL")
10
+ username = os.getenv("NEO4J_USERNAME")
11
+ password = os.getenv("NEO4J_PASSWORD")
12
+ openai_api_key = os.getenv("OPENAI_API_KEY")
13
+
14
  graph = Neo4jGraph(
15
  url=url,
16
  username=username,
17
  password=password
18
  )
19
 
20
+
 
kg_builder/src/main.py CHANGED
@@ -7,7 +7,7 @@ from tqdm import tqdm
7
  def main():
8
  print("Starting the script...")
9
  # Take Wikipedia article name as input
10
- article_name = input("Enter the Wikipedia article name: ") # Corrected to proper input usage
11
 
12
  print(f"Loading documents for: {article_name}")
13
  # Load and process the Wikipedia article
 
7
  def main():
8
  print("Starting the script...")
9
  # Take Wikipedia article name as input
10
+ article_name = input("Enter the Wikipedia article name: ")
11
 
12
  print(f"Loading documents for: {article_name}")
13
  # Load and process the Wikipedia article