shreyasiv commited on
Commit
2929ce5
·
1 Parent(s): ad89062

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +13 -2
utils.py CHANGED
@@ -2,10 +2,21 @@ from sentence_transformers import SentenceTransformer
2
  import pinecone
3
  import openai
4
  import streamlit as st
5
- openai.api_key = "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"
 
 
 
 
 
 
 
 
 
 
 
6
  model = SentenceTransformer('all-MiniLM-L6-v2')
7
 
8
- pinecone.init(api_key='6f66d7f3-7478-4d25-9789-78cfef84ab52', environment='asia-southeast1-gcp-free')
9
  index = pinecone.Index('langchain-chatbot')
10
 
11
  def find_match(input):
 
2
  import pinecone
3
  import openai
4
  import streamlit as st
5
+ import os
6
+ from dotenv import load_dotenv
7
+
8
+ # Load environment variables from .env file
9
+ load_dotenv()
10
+
11
+ # Access OpenAI and Pinecone API keys from environment variables
12
+ OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
13
+ PINECONE_API_KEY = os.getenv("PINECONE_API_KEY")
14
+
15
+ OPENAI_API_KEY= OPENAI_API_KEY
16
+
17
  model = SentenceTransformer('all-MiniLM-L6-v2')
18
 
19
+ pinecone.init(api_key=PINECONE_API_KEY, environment='asia-southeast1-gcp-free')
20
  index = pinecone.Index('langchain-chatbot')
21
 
22
  def find_match(input):