Siddhant commited on
Commit
464f7ab
·
unverified ·
1 Parent(s): 9462b0d

variables added in environment

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -10,8 +10,12 @@ from langchain.embeddings.openai import OpenAIEmbeddings
10
 
11
  embeddings = OpenAIEmbeddings()
12
 
13
- PINECONE_API_KEY = '6af52b8a-a3df-4189-899b-b21163027bb8'
14
- PINECONE_API_ENV = 'asia-southeast1-gcp'
 
 
 
 
15
 
16
  # initialize pinecone
17
  pinecone.init(
@@ -19,10 +23,10 @@ pinecone.init(
19
  environment=PINECONE_API_ENV # next to api key in console
20
  )
21
 
22
- index_name = "twimbit-answer"
23
  vectorstore = Pinecone.from_existing_index(index_name=index_name, embedding=embeddings)
24
 
25
- api_key = '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'
26
 
27
 
28
  class ChatWrapper:
@@ -49,7 +53,7 @@ class ChatWrapper:
49
  os.environ["OPENAI_API_KEY"] = ""
50
 
51
  import openai
52
- openai.api_key = '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'
53
  # Run chain and append input.
54
  output = chain({"question": inp, "chat_history": history})["answer"]
55
  history.append((inp, output))
 
10
 
11
  embeddings = OpenAIEmbeddings()
12
 
13
+ # PINECONE_API_KEY = '6af52b8a-a3df-4189-899b-b21163027bb8'
14
+ # PINECONE_API_ENV = 'asia-southeast1-gcp'
15
+
16
+ PINECONE_API_KEY = os.environ["PINECONE_API_KEY"]
17
+ PINECONE_API_ENV = os.environ["PINECONE_API_ENV"]
18
+ PINECONE_INDEX = os.environ["PINECONE_INDEX"]
19
 
20
  # initialize pinecone
21
  pinecone.init(
 
23
  environment=PINECONE_API_ENV # next to api key in console
24
  )
25
 
26
+ index_name = PINECONE_INDEX
27
  vectorstore = Pinecone.from_existing_index(index_name=index_name, embedding=embeddings)
28
 
29
+ api_key = os.environ["OPENAI_API_KEY"]
30
 
31
 
32
  class ChatWrapper:
 
53
  os.environ["OPENAI_API_KEY"] = ""
54
 
55
  import openai
56
+ openai.api_key = os.environ["OPENAI_API_KEY"]
57
  # Run chain and append input.
58
  output = chain({"question": inp, "chat_history": history})["answer"]
59
  history.append((inp, output))