star-nox commited on
Commit
d87617b
1 Parent(s): b4791c9

fixed pinecone

Browse files
__pycache__/retrieval.cpython-310.pyc CHANGED
Binary files a/__pycache__/retrieval.cpython-310.pyc and b/__pycache__/retrieval.cpython-310.pyc differ
 
__pycache__/retrieval.cpython-39.pyc ADDED
Binary file (2.89 kB). View file
 
retrieval.py CHANGED
@@ -15,8 +15,6 @@ from dotenv import load_dotenv
15
  from PIL import Image
16
  from transformers import (AutoModelForSequenceClassification, AutoTokenizer, GPT2Tokenizer, OPTForCausalLM, T5ForConditionalGeneration)
17
 
18
- PINECONE_API_KEY="insert your pinecone api key here"
19
-
20
  class Retrieval:
21
  def __init__(self,
22
  device='cuda',
@@ -35,12 +33,15 @@ class Retrieval:
35
 
36
  def _load_pinecone_vectorstore(self,):
37
  model_name = "intfloat/e5-large" # best text embedding model. 1024 dims.
38
- pincecone_index = pinecone.Index("uiuc-chatbot")
39
  embeddings = HuggingFaceEmbeddings(model_name=model_name)
40
  #pinecone.init(api_key=os.environ['PINECONE_API_KEY'], environment="us-west1-gcp")
41
  pinecone.init(api_key=PINECONE_API_KEY, environment="us-west1-gcp")
 
42
 
 
43
  print(pinecone.list_indexes())
 
44
 
45
  self.vectorstore = Pinecone(index=pincecone_index, embedding_function=embeddings.embed_query, text_key="text")
46
 
 
15
  from PIL import Image
16
  from transformers import (AutoModelForSequenceClassification, AutoTokenizer, GPT2Tokenizer, OPTForCausalLM, T5ForConditionalGeneration)
17
 
 
 
18
  class Retrieval:
19
  def __init__(self,
20
  device='cuda',
 
33
 
34
  def _load_pinecone_vectorstore(self,):
35
  model_name = "intfloat/e5-large" # best text embedding model. 1024 dims.
36
+
37
  embeddings = HuggingFaceEmbeddings(model_name=model_name)
38
  #pinecone.init(api_key=os.environ['PINECONE_API_KEY'], environment="us-west1-gcp")
39
  pinecone.init(api_key=PINECONE_API_KEY, environment="us-west1-gcp")
40
+ pincecone_index = pinecone.Index("uiuc-chatbot")
41
 
42
+ print("PINECONE: ")
43
  print(pinecone.list_indexes())
44
+ print(pincecone_index.describe_index_stats())
45
 
46
  self.vectorstore = Pinecone(index=pincecone_index, embedding_function=embeddings.embed_query, text_key="text")
47