ProfessorLeVesseur commited on
Commit
67bfc8c
1 Parent(s): d81ac57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -8,16 +8,18 @@ openai_api_key = st.secrets["openai_api_key"]
8
  # Initialize the OpenAI service with API key
9
  openai.api_key = openai_api_key
10
 
11
- # Fetch Pinecone API key and environment from Streamlit secrets
12
- pinecone_api_key = st.secrets["pinecone_api_key"]
13
- # pinecone_api_key = '555c0e70-331d-4b43-aac7-5b3aac5078d6'
14
- pinecone_environment = st.secrets["pinecone_environment"]
15
-
16
- # AUTHENTICATE/INITIALIZE PINCONE SERVICE
17
- from pinecone import Pinecone
18
- # pc = Pinecone(api_key=pinecone_api_key)
19
  # pc = Pinecone (api_key= 'YOUR_API_KEY')
20
- Pinecone(api_key=pinecone_api_key, environment=pinecone_environment)
 
 
21
 
22
  # # Define the name of the Pinecone index
23
  index_name = 'mimtssinkqa'
@@ -27,10 +29,8 @@ from langchain_openai import OpenAIEmbeddings
27
  embeddings = OpenAIEmbeddings(openai_api_key=openai_api_key)
28
 
29
  # LOAD VECTOR STORE FROM EXISTING INDEX
30
- # from langchain_community.vectorstores import Pinecone
31
- from langchain_community.vectorstores import Pinecone as PineconeStore
32
- # vector_store = Pinecone.from_existing_index(index_name='mimtssinkqa', embedding=embeddings)
33
- vector_store = PineconeStore.from_existing_index(index_name=index_name, embedding=embeddings)
34
 
35
  def ask_with_memory(vector_store, query, chat_history=[]):
36
  from langchain_openai import ChatOpenAI
 
8
  # Initialize the OpenAI service with API key
9
  openai.api_key = openai_api_key
10
 
11
+ # # Fetch Pinecone API key and environment from Streamlit secrets
12
+ # PINECONE_API_KEY = st.secrets["PINECONE_API_KEY"]
13
+ # # pinecone_api_key = '555c0e70-331d-4b43-aac7-5b3aac5078d6'
14
+ # pinecone_environment = st.secrets["pinecone_environment"]
15
+
16
+ # # AUTHENTICATE/INITIALIZE PINCONE SERVICE
17
+ # from pinecone import Pinecone
18
+ # # pc = Pinecone(api_key=PINECONE_API_KEY)
19
  # pc = Pinecone (api_key= 'YOUR_API_KEY')
20
+
21
+ PINECONE_API_KEY = "555c0e70-331d-4b43-aac7-5b3aac5078d6"
22
+ pc = Pinecone(api_key=PINECONE_API_KEY)
23
 
24
  # # Define the name of the Pinecone index
25
  index_name = 'mimtssinkqa'
 
29
  embeddings = OpenAIEmbeddings(openai_api_key=openai_api_key)
30
 
31
  # LOAD VECTOR STORE FROM EXISTING INDEX
32
+ from langchain_community.vectorstores import Pinecone
33
+ vector_store = Pinecone.from_existing_index(index_name='mimtssinkqa', embedding=embeddings)
 
 
34
 
35
  def ask_with_memory(vector_store, query, chat_history=[]):
36
  from langchain_openai import ChatOpenAI