Siddhant commited on
Commit
f293bce
·
unverified ·
1 Parent(s): 50d754a

environment variable method changed

Browse files
Files changed (2) hide show
  1. app.py +9 -5
  2. requirements.txt +77 -3
app.py CHANGED
@@ -8,14 +8,18 @@ import pinecone
8
  from langchain.vectorstores import Chroma, Pinecone
9
  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
- PINECONE_API_KEY = os.environ.get("PINECONE_API_KEY")
17
- PINECONE_API_ENV = os.environ.get("PINECONE_API_ENV")
18
- PINECONE_INDEX = os.environ.get("PINECONE_INDEX")
19
 
20
  # initialize pinecone
21
  pinecone.init(
@@ -26,7 +30,7 @@ pinecone.init(
26
  index_name = PINECONE_INDEX
27
  vectorstore = Pinecone.from_existing_index(index_name=index_name, embedding=embeddings)
28
 
29
- api_key = os.environ.get("OPENAI_API_KEY")
30
 
31
 
32
  class ChatWrapper:
@@ -53,7 +57,7 @@ class ChatWrapper:
53
  os.environ["OPENAI_API_KEY"] = ""
54
 
55
  import openai
56
- openai.api_key = os.environ.get("OPENAI_API_KEY")
57
  # Run chain and append input.
58
  output = chain({"question": inp, "chat_history": history})["answer"]
59
  history.append((inp, output))
 
8
  from langchain.vectorstores import Chroma, Pinecone
9
  from langchain.embeddings.openai import OpenAIEmbeddings
10
 
11
+ from dotenv import load_dotenv
12
+
13
+ load_dotenv()
14
+
15
  embeddings = OpenAIEmbeddings()
16
 
17
  # PINECONE_API_KEY = '6af52b8a-a3df-4189-899b-b21163027bb8'
18
  # PINECONE_API_ENV = 'asia-southeast1-gcp'
19
 
20
+ PINECONE_API_KEY = os.environ["PINECONE_API_KEY"]
21
+ PINECONE_API_ENV = os.environ["PINECONE_API_ENV"]
22
+ PINECONE_INDEX = os.environ["PINECONE_INDEX"]
23
 
24
  # initialize pinecone
25
  pinecone.init(
 
30
  index_name = PINECONE_INDEX
31
  vectorstore = Pinecone.from_existing_index(index_name=index_name, embedding=embeddings)
32
 
33
+ api_key = os.environ["OPENAI_API_KEY"]
34
 
35
 
36
  class ChatWrapper:
 
57
  os.environ["OPENAI_API_KEY"] = ""
58
 
59
  import openai
60
+ openai.api_key = os.environ["OPENAI_API_KEY"]
61
  # Run chain and append input.
62
  output = chain({"question": inp, "chat_history": history})["answer"]
63
  history.append((inp, output))
requirements.txt CHANGED
@@ -1,7 +1,81 @@
1
  langchain~=0.0.123
2
- openai
3
  unstructured
4
  faiss-cpu
5
- gradio
6
  pinecone-client
7
- tiktoken
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  langchain~=0.0.123
2
+ openai~=0.27.2
3
  unstructured
4
  faiss-cpu
5
+ gradio~=3.25.0
6
  pinecone-client
7
+ tiktoken
8
+ dnspython~=2.3.0
9
+ idna~=2.10
10
+ requests~=2.25.1
11
+ httpx~=0.24.0
12
+ h11~=0.14.0
13
+ Pillow~=9.4.0
14
+ pip~=20.2.3
15
+ attrs~=22.2.0
16
+ Jinja2~=3.1.2
17
+ toolz~=0.12.0
18
+ beautifulsoup4~=4.9.3
19
+ nltk~=3.8.1
20
+ matplotlib~=3.7.1
21
+ numpy~=1.22.3
22
+ regex~=2022.10.31
23
+ scipy~=1.9.3
24
+ scikit-learn~=1.2.0
25
+ click~=8.1.3
26
+ tqdm~=4.64.1
27
+ pyparsing~=3.0.9
28
+ pytz~=2021.3
29
+ colorama~=0.4.6
30
+ PyYAML~=6.0
31
+ multidict~=6.0.4
32
+ anyio~=3.6.2
33
+ sniffio~=1.3.0
34
+ torch~=1.13.1
35
+ setuptools~=49.2.1
36
+ httpcore~=0.17.0
37
+ certifi~=2020.12.5
38
+ mdurl~=0.1.2
39
+ pandas~=1.4.1
40
+ pydantic~=1.10.4
41
+ altair~=4.2.2
42
+ jsonschema~=4.17.3
43
+ entrypoints~=0.4
44
+ fsspec~=2023.4.0
45
+ config~=0.5.1
46
+ aiohttp~=3.8.4
47
+ yarl~=1.8.2
48
+ fastapi~=0.89.1
49
+ MarkupSafe~=2.1.1
50
+ orjson~=3.8.10
51
+ starlette~=0.22.0
52
+ transformers~=4.25.1
53
+ aiofiles~=23.1.0
54
+ ffmpy~=0.3.0
55
+ uvicorn~=0.20.0
56
+ pydub~=0.25.1
57
+ joblib~=1.2.0
58
+ tenacity~=8.2.2
59
+ SQLAlchemy~=1.4.47
60
+ python-dateutil~=2.8.2
61
+ aiosignal~=1.3.1
62
+ frozenlist~=1.3.3
63
+ python-multipart~=0.0.6
64
+ packaging~=22.0
65
+ websockets~=11.0.1
66
+ six~=1.16.0
67
+ greenlet~=2.0.2
68
+ urllib3~=1.26.4
69
+ chardet~=4.0.0
70
+ contourpy~=1.0.7
71
+ fonttools~=4.39.3
72
+ selenium~=3.141.0
73
+ itsdangerous~=2.1.2
74
+ pyrsistent~=0.19.3
75
+ cycler~=0.11.0
76
+ kiwisolver~=1.4.4
77
+ zipp~=3.11.0
78
+ psycopg2~=2.9.5
79
+ marshmallow~=3.19.0
80
+ filelock~=3.9.0
81
+ python-dotenv~=0.21.1