mdirshad09 commited on
Commit
0290079
·
1 Parent(s): 58e9235

Update pinecone.py

Browse files
Files changed (1) hide show
  1. pinecone.py +7 -19
pinecone.py CHANGED
@@ -1,6 +1,5 @@
1
  import uuid
2
  import pinecone
3
- from pinecone import PineconeProtocolError
4
  class Pinecone:
5
  def __init__(self, api_key, environment, index_name):
6
  self.api_key = api_key
@@ -25,22 +24,11 @@ class Pinecone:
25
  self.index.upsert(data)
26
 
27
  def search_data(self, query_embedding):
28
- try:
29
- matches = self.index.query(
30
- vector=query_embedding,
31
- top_k=10,
32
- include_values=True,
33
- include_metadata = True
34
- )
35
- except PineconeProtocolError as e:
36
- print(f"PineconeProtocolError occurred: {e}")
37
- pinecone.deinit()
38
- pinecone.init(api_key= self.api_key,environment=self.environment)
39
- index = pinecone.Index(self.index_name)
40
- matches = index.query(
41
- vector=query_embedding,
42
- top_k=10,
43
- include_values=True,
44
- include_metadata = True
45
- )
46
  return matches
 
1
  import uuid
2
  import pinecone
 
3
  class Pinecone:
4
  def __init__(self, api_key, environment, index_name):
5
  self.api_key = api_key
 
24
  self.index.upsert(data)
25
 
26
  def search_data(self, query_embedding):
27
+
28
+ matches = self.index.query(
29
+ vector=query_embedding,
30
+ top_k=10,
31
+ include_values=True,
32
+ include_metadata = True
33
+ )
 
 
 
 
 
 
 
 
 
 
 
34
  return matches